VMware Cloud Community
harj123
Enthusiast
Enthusiast

update disk using extensibility

I am trying to update the disk controller number by running the below code during `compute.post.provision`. How can I pass the updated disk value to the venter so that the number gets changed? is it even possible or am I barking up the wrong tree? Thanks

customProperties = inputProperties["customProperties"];

var vcUuid = customProperties.vcUuid
System.log("vcuuid is :" + vcUuid);

var externalId = inputProperties["externalIds"][0];
System.log("external id found : " + externalId);
var sdkConnection = VcPlugin.findSdkConnectionForUUID(vcUuid);

vcVm = sdkConnection.searchIndex.findByUuid(null, externalId, true, true);
System.log("vm hostname: " + vcVm.hostName);
var devices = vcVm.config.hardware.device;

for each (var disk in devices) {
    var is_disk = disk instanceof VcVirtualDisk;
    if (is_disk){
        if ((disk.backing.fileName).split('/')[1].split('.')[0] == inputProperties["resourceNames"][0]){
            disk.unitNumber = 5;       
    }
}

 

0 Kudos
0 Replies