// The key we specify does not matter, and will get reassigned, so we start with -1
// and go lower (the system assigned keys are positive). Without specifying the keys,
// multiple updates in a single call will not work.
vmdk.setKey(key);
key--;
VirtualDeviceSpec spec = new VirtualDeviceSpecImpl();
spec.setOperation(VirtualDeviceSpec.Operation.add);
if (createDisk) {
spec.setFileOperation(VirtualDeviceSpec.FileOperation.create);
}
spec.setDevice(vmdk);
return spec;
}