Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 172599

Getting a machines VCAC:Reservation

$
0
0

I have the following code in an action (it takes a vCAC:VCACHost and a vCAC:VirtualMachine as inputs):

 

var id = vCACMachine.getProperty("HostReservationID");

System.debug("Reservation Id: " + id);

 

var idprop = new Properties( {

"HostReservationID" : id

});

 

if (!id || id == "") throw "Error getting Reservation ID of VM.";

var entity = vCACEntityManager.readModelEntity(vCACHost.id, "ManagementModelEntities.svc", "HostReservations", idprop, null);

 

System.debug("Got Entity: " + entity);

var reservation = entity.getInventoryObject();

if (!reservation) throw "Reservation with ID '" + id + "' not found";

return reservation;

 

I'm getting an error "Cannot create vCACReservation object : java.lang.NullPointerException" on the var reservation = entity.getInventoryObject(); line. The reservation id and the entity are being logged in the debug:

 

2020-02-27 11:42:20.754] [D] Reservation Id: f5f95f3e-53d9-43a7-bff9-837ec54acbc6

[2020-02-27 11:42:20.793] [D] Got Entity: DynamicWrapper (Instance) : [VCACEntity]-[class com.vmware.o11n.plugin.dynamicops.model.Entity] -- VALUE : org.odata4j.core.OEntities$OEntityAtomImpl@683d9163[title=,categoryTerm=DynamicOps.ManagementModel.HostReservation,entitySet=EdmEntitySet[HostReservations,org.odata4j.edm.EdmEntityType$Builder$1@2db42c7c],entityType=EdmEntityType[DynamicOps.ManagementModel.HostReservation,alias=null],entityKey=(guid'f5f95f3e-53d9-43a7-bff9-837ec54acbc6'),properties=[OProperty[HostReservationID,EdmSimpleType[Edm.Guid],f5f95f3e-53d9-43a7-bff9-837ec54acbc6]..................................

 

Any ideas why the VCACReservation object can't be created?

 

(v7.5)


Viewing all articles
Browse latest Browse all 172599

Trending Articles



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