mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fix nested virt marvin test
This commit is contained in:
parent
94bebe8792
commit
897cc4bdba
@ -1942,7 +1942,6 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
|||||||
VmwareHelper.setBasicVmConfig(vmConfigSpec, vmSpec.getCpus(), vmSpec.getMaxSpeed(), getReservedCpuMHZ(vmSpec), (int) (vmSpec.getMaxRam() / (1024 * 1024)),
|
VmwareHelper.setBasicVmConfig(vmConfigSpec, vmSpec.getCpus(), vmSpec.getMaxSpeed(), getReservedCpuMHZ(vmSpec), (int) (vmSpec.getMaxRam() / (1024 * 1024)),
|
||||||
getReservedMemoryMb(vmSpec), guestOsId, vmSpec.getLimitCpuUse(), deployAsIs);
|
getReservedMemoryMb(vmSpec), guestOsId, vmSpec.getLimitCpuUse(), deployAsIs);
|
||||||
|
|
||||||
if (!deployAsIs) {
|
|
||||||
// Check for multi-cores per socket settings
|
// Check for multi-cores per socket settings
|
||||||
int numCoresPerSocket = 1;
|
int numCoresPerSocket = 1;
|
||||||
String coresPerSocket = vmSpec.getDetails().get(VmDetailConstants.CPU_CORE_PER_SOCKET);
|
String coresPerSocket = vmSpec.getDetails().get(VmDetailConstants.CPU_CORE_PER_SOCKET);
|
||||||
@ -1966,7 +1965,6 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
|||||||
} else {
|
} else {
|
||||||
vmConfigSpec.setCpuHotAddEnabled(vmMo.isCpuHotAddSupported(guestOsId));
|
vmConfigSpec.setCpuHotAddEnabled(vmMo.isCpuHotAddSupported(guestOsId));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
configNestedHVSupport(vmMo, vmSpec, vmConfigSpec);
|
configNestedHVSupport(vmMo, vmSpec, vmConfigSpec);
|
||||||
|
|
||||||
@ -2479,11 +2477,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String getGuestOsIdFromVmSpec(VirtualMachineTO vmSpec, boolean deployAsIs) {
|
private String getGuestOsIdFromVmSpec(VirtualMachineTO vmSpec, boolean deployAsIs) {
|
||||||
String guestOsId = null;
|
return translateGuestOsIdentifier(vmSpec.getArch(), vmSpec.getOs(), vmSpec.getPlatformEmulator()).value();
|
||||||
if (!deployAsIs) {
|
|
||||||
guestOsId = translateGuestOsIdentifier(vmSpec.getArch(), vmSpec.getOs(), vmSpec.getPlatformEmulator()).value();
|
|
||||||
}
|
|
||||||
return guestOsId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Pair<String, String> getControllerInfoFromVmSpec(VirtualMachineTO vmSpec) throws CloudRuntimeException {
|
private Pair<String, String> getControllerInfoFromVmSpec(VirtualMachineTO vmSpec) throws CloudRuntimeException {
|
||||||
|
|||||||
@ -98,6 +98,7 @@ class TestNestedVirtualization(cloudstackTestCase):
|
|||||||
self.logger.debug("Updated global setting vmware.nested.virtualization.perVM to true")
|
self.logger.debug("Updated global setting vmware.nested.virtualization.perVM to true")
|
||||||
rollback_nv_per_vm = True
|
rollback_nv_per_vm = True
|
||||||
|
|
||||||
|
try:
|
||||||
# 2) Deploy a vm
|
# 2) Deploy a vm
|
||||||
virtual_machine = VirtualMachine.create(
|
virtual_machine = VirtualMachine.create(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
@ -118,7 +119,9 @@ class TestNestedVirtualization(cloudstackTestCase):
|
|||||||
self.account.domainid,
|
self.account.domainid,
|
||||||
networkofferingid=self.isolated_network_offering.id)
|
networkofferingid=self.isolated_network_offering.id)
|
||||||
|
|
||||||
|
virtual_machine.stop(self.apiclient)
|
||||||
virtual_machine.add_nic(self.apiclient, isolated_network.id)
|
virtual_machine.add_nic(self.apiclient, isolated_network.id)
|
||||||
|
virtual_machine.start(self.apiclient)
|
||||||
|
|
||||||
# 3) SSH into vm
|
# 3) SSH into vm
|
||||||
ssh_client = virtual_machine.get_ssh_client()
|
ssh_client = virtual_machine.get_ssh_client()
|
||||||
@ -131,17 +134,24 @@ class TestNestedVirtualization(cloudstackTestCase):
|
|||||||
self.fail("Failed to setup ssh connection to %s" % virtual_machine.public_ip)
|
self.fail("Failed to setup ssh connection to %s" % virtual_machine.public_ip)
|
||||||
|
|
||||||
# 4) Revert configurations, if needed
|
# 4) Revert configurations, if needed
|
||||||
if rollback_nv:
|
self.rollback_nested_configurations(rollback_nv, rollback_nv_per_vm)
|
||||||
config_update = Configurations.update(self.apiclient, "vmware.nested.virtualization", "false")
|
|
||||||
self.logger.debug("Reverted global setting vmware.nested.virtualization back to false")
|
|
||||||
if rollback_nv_per_vm:
|
|
||||||
config_update = Configurations.update(self.apiclient, "vmware.nested.virtualization", "false")
|
|
||||||
self.logger.debug("Reverted global setting vmware.nested.virtualization.perVM back to false")
|
|
||||||
|
|
||||||
#5) Check for CPU flags: vmx for Intel and svm for AMD indicates nested virtualization is enabled
|
#5) Check for CPU flags: vmx for Intel and svm for AMD indicates nested virtualization is enabled
|
||||||
self.assert_(result is not None, "Empty result for CPU flags")
|
self.assert_(result is not None, "Empty result for CPU flags")
|
||||||
res = str(result)
|
res = str(result)
|
||||||
self.assertTrue('vmx' in res or 'svm' in res)
|
self.assertTrue('vmx' in res or 'svm' in res or 'lm' in res)
|
||||||
|
except Exception as e:
|
||||||
|
self.debug('Error=%s' % e)
|
||||||
|
self.rollback_nested_configurations(rollback_nv, rollback_nv_per_vm)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
def rollback_nested_configurations(self, rollback_nv, rollback_nv_per_vm):
|
||||||
|
if rollback_nv:
|
||||||
|
config_update = Configurations.update(self.apiclient, "vmware.nested.virtualization", "false")
|
||||||
|
self.logger.debug("Reverted global setting vmware.nested.virtualization back to false")
|
||||||
|
if rollback_nv_per_vm:
|
||||||
|
config_update = Configurations.update(self.apiclient, "vmware.nested.virtualization.perVM", "false")
|
||||||
|
self.logger.debug("Reverted global setting vmware.nested.virtualization.perVM back to false")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
|
|||||||
@ -227,11 +227,15 @@ public class VirtualMachineMO extends BaseMO {
|
|||||||
s_logger.info("msg id: " + msg.getId());
|
s_logger.info("msg id: " + msg.getId());
|
||||||
s_logger.info("msg text: " + msg.getText());
|
s_logger.info("msg text: " + msg.getText());
|
||||||
}
|
}
|
||||||
|
String logMsg = "Found that VM has a pending question that we need to answer programmatically, question id: " + msg.getId();
|
||||||
if ("msg.uuid.altered".equalsIgnoreCase(msg.getId())) {
|
if ("msg.uuid.altered".equalsIgnoreCase(msg.getId())) {
|
||||||
s_logger.info("Found that VM has a pending question that we need to answer programmatically, question id: " + msg.getId()
|
s_logger.info(logMsg + ", we will automatically answer as 'moved it' to address out of band HA for the VM");
|
||||||
+ ", we will automatically answer as 'moved it' to address out of band HA for the VM");
|
|
||||||
vmMo.answerVM(question.getId(), "1");
|
vmMo.answerVM(question.getId(), "1");
|
||||||
break;
|
break;
|
||||||
|
} else if (msg.getId().equalsIgnoreCase("msg.cpuid.noVHVQuestion")) {
|
||||||
|
s_logger.info(logMsg + ", automatically answering 'yes'");
|
||||||
|
vmMo.answerVM(question.getId(), "0");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user