mirror of https://github.com/apache/cloudstack.git
vmware: plugin improvements
- use sticky chmod 1777 on the mountpoint - remove dead code - port improved code for moving disk into corresponding folder from master - for dummy worker case, check case for powered off vm state Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
4d9a94ce69
commit
eea716b791
|
|
@ -765,7 +765,7 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
|
|||
|
||||
// Change permissions for the mountpoint
|
||||
script = new Script(true, "chmod", _timeout, s_logger);
|
||||
script.add("777", mountPoint);
|
||||
script.add("1777", mountPoint);
|
||||
result = script.execute();
|
||||
if (result != null) {
|
||||
s_logger.warn("Unable to set permissions for " + mountPoint + " due to " + result);
|
||||
|
|
|
|||
|
|
@ -1822,7 +1822,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
|||
|
||||
int getReservedCpuMHZ(VirtualMachineTO vmSpec) {
|
||||
if (vmSpec.getDetails().get(VMwareGuru.VmwareReserveCpu.key()).equalsIgnoreCase("true")) {
|
||||
return vmSpec.getMinSpeed();
|
||||
return vmSpec.getMinSpeed() * vmSpec.getCpus();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -2475,7 +2475,6 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
|||
private Pair<ManagedObjectReference, String> prepareNetworkFromNicInfo(HostMO hostMo, NicTO nicTo, boolean configureVServiceInNexus, VirtualMachine.Type vmType) throws Exception {
|
||||
|
||||
Ternary<String, String, String> switchDetails = getTargetSwitch(nicTo);
|
||||
nicTo.getType();
|
||||
VirtualSwitchType switchType = VirtualSwitchType.getType(switchDetails.second());
|
||||
String switchName = switchDetails.first();
|
||||
String vlanToken = switchDetails.third();
|
||||
|
|
|
|||
|
|
@ -478,9 +478,12 @@ public class VmwareStorageProcessor implements StorageProcessor {
|
|||
dsMo.deleteFile(srcFile, dcMo.getMor(), true);
|
||||
}
|
||||
// restoreVM - move the new ROOT disk into corresponding VM folder
|
||||
String vmInternalCSName = volume.getVmName();
|
||||
if (dsMo.folderExists(String.format("[%s]", dsMo.getName()), vmInternalCSName)) {
|
||||
VmwareStorageLayoutHelper.syncVolumeToVmDefaultFolder(dcMo, vmInternalCSName, dsMo, vmdkFileBaseName);
|
||||
VirtualMachineMO restoreVmMo = dcMo.findVm(volume.getVmName());
|
||||
if (restoreVmMo != null) {
|
||||
String vmNameInVcenter = restoreVmMo.getName(); // VM folder name in datastore will be VM's name in vCenter.
|
||||
if (dsMo.folderExists(String.format("[%s]", dsMo.getName()), vmNameInVcenter)) {
|
||||
VmwareStorageLayoutHelper.syncVolumeToVmDefaultFolder(dcMo, vmNameInVcenter, dsMo, vmdkFileBaseName);
|
||||
}
|
||||
}
|
||||
|
||||
VolumeObjectTO newVol = new VolumeObjectTO();
|
||||
|
|
@ -598,7 +601,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
|
|||
}
|
||||
|
||||
vmMo = hyperHost.findVmOnHyperHost(vmName);
|
||||
if (vmMo == null) {
|
||||
if (vmMo == null || VmwareResource.getVmState(vmMo) == PowerState.PowerOff) {
|
||||
// create a dummy worker vm for attaching the volume
|
||||
DatastoreMO dsMo = new DatastoreMO(hyperHost.getContext(), morDs);
|
||||
workerVm = HypervisorHostHelper.createWorkerVM(hyperHost, dsMo, workerVmName);
|
||||
|
|
|
|||
Loading…
Reference in New Issue