Quantcast
Channel: VMware Communities : Discussion List - vSphere SDK for Perl
Viewing all articles
Browse latest Browse all 1577

No access to entity error for vApp while setting computer name

$
0
0


I am trying to set computer name in VMDetails.java example and getting following errors:


com.vmware.vcloud.sdk.VCloudException: No access to entity "Test(com.vmware.vcloud.entity.vm:e4cc2eb3-e6b6-42c6-b17a-0ab8988e7c9e)".
                 
at com.vmware.vcloud.sdk.Response.handleUnExpectedResponse(Response.java:132)
                 
at com.vmware.vcloud.sdk.SdkUtil.validateResponse(SdkUtil.java:189)
                 
at com.vmware.vcloud.sdk.SdkUtil.put(SdkUtil.java:148)
                 
at com.vmware.vcloud.sdk.VM.updateSection(VM.java:361)
                 
at com.vmware.vcloud.sdk.samples.VMDetails.main(VMDetails.java:93)


This vApp is created by the same user and I could set computer name interactively from vCloud client.


Following is the code:


for

(ReferenceType orgRef : orgsList.values()) {
      

for

(ReferenceType vdcRef : Organization

.getOrganizationByReference(vcloudClient, orgRef).getVdcRefs()) {
              Vdc vdc = Vdc.getVdcByReference(vcloudClient, vdcRef);

                    System.<font color="#0000c0" size="2"><font color="#0000c0" size="2">out</font></font>.println("Vdc : "+ vdcRef.getName() +" : "+ vdc.getResource().getAllocationModel());
       

for

(ReferenceType vAppRef : Vdc.getVdcByReference(vcloudClient, vdcRef).getVappRefs()) {          
              System.
<font color="#0000c0" size="2"><font color="#0000c0" size="2">out</font></font>.println(" Vapp : "+ vAppRef.getName());
             
Vapp vapp = Vapp.getVappByReference(vcloudClient, vAppRef);

                   List<VM> vms = vapp.getChildrenVms();
       

for

(VM vm : vms) { 
            
System.<font color="#0000c0" size="2"><font color="#0000c0" size="2">out</font></font>.println("Setting the guest customization settings of the vm");
            
GuestCustomizationSectionType guestCustomizationSection = vm.getGuestCustomizationSection();
            
guestCustomizationSection.setComputerName("newMachineName"); 
      

try


             
vm.updateSection(guestCustomizationSection).waitForTask(0);
             
}
             

catch

(TimeoutException e)
              {
             
e.printStackTrace();
             
}
       
}
   
 }
}
 



Following are the log entries.


Setting the guest customization settings of the vm
Apr 16, 2014 10:15:25 AM com.vmware.vcloud.sdk.RestUtil put
INFO: PUT URL - https://pnvcloud/api/vApp/vm-e4cc2eb3-e6b6-42c6-b17a-0ab8988e7c9e/guestCustomizationSection/
Apr 16, 2014 10:15:25 AM com.vmware.vcloud.sdk.RestUtil put
INFO: PUT Request Body - <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns6:GuestCustomizationSection xmlns="http://www.vmware.com/vcloud/versions" xmlns:ns2="http://schemas.dmtf.org/ovf/envelope/1" xmlns:ns3="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:ns4="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ns5="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:ns6="http://www.vmware.com/vcloud/v1.5" xmlns:ns7="http://www.vmware.com/schema/ovf" xmlns:ns8="http://schemas.dmtf.org/ovf/environment/1" xmlns:ns9="http://www.vmware.com/vcloud/extension/v1.5" href="https://pnvcloud/api/vApp/vm-e4cc2eb3-e6b6-42c6-b17a-0ab8988e7c9e/guestCustomizationSection/" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" ns2:required="false">
<ns2:Info>Specifies Guest OS Customization Settings</ns2:Info>
<ns6:Enabled>false</ns6:Enabled>
<ns6:ChangeSid>false</ns6:ChangeSid>
<ns6:VirtualMachineId>e4cc2eb3-e6b6-42c6-b17a-0ab8988e7c9e</ns6:VirtualMachineId>
<ns6:JoinDomainEnabled>false</ns6:JoinDomainEnabled>
<ns6:UseOrgSettings>false</ns6:UseOrgSettings>
<ns6:AdminPasswordEnabled>false</ns6:AdminPasswordEnabled>
<ns6:AdminPasswordAuto>true</ns6:AdminPasswordAuto>
<ns6:ResetPasswordRequired>false</ns6:ResetPasswordRequired>
<ns6:ComputerName>virtualtc1</ns6:ComputerName>
<ns6:Link rel="edit" href="https://pnvcloud/api/vApp/vm-e4cc2eb3-e6b6-42c6-b17a-0ab8988e7c9e/guestCustomizationSection/" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml"/>
</ns6:GuestCustomizationSection>
Apr 16, 2014 10:15:25 AM com.vmware.vcloud.sdk.RestUtil put
INFO: PUT Request Content Type - application/vnd.vmware.vcloud.guestCustomizationSection+xml
Apr 16, 2014 10:15:25 AM com.vmware.vcloud.sdk.RestUtil put
INFO: Status Code - 403
Apr 16, 2014 10:15:25 AM com.vmware.vcloud.sdk.RestUtil put
INFO: Status - Forbidden
Apr 16, 2014 10:15:25 AM com.vmware.vcloud.sdk.RestUtil put
INFO: Response - <?xml version="1.0" encoding="UTF-8"?>
<Error xmlns="http://www.vmware.com/vcloud/v1.5" minorErrorCode="ACCESS_TO_RESOURCE_IS_FORBIDDEN" message="No access to entity &quot;Test(com.vmware.vcloud.entity.vm:e4cc2eb3-e6b6-42c6-b17a-0ab8988e7c9e)&quot;." majorErrorCode="403" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5http://134.244.246.67/api/v1.5/schema/master.xsd"></Error>
Apr 16, 2014 10:15:25 AM com.vmware.vcloud.sdk.Response isExpected
INFO: Expected Status Code - 202
Apr 16, 2014 10:15:25 AM com.vmware.vcloud.sdk.Response isExpected
INFO: Actual Status Code - 403
Exception in thread "main"


 


Please advice on the issue. Any pointers would be very helpful.


Also, I am trying to see if Windows OS login can also be automated after powering up VM.

 


Viewing all articles
Browse latest Browse all 1577

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>