Skip to content

Commit 0633797

Browse files
committed
kvm: consider Debian same as Ubuntu
1 parent 6e19c07 commit 0633797

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
@@ -3302,7 +3302,7 @@ private boolean isIoUringEnabled() {
33023302
if (!meetRequirements) {
33033303
return false;
33043304
}
3305-
return isUbuntuHost() || isIoUringSupportedByQemu();
3305+
return isUbuntuOrDebianHost() || isIoUringSupportedByQemu();
33063306
}
33073307

33083308
/**
@@ -3315,13 +3315,14 @@ public boolean isQemuDiscardBugFree(DiskDef.DiskBus diskBus) {
33153315
return diskBus != DiskDef.DiskBus.IDE || getHypervisorQemuVersion() >= HYPERVISOR_QEMU_VERSION_IDE_DISCARD_FIXED;
33163316
}
33173317

3318-
public boolean isUbuntuHost() {
3318+
public boolean isUbuntuOrDebianHost() {
33193319
Map<String, String> versionString = getVersionStrings();
33203320
String hostKey = "Host.OS";
33213321
if (MapUtils.isEmpty(versionString) || !versionString.containsKey(hostKey) || versionString.get(hostKey) == null) {
33223322
return false;
33233323
}
3324-
return versionString.get(hostKey).equalsIgnoreCase("ubuntu");
3324+
return versionString.get(hostKey).equalsIgnoreCase("ubuntu")
3325+
|| versionString.get(hostKey).startsWith("Debian");
33253326
}
33263327

33273328
private KVMPhysicalDisk getPhysicalDiskFromNfsStore(String dataStoreUrl, DataTO data) {
@@ -5204,14 +5205,14 @@ public boolean isSecureMode(String bootMode) {
52045205

52055206
public boolean hostSupportsInstanceConversion() {
52065207
int exitValue = Script.runSimpleBashScriptForExitValue(INSTANCE_CONVERSION_SUPPORTED_CHECK_CMD);
5207-
if (isUbuntuHost() && exitValue == 0) {
5208+
if (isUbuntuOrDebianHost() && exitValue == 0) {
52085209
exitValue = Script.runSimpleBashScriptForExitValue(UBUNTU_NBDKIT_PKG_CHECK_CMD);
52095210
}
52105211
return exitValue == 0;
52115212
}
52125213

52135214
public boolean hostSupportsWindowsGuestConversion() {
5214-
if (isUbuntuHost()) {
5215+
if (isUbuntuOrDebianHost()) {
52155216
int exitValue = Script.runSimpleBashScriptForExitValue(UBUNTU_WINDOWS_GUEST_CONVERSION_SUPPORTED_CHECK_CMD);
52165217
return exitValue == 0;
52175218
}

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
@@ -36,7 +36,7 @@ public class LibvirtCheckConvertInstanceCommandWrapper extends CommandWrapper<Ch
3636
public Answer execute(CheckConvertInstanceCommand cmd, LibvirtComputingResource serverResource) {
3737
if (!serverResource.hostSupportsInstanceConversion()) {
3838
String msg = String.format("Cannot convert the instance from VMware as the virt-v2v binary is not found on host %s. " +
39-
"Please install virt-v2v%s on the host before attempting the instance conversion.", serverResource.getPrivateIp(), serverResource.isUbuntuHost()? ", nbdkit" : "");
39+
"Please install virt-v2v%s on the host before attempting the instance conversion.", serverResource.getPrivateIp(), serverResource.isUbuntuOrDebianHost()? ", nbdkit" : "");
4040
s_logger.info(msg);
4141
return new CheckConvertInstanceAnswer(cmd, false, msg);
4242
}

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

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

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
@@ -46,17 +46,17 @@ public final class LibvirtReadyCommandWrapper extends CommandWrapper<ReadyComman
4646
public Answer execute(final ReadyCommand command, final LibvirtComputingResource libvirtComputingResource) {
4747
Map<String, String> hostDetails = new HashMap<String, String>();
4848

49-
if (hostSupportsUefi(libvirtComputingResource.isUbuntuHost()) && libvirtComputingResource.isUefiPropertiesFileLoaded()) {
49+
if (hostSupportsUefi(libvirtComputingResource.isUbuntuOrDebianHost()) && libvirtComputingResource.isUefiPropertiesFileLoaded()) {
5050
hostDetails.put(Host.HOST_UEFI_ENABLE, Boolean.TRUE.toString());
5151
}
5252

5353
return new ReadyAnswer(command, hostDetails);
5454
}
5555

56-
private boolean hostSupportsUefi(boolean isUbuntuHost) {
56+
private boolean hostSupportsUefi(boolean isUbuntuOrDebianHost) {
5757
int timeout = AgentPropertiesFileHandler.getPropertyValue(AgentProperties.AGENT_SCRIPT_TIMEOUT) * 1000; // Get property value & convert to milliseconds
5858
int result;
59-
if (isUbuntuHost) {
59+
if (isUbuntuOrDebianHost) {
6060
s_logger.debug("Running command : dpkg -l ovmf");
6161
result = Script.executeCommandForExitValue(timeout, Script.getExecutableAbsolutePath("dpkg"), "-l", "ovmf");
6262
} else {

0 commit comments

Comments
 (0)