Hi,
I am using php api for vcloud.
the api is returning the error:
Fatal error: Uncaught exception 'VMware_VCloud_SDK_Exception' with message 'PUT https://186.233.144.180/api/vApp/vm-43086a1c-2582-4180-906a-e06e48b2e5ef/virtualHardwareSection/memory failed, error code: 400, error: <?xml version="1.0" encoding="UTF-8"?>
<Error xmlns="http://www.vmware.com/vcloud/v1.5" stackTrace="javax.ws.rs.WebApplicationException: com.vmware.vcloud.common.xml.XMLProcessingException: Bad request
at com.vmware.vcloud.api.rest.providers.CommonJAXBProvider.readFrom(CommonJAXBProvider.java:255)
at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:1025)
at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:606)
at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:571)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:239)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:91)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
at java.util.concurrent.Executors$RunnableA in /home/httpd/htdocs/vcloudPHP-5.1.0/library/VMware/VCloud/ServiceAbstract.php on line 215
I am trying to change the memory of a vm like this:
$newvalue = 64;
$mem = $sdkVm->getVirtualMemory();
$vq = $mem->getVirtualQuantity();
$vq->set_valueOf($newvalue);
$mem->setVirtualQuantity($vq);
$sdkVm->modifyVirtualMemory($mem);
what I get on an export if I do:
$mem = $sdkVm->getVirtualMemory();
$vq = $mem->getVirtualQuantity();
$vq->set_valueOf($newvalue);
$mem->setVirtualQuantity($vq);
$xmlstr = $mem->export();
echo $xmlstr;
<Item xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:vcloud="http://www.vmware.com/vcloud/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:ovfenv="http://schemas.dmtf.org/ovf/environment/1" xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:vmw="http://www.vmware.com/schema/ovf" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ns12:href="https://186.233.144.180/api/vApp/vm-43086a1c-2582-4180-906a-e06e48b2e5ef/virtualHardwareSection/memory" ns12:type="application/vnd.vmware.vcloud.rasdItem+xml" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5http://186.233.144.180/api/v1.5/schema/master.xsdhttp://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingDatahttp://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd">
<rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
<rasd:Description>Memory Size</rasd:Description>
<rasd:ElementName>16 MB of memory</rasd:ElementName>
<rasd:InstanceID>5</rasd:InstanceID>
<rasd:Reservation>0</rasd:Reservation>
<rasd:ResourceType>4</rasd:ResourceType>
<rasd:VirtualQuantity>64</rasd:VirtualQuantity>
<rasd:Weight>0</rasd:Weight>
<vcloud:Link href="https://186.233.144.180/api/vApp/vm-43086a1c-2582-4180-906a-e06e48b2e5ef/virtualHardwareSection/memory" type="application/vnd.vmware.vcloud.rasdItem+xml" rel="edit"/>
</Item>
What is wrong?
Regards,
Fabi