Skip to content

Commit 92b6f50

Browse files
committed
kvm: consider Debian same as Ubuntu
1 parent f2a6a2f commit 92b6f50

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
@@ -3366,7 +3366,7 @@ private boolean isIoUringEnabled() {
33663366
if (!meetRequirements) {
33673367
return false;
33683368
}
3369-
return isUbuntuHost() || isIoUringSupportedByQemu();
3369+
return isUbuntuOrDebianHost() || isIoUringSupportedByQemu();
33703370
}
33713371

33723372
/**
@@ -3379,13 +3379,14 @@ public boolean isQemuDiscardBugFree(DiskDef.DiskBus diskBus) {
33793379
return diskBus != DiskDef.DiskBus.IDE || getHypervisorQemuVersion() >= HYPERVISOR_QEMU_VERSION_IDE_DISCARD_FIXED;
33803380
}
33813381

3382-
public boolean isUbuntuHost() {
3382+
public boolean isUbuntuOrDebianHost() {
33833383
Map<String, String> versionString = getVersionStrings();
33843384
String hostKey = "Host.OS";
33853385
if (MapUtils.isEmpty(versionString) || !versionString.containsKey(hostKey) || versionString.get(hostKey) == null) {
33863386
return false;
33873387
}
3388-
return versionString.get(hostKey).equalsIgnoreCase("ubuntu");
3388+
return versionString.get(hostKey).equalsIgnoreCase("ubuntu")
3389+
|| versionString.get(hostKey).startsWith("Debian");
33893390
}
33903391

33913392
private KVMPhysicalDisk getPhysicalDiskFromNfsStore(String dataStoreUrl, DataTO data) {
@@ -5348,14 +5349,14 @@ public boolean isSecureMode(String bootMode) {
53485349

53495350
public boolean hostSupportsInstanceConversion() {
53505351
int exitValue = Script.runSimpleBashScriptForExitValue(INSTANCE_CONVERSION_SUPPORTED_CHECK_CMD);
5351-
if (isUbuntuHost() && exitValue == 0) {
5352+
if (isUbuntuOrDebianHost() && exitValue == 0) {
53525353
exitValue = Script.runSimpleBashScriptForExitValue(UBUNTU_NBDKIT_PKG_CHECK_CMD);
53535354
}
53545355
return exitValue == 0;
53555356
}
53565357

53575358
public boolean hostSupportsWindowsGuestConversion() {
5358-
if (isUbuntuHost()) {
5359+
if (isUbuntuOrDebianHost()) {
53595360
int exitValue = Script.runSimpleBashScriptForExitValue(UBUNTU_WINDOWS_GUEST_CONVERSION_SUPPORTED_CHECK_CMD);
53605361
return exitValue == 0;
53615362
}

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
@@ -75,7 +75,7 @@ public Answer execute(ConvertInstanceCommand cmd, LibvirtComputingResource serve
7575

7676
if (cmd.getCheckConversionSupport() && !serverResource.hostSupportsInstanceConversion()) {
7777
String msg = String.format("Cannot convert the instance %s from VMware as the virt-v2v binary is not found. " +
78-
"Please install virt-v2v%s on the host before attempting the instance conversion.", sourceInstanceName, serverResource.isUbuntuHost()? ", nbdkit" : "");
78+
"Please install virt-v2v%s on the host before attempting the instance conversion.", sourceInstanceName, serverResource.isUbuntuOrDebianHost()? ", nbdkit" : "");
7979
logger.info(msg);
8080
return new ConvertInstanceAnswer(cmd, false, msg);
8181
}

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,17 +43,17 @@ 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

5050
return new ReadyAnswer(command, hostDetails);
5151
}
5252

53-
private boolean hostSupportsUefi(boolean isUbuntuHost) {
53+
private boolean hostSupportsUefi(boolean isUbuntuOrDebianHost) {
5454
int timeout = AgentPropertiesFileHandler.getPropertyValue(AgentProperties.AGENT_SCRIPT_TIMEOUT) * 1000; // Get property value & convert to milliseconds
5555
int result;
56-
if (isUbuntuHost) {
56+
if (isUbuntuOrDebianHost) {
5757
logger.debug("Running command : [dpkg -l ovmf] with timeout : " + timeout + " ms");
5858
result = Script.executeCommandForExitValue(timeout, Script.getExecutableAbsolutePath("dpkg"), "-l", "ovmf");
5959
} else {

0 commit comments

Comments
 (0)