Skip to content

Commit 30deec8

Browse files
kvm: consider Debian same as Ubuntu (#10917)
Co-authored-by: Suresh Kumar Anaparti <[email protected]>
1 parent 0d65c8c commit 30deec8

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3368,7 +3368,7 @@ private boolean isIoUringEnabled() {
33683368
if (!meetRequirements) {
33693369
return false;
33703370
}
3371-
return isUbuntuHost() || isIoUringSupportedByQemu();
3371+
return isUbuntuOrDebianHost() || isIoUringSupportedByQemu();
33723372
}
33733373

33743374
/**
@@ -3381,13 +3381,14 @@ public boolean isQemuDiscardBugFree(DiskDef.DiskBus diskBus) {
33813381
return diskBus != DiskDef.DiskBus.IDE || getHypervisorQemuVersion() >= HYPERVISOR_QEMU_VERSION_IDE_DISCARD_FIXED;
33823382
}
33833383

3384-
public boolean isUbuntuHost() {
3384+
public boolean isUbuntuOrDebianHost() {
33853385
Map<String, String> versionString = getVersionStrings();
33863386
String hostKey = "Host.OS";
33873387
if (MapUtils.isEmpty(versionString) || !versionString.containsKey(hostKey) || versionString.get(hostKey) == null) {
33883388
return false;
33893389
}
3390-
return versionString.get(hostKey).equalsIgnoreCase("ubuntu");
3390+
return versionString.get(hostKey).equalsIgnoreCase("ubuntu")
3391+
|| versionString.get(hostKey).toLowerCase().startsWith("debian");
33913392
}
33923393

33933394
private KVMPhysicalDisk getPhysicalDiskFromNfsStore(String dataStoreUrl, DataTO data) {
@@ -5357,14 +5358,14 @@ public boolean isSecureMode(String bootMode) {
53575358

53585359
public boolean hostSupportsInstanceConversion() {
53595360
int exitValue = Script.runSimpleBashScriptForExitValue(INSTANCE_CONVERSION_SUPPORTED_CHECK_CMD);
5360-
if (isUbuntuHost() && exitValue == 0) {
5361+
if (isUbuntuOrDebianHost() && exitValue == 0) {
53615362
exitValue = Script.runSimpleBashScriptForExitValue(UBUNTU_NBDKIT_PKG_CHECK_CMD);
53625363
}
53635364
return exitValue == 0;
53645365
}
53655366

53665367
public boolean hostSupportsWindowsGuestConversion() {
5367-
if (isUbuntuHost()) {
5368+
if (isUbuntuOrDebianHost()) {
53685369
int exitValue = Script.runSimpleBashScriptForExitValue(UBUNTU_WINDOWS_GUEST_CONVERSION_SUPPORTED_CHECK_CMD);
53695370
return exitValue == 0;
53705371
}

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtCheckConvertInstanceCommandWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class LibvirtCheckConvertInstanceCommandWrapper extends CommandWrapper<Ch
3232
public Answer execute(CheckConvertInstanceCommand cmd, LibvirtComputingResource serverResource) {
3333
if (!serverResource.hostSupportsInstanceConversion()) {
3434
String msg = String.format("Cannot convert the instance from VMware as the virt-v2v binary is not found on host %s. " +
35-
"Please install virt-v2v%s on the host before attempting the instance conversion.", serverResource.getPrivateIp(), serverResource.isUbuntuHost()? ", nbdkit" : "");
35+
"Please install virt-v2v%s on the host before attempting the instance conversion.", serverResource.getPrivateIp(), serverResource.isUbuntuOrDebianHost()? ", nbdkit" : "");
3636
logger.info(msg);
3737
return new CheckConvertInstanceAnswer(cmd, false, msg);
3838
}

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtConvertInstanceCommandWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public Answer execute(ConvertInstanceCommand cmd, LibvirtComputingResource serve
6060

6161
if (cmd.getCheckConversionSupport() && !serverResource.hostSupportsInstanceConversion()) {
6262
String msg = String.format("Cannot convert the instance %s from VMware as the virt-v2v binary is not found. " +
63-
"Please install virt-v2v%s on the host before attempting the instance conversion.", sourceInstanceName, serverResource.isUbuntuHost()? ", nbdkit" : "");
63+
"Please install virt-v2v%s on the host before attempting the instance conversion.", sourceInstanceName, serverResource.isUbuntuOrDebianHost()? ", nbdkit" : "");
6464
logger.info(msg);
6565
return new Answer(cmd, false, msg);
6666
}

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtReadyCommandWrapper.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public final class LibvirtReadyCommandWrapper extends CommandWrapper<ReadyComman
4343
public Answer execute(final ReadyCommand command, final LibvirtComputingResource libvirtComputingResource) {
4444
Map<String, String> hostDetails = new HashMap<String, String>();
4545

46-
if (hostSupportsUefi(libvirtComputingResource.isUbuntuHost()) && libvirtComputingResource.isUefiPropertiesFileLoaded()) {
46+
if (hostSupportsUefi(libvirtComputingResource.isUbuntuOrDebianHost()) && libvirtComputingResource.isUefiPropertiesFileLoaded()) {
4747
hostDetails.put(Host.HOST_UEFI_ENABLE, Boolean.TRUE.toString());
4848
}
4949

@@ -58,10 +58,10 @@ public Answer execute(final ReadyCommand command, final LibvirtComputingResource
5858
return new ReadyAnswer(command, hostDetails);
5959
}
6060

61-
private boolean hostSupportsUefi(boolean isUbuntuHost) {
61+
private boolean hostSupportsUefi(boolean isUbuntuOrDebianHost) {
6262
int timeout = AgentPropertiesFileHandler.getPropertyValue(AgentProperties.AGENT_SCRIPT_TIMEOUT) * 1000; // Get property value & convert to milliseconds
6363
int result;
64-
if (isUbuntuHost) {
64+
if (isUbuntuOrDebianHost) {
6565
logger.debug("Running command : [dpkg -l ovmf] with timeout : " + timeout + " ms");
6666
result = Script.executeCommandForExitValue(timeout, Script.getExecutableAbsolutePath("dpkg"), "-l", "ovmf");
6767
} else {

0 commit comments

Comments
 (0)