{
VirtualDeviceConfigSpec controllerSpec =
new VirtualDeviceConfigSpec();
controllerSpec.setOperation(VirtualDeviceConfigSpecOperation.add);
VirtualController ctrl = null;
boolean isScsi = true;
switch(type_) {
case IDE:
isScsi = false;
ctrl = new VirtualIDEController();
break;
case BUSLOGIC:
isScsi = true;
ctrl = new VirtualBusLogicController();
break;
case LSILOGIC:
isScsi = true;
ctrl = new VirtualLsiLogicController();
break;
case LSILOGICSAS:
isScsi = true;
ctrl = new VirtualLsiLogicSASController();
break;
default:
return null;
}
ctrl.setKey(ckey_);
ctrl.setBusNumber(busNumber_);
if (isScsi) {
assert ctrl instanceof VirtualSCSIController;
VirtualSCSIController scsiCtrl = (VirtualSCSIController) ctrl;
scsiCtrl.setSharedBus(VirtualSCSISharing.noSharing);
}