Hi,
I'm attempting to attach disks to a blank VM. I can add up to 16 disks just fine, but adding any more returns the vSphere error "The device '0' is referring to a nonexisting controller '1,001".
I was getting a similar error when I was attempting to overcome a lower disk limit (I think it was 4 or 5) as I was forcefully adding SCSI controllers to the VM, however I found if you add disks in batches of 4 this automatically adds SCSI controllers.
When I look at the VM in vSphere, I can see the final thing it does is a new SCSI controller (as all LUNs on SCSI 0 are full) and adds a new disk to that, but adding any more produces the above error.
My question is: Can anybody else reproduce this, and if not, how are you adding more than 16 disks to a VM through the vCloud SDK? I do not have this problem going through the vSphere Web Services SDK.
My code for adding disks is as below:
private static VirtualDisk assignDisk(int parentID)
{
VirtualDisk d;
int id = parentID + 10;
System.out.println("Adding new disk(" + id + ") to SCSI controller " + parentID + " on LUN " + id);
CimString cimString = new CimString();
Map<QName, String> cimAttributes = cimString.getOtherAttributes();
cimAttributes.put(new QName("http://www.vmware.com/vcloud/v1.5",
"busSubType", "vcloud"), "lsilogic");
cimAttributes.put(new QName("http://www.vmware.com/vcloud/v1.5",
"busType", "vcloud"), "6"); // 6 is SCSI bus type
cimAttributes.put(new QName("http://www.vmware.com/vcloud/v1.5",
"capacity", "vcloud"), String.valueOf(1024));
CimString elementName = new CimString();
elementName.setValue("Hard Disk " + id);
CimString instanceID = new CimString();
instanceID.setValue(String.valueOf(id));
//Need a unique instance ID for every piece of virtual hardware in the system
com.vmware.vcloud.api.rest.schema.ovf.ResourceType resType =
new com.vmware.vcloud.api.rest.schema.ovf.ResourceType();
resType.setValue("17"); // 17 is SCSI disk
RASDType diskItemType = new RASDType();
diskItemType.setElementName(elementName);
diskItemType.setInstanceID(instanceID);
diskItemType.setResourceType(resType);
List<CimString> diskAttributes = diskItemType.getHostResource();
diskAttributes.add(cimString);
d = new VirtualDisk(diskItemType);
return d;
}