IssuesName:
1)Setting Hostname for deployed VM
CODE:
HttpPut put = new HttpPut(
"https://rhevmanager/api/vms/3a4a3c6e-4bbc-4fea-8bb3-dcb6b4587ee4/");
String inputXML1 = "" +""+""
+ "ultimatixuat.net"
+"meghaasadmin"
+"false"
+""+""+
"eth0"+
""
+ "STATIC_IP "+
" true"+
""+
""
+""+"";
StringEntity input = new StringEntity(inputXML1);
put.setEntity(input);
put.setHeader("Content-Type", "application/xml");
HttpResponse responseNIC = httpclient.execute(put);
System.out
.println("RESPONSE ::::::::::::::::::::::::::::::::::: "
+ responseNIC);
BufferedReader rd1 = new BufferedReader(new InputStreamReader(
responseNIC.getEntity().getContent()));
String line1 = "";
while ((line1 = rd1.readLine()) != null) {
System.out.println("LINE ::::::::::::: " + line1);
}
NOTE: I have tried with Tagname , and other related tags and placed them at various positions but still it gave bad request error.
ERROR:
RESPONSE ::::::::::::::::::::::::::::::::::: HTTP/1.1 400 Bad Request
[Date: Wed, 27 Aug 2014 08:18:52 GMT, Content-Type: application/xml,
Content-Length: 5663, Vary: Accept-Encoding, Connection: close] LINE
:::::::::::::
Request syntactically incorrect. See the link
description below for the correct usage:
update the virtual machine in the system for
the given virtual machine id
PUT
Content-Type
application/xml|json
Correlation-Id
any string
VM
update the virtual machine in the system
for the given virtual machine id with the values specified in the
request
vm.name
vm.cluster.id|name
vm.timezone
vm.os.boot
boot.dev
vm.custom_properties.custom_property
custom_property.name
custom_property.value
vm.os.type
vm.usb.enabled
vm.usb.type
vm.type
vm.os.initRd
vm.display.monitors
vm.display.single_qxl_pci
vm.display.type
vm.display.allow_override
vm.display.smartcard_enabled
vm.display.keyboard_layout
vm.os.cmdline
vm.cpu.mode
vm.cpu.architecture
vm.cpu.topology.cores
vm.cpu_shares
vm.memory
vm.high_availability.priority
vm.high_availability.enabled
vm.domain.name
vm.description
vm.comment
vm.stateless
vm.delete_protected
vm.sso.methods.method
method.id
vm.console.enabled
vm.cpu.topology.sockets
vm.placement_policy.affinity
vm.placement_policy.host.id|name
vm.origin
vm.os.kernel
vm.tunnel_migration
vm.migration_downtime
vm.virtio_scsi.enabled
vm.use_latest_template_version
vm.payloads.payload
payload.type
payload.volume_id
payload.files.file
file.name
file.content
vm.cpu.cpu_tune.vcpu_pin
vcpu_pin.vcpu
vcpu_pin.cpu_set
VM
2)Setting Ip, subnet, gateway to the deployed VM
HttpPut put = new HttpPut(
"https://rhevmanager/api/vms/3a4a3c6e-4bbc-4fea-8bb3-dcb6b4587ee4/");
String inputXML1 = "" +""+""
+ "ultimatixuat.net"
+"false"
+""+""+
"eth0"+
""
+ "STATIC_IP "+
" true"+
""+
""
+""+"";
StringEntity input = new StringEntity(inputXML1);
put.setEntity(input);
put.setHeader("Content-Type", "application/xml");
HttpResponse responseNIC = httpclient.execute(put);
System.out
.println("RESPONSE ::::::::::::::::::::::::::::::::::: "
+ responseNIC);
BufferedReader rd1 = new BufferedReader(new InputStreamReader(
responseNIC.getEntity().getContent()));
String line1 = "";
while ((line1 = rd1.readLine()) != null) {
System.out.println("LINE ::::::::::::: " + line1);
}
ERROR faced:
RESPONSE ::::::::::::::::::::::::::::::::::: HTTP/1.1 500 Internal Server Error [Date: Wed, 27 Aug 2014 07:22:25 GMT, Content-Type: text/html;charset=utf-8, Content-Length: 4589, Vary: Accept-Encoding, Connection: close]
LINE ::::::::::::: JBoss Web/7.3.1.Final-redhat-1 - JBWEB000064: Error report JBWEB000065: HTTP Status 500 - java.lang.NullPointerException
JBWEB000309: type JBWEB000066: Exception report
JBWEB000068: message java.lang.NullPointerException
JBWEB000069: description JBWEB000145: The server encountered an internal error that prevented it from fulfilling this request.
JBWEB000070: exception
org.jboss.resteasy.spi.UnhandledException: java.lang.NullPointerException
LINE ::::::::::::: org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:365)
LINE ::::::::::::: org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:233)
LINE ::::::::::::: org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:209)
LINE ::::::::::::: org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:557)
LINE ::::::::::::: org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
LINE ::::::::::::: org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)
LINE ::::::::::::: org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
LINE ::::::::::::: org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
LINE ::::::::::::: org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
LINE ::::::::::::: javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
LINE ::::::::::::: org.ovirt.engine.core.authentication.AuthenticationFilter.doFilter(AuthenticationFilter.java:80)
LINE :::::::::::::
JBWEB000071: root cause
java.lang.NullPointerException
LINE ::::::::::::: org.ovirt.engine.api.restapi.resource.BackendVmsResource.setPayload(BackendVmsResource.java:484)
LINE ::::::::::::: org.ovirt.engine.api.restapi.resource.BackendVmResource.deprecatedPopulate(BackendVmResource.java:426)
LINE ::::::::::::: org.ovirt.engine.api.restapi.resource.BackendVmResource.deprecatedPopulate(BackendVmResource.java:78)
LINE ::::::::::::: org.ovirt.engine.api.restapi.resource.AbstractBackendSubResource.performUpdate(AbstractBackendSubResource.java:84)
LINE ::::::::::::: org.ovirt.engine.api.restapi.resource.BackendVmResource.update(BackendVmResource.java:127)
LINE ::::::::::::: org.ovirt.engine.api.restapi.resource.BackendVmResource.update(BackendVmResource.java:78)
LINE ::::::::::::: sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
LINE ::::::::::::: sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
LINE ::::::::::::: sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
LINE ::::::::::::: java.lang.reflect.Method.invoke(Method.java:606)
LINE ::::::::::::: org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
LINE ::::::::::::: org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269)
LINE ::::::::::::: org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227)
LINE ::::::::::::: org.jboss.resteasy.core.ResourceLocator.invokeOnTargetObject(ResourceLocator.java:159)
LINE ::::::::::::: org.jboss.resteasy.core.ResourceLocator.invoke(ResourceLocator.java:92)
LINE ::::::::::::: org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542)
LINE ::::::::::::: org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
LINE ::::::::::::: org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)
LINE ::::::::::::: org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
LINE ::::::::::::: org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
LINE ::::::::::::: org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
LINE ::::::::::::: javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
LINE ::::::::::::: org.ovirt.engine.core.authentication.AuthenticationFilter.doFilter(AuthenticationFilter.java:80)
LINE :::::::::::::
JBWEB000072: note JBWEB000073: The full stack trace of the root cause is available in the JBoss Web/7.3.1.Final-redhat-1 logs.
JBoss Web/7.3.1.Final-redhat-1
Note: We are getting the ip , subnet and mask configured in the machine through this code but it gives internal error as shown above.(cloud init package is installed
and ip is pingable and accessible through putty.
3)Setting Ip, subnet, gateway and Hostname to the deployed WINDOWS VM:
Code:
HttpPut put = new HttpPut(
"https://rhevmanager/api/vms/4df40db5-278a-43c6-a572-22abe151c01c/");
String inputXML1 = ""
+""+""+""+""+""
+""+"ultimatixuat.net"+""
+""+""+ ""+""
+"/WEB-INF/sysprep.xml"
+""+""+""+""
+""+""+""+""
+"WIN-AS05EOADAwerwer"+""+"";
StringEntity input1 = new StringEntity(inputXML1);
put.setEntity(input1);
put.setHeader("Content-Type", "application/xml");
HttpResponse responseNIC = httpclient.execute(put);
System.out
.println("RESPONSE ::::::::::::::::::::::::::::::::::: "
+ responseNIC);
BufferedReader rd1 = new BufferedReader(new InputStreamReader(
responseNIC.getEntity().getContent()));
String line1 = "";
while ((line1 = rd1.readLine()) != null) {
System.out.println("LINE ::::::::::::: " + line1);
}
Note: WE tried deploying without payload also but still error came.Either it gives internal error or bad request error.(installed guest agents in windows template)
ERROR:
RESPONSE ::::::::::::::::::::::::::::::::::: HTTP/1.1 400 Bad Request
[Date: Wed, 27 Aug 2014 08:50:28 GMT, Content-Type: application/xml,
Content-Length: 5663, Vary: Accept-Encoding, Connection: close] LINE
:::::::::::::
Request syntactically incorrect. See the link
description below for the correct usage:
update the virtual machine in the system for
the given virtual machine id
PUT
Content-Type
application/xml|json
Correlation-Id
any string
VM
update the virtual machine in the system
for the given virtual machine id with the values specified in the
request
vm.name
vm.cluster.id|name
vm.timezone
vm.os.boot
boot.dev
vm.custom_properties.custom_property
custom_property.name
custom_property.value
vm.os.type
vm.usb.enabled
vm.usb.type
vm.type
vm.os.initRd
vm.display.monitors
vm.display.single_qxl_pci
vm.display.type
vm.display.allow_override
vm.display.smartcard_enabled
vm.display.keyboard_layout
vm.os.cmdline
vm.cpu.mode
vm.cpu.architecture
vm.cpu.topology.cores
vm.cpu_shares
vm.memory
vm.high_availability.priority
vm.high_availability.enabled
vm.domain.name
vm.description
vm.comment
vm.stateless
vm.delete_protected
vm.sso.methods.method
method.id
vm.console.enabled
vm.cpu.topology.sockets
vm.placement_policy.affinity
vm.placement_policy.host.id|name
vm.origin
vm.os.kernel
vm.tunnel_migration
vm.migration_downtime
vm.virtio_scsi.enabled
vm.use_latest_template_version
vm.payloads.payload
payload.type
payload.volume_id
payload.files.file
file.name
file.content
vm.cpu.cpu_tune.vcpu_pin
vcpu_pin.vcpu
vcpu_pin.cpu_set
VM
--------------------------------xxxxxxxxxxxxxx--------------------------