_guestTrafficInfo = (VmwareTrafficLabel) params.get("guestTrafficInfo");
_publicTrafficInfo = (VmwareTrafficLabel) params.get("publicTrafficInfo");
VmwareContext context = getServiceContext();
volMgr = ComponentContext.inject(VolumeManagerImpl.class);
try {
VmwareManager mgr = context.getStockObject(VmwareManager.CONTEXT_STOCK_NAME);
mgr.setupResourceStartupParams(params);
CustomFieldsManagerMO cfmMo = new CustomFieldsManagerMO(context, context.getServiceContent().getCustomFieldsManager());
cfmMo.ensureCustomFieldDef("Datastore", CustomFieldConstants.CLOUD_UUID);
if (_publicTrafficInfo != null && _publicTrafficInfo.getVirtualSwitchType() != VirtualSwitchType.StandardVirtualSwitch ||
_guestTrafficInfo != null && _guestTrafficInfo.getVirtualSwitchType() != VirtualSwitchType.StandardVirtualSwitch) {
cfmMo.ensureCustomFieldDef("DistributedVirtualPortgroup", CustomFieldConstants.CLOUD_GC_DVP);
}
cfmMo.ensureCustomFieldDef("Network", CustomFieldConstants.CLOUD_GC);
cfmMo.ensureCustomFieldDef("VirtualMachine", CustomFieldConstants.CLOUD_UUID);
cfmMo.ensureCustomFieldDef("VirtualMachine", CustomFieldConstants.CLOUD_NIC_MASK);
cfmMo.ensureCustomFieldDef("VirtualMachine", CustomFieldConstants.CLOUD_VM_INTERNAL_NAME);
VmwareHypervisorHost hostMo = this.getHyperHost(context);
_hostName = hostMo.getHyperHostName();
if (_guestTrafficInfo.getVirtualSwitchType() == VirtualSwitchType.NexusDistributedVirtualSwitch ||
_publicTrafficInfo.getVirtualSwitchType() == VirtualSwitchType.NexusDistributedVirtualSwitch) {
_vsmCredentials = mgr.getNexusVSMCredentialsByClusterId(Long.parseLong(_cluster));
_privateNetworkVSwitchName = mgr.getPrivateVSwitchName(Long.parseLong(_dcId), HypervisorType.VMware);
}
} catch (Exception e) {
s_logger.error("Unexpected Exception ", e);
}
if(_privateNetworkVSwitchName == null) {
_privateNetworkVSwitchName = (String) params.get("private.network.vswitch.name");
}
String value = (String) params.get("vmware.recycle.hung.wokervm");
if(value != null && value.equalsIgnoreCase("true"))
_recycleHungWorker = true;
value = (String)params.get("vmware.root.disk.controller");
if(value != null && value.equalsIgnoreCase("scsi"))
_rootDiskController = DiskControllerType.scsi;
else
_rootDiskController = DiskControllerType.ide;
Integer intObj = (Integer) params.get("ports.per.dvportgroup");
if (intObj != null)
_portsPerDvPortGroup = intObj.intValue();
s_logger.info("VmwareResource network configuration info." +
" private traffic over vSwitch: " + _privateNetworkVSwitchName + ", public traffic over " +
_publicTrafficInfo.getVirtualSwitchType() + " : " + _publicTrafficInfo.getVirtualSwitchName() +
", guest traffic over " + _guestTrafficInfo.getVirtualSwitchType() + " : " +
_guestTrafficInfo.getVirtualSwitchName());
value = params.get("vmware.create.full.clone").toString();
if (value != null && value.equalsIgnoreCase("true")) {
_fullCloneFlag = true;
} else {
_fullCloneFlag = false;
}
value = params.get("vm.instancename.flag").toString();
if (value != null && value.equalsIgnoreCase("true")) {
_instanceNameFlag = true;
} else {
_instanceNameFlag = false;
}
value = (String)params.get("scripts.timeout");
int timeout = NumbersUtil.parseInt(value, 1440) * 1000;
VmwareManager mgr = context.getStockObject(VmwareManager.CONTEXT_STOCK_NAME);
VmwareStorageProcessor storageProcessor = new VmwareStorageProcessor((VmwareHostService)this, _fullCloneFlag, (VmwareStorageMount)mgr,
timeout, this, _shutdown_waitMs, null
);
storageHandler = new VmwareStorageSubsystemCommandHandler(storageProcessor);