VMware {code} Community
daniellynn
Enthusiast
Enthusiast

Error with disk when creating a VM

I'm programmatically creating a new VM. When I do, I get this error:

VMware ESX cannot open the virtual disk, "/vmfs/volumes/4a721a68-0d1c4a-

bf-cea3-001ec9b7d003/78698-160/78698-160.vmdk" for clustering.

Please verify that the virtual disk was created using the

'thick' option.

Cannot open the disk '/vmfs/volumes/4a721a68-0d1c4-

4abf-cea3-001ec9b7d003/78698-160/78698-160.vmdk' or one of

the snapshot disks it depends on. Reason: Thin/TBZ disks

cannot be opened in multiwriter mode..

In the code, I set it to not use thin provisioning and not to lazyzero, but I still get the error. I put the coede below. Any ideas why that error occurs?

// Create a new disk - file based - for the vm

String volumeName = "[util01]";

VirtualDeviceConfigSpec diskSpec = new VirtualDeviceConfigSpec();

diskSpec.fileOperation = VirtualDeviceConfigSpecFileOperation.create;

diskSpec.fileOperationSpecified = true;

diskSpec.operation = VirtualDeviceConfigSpecOperation.add;

diskSpec.operationSpecified = true;

VirtualDisk disk = new VirtualDisk();

VirtualDiskFlatVer2BackingInfo diskfileBacking = new VirtualDiskFlatVer2BackingInfo();

diskfileBacking.fileName = volumeName;

diskfileBacking.diskMode = "persistent";

diskfileBacking.eagerlyScrub = true;

diskfileBacking.thinProvisioned = false;

diskfileBacking.thinProvisionedSpecified = true;

disk.key = 0;

disk.controllerKey = diskCtlrKey;

disk.unitNumber = 0;

disk.backing = diskfileBacking;

disk.capacityInKB = 8092;

disk.controllerKeySpecified = true;

disk.unitNumberSpecified = true;

diskSpec.device = disk;

Reply
0 Kudos
2 Replies
daniellynn
Enthusiast
Enthusiast

To update further, I put in the line

diskfileBacking.eagerlyScrubSpecified = true;

also, it works fine when we first deploy a VM. Where it breaks apparently is if we resize it.

Reply
0 Kudos
daniellynn
Enthusiast
Enthusiast

Issue solved - the problem was actually with the SCSI controller. The sharing property was set to physical, instead of nosharing

Reply
0 Kudos