Skip to content

Commit bd09595

Browse files
authored
hypervisor: allow Ubuntu 18.04 to be added as KVM host (#2626)
This adds and allows Ubuntu 18.04 to be used as KVM host. In addition, on the UI when hypervisor version key is missing, this adds and display the host os and version detail which is useful to show the KVM host os and version. When cache mode 'none' is used for empty cdrom drives, systemvms and guest VMs fail to start on newer libvirtd such as Ubuntu bionic. The fix is ensure that cachemode is not declared when drives are empty upon starting of the VM. Similar issue logged at redhat here: https://bugzilla.redhat.com/show_bug.cgi?id=1342999 The workaround is to ensure that we don't configure cachemode for cdrom devices at all. This also fixes live VM migration issue. Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent a53dcd6 commit bd09595

5 files changed

Lines changed: 13 additions & 5 deletions

File tree

debian/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Description: CloudStack server library
2222

2323
Package: cloudstack-agent
2424
Architecture: all
25-
Depends: ${python:Depends}, openjdk-8-jre-headless | java8-runtime-headless | java8-runtime, cloudstack-common (= ${source:Version}), lsb-base (>= 4.0), libcommons-daemon-java, openssh-client, qemu-kvm (>= 1.0), libvirt-bin (>= 1.2.2), uuid-runtime, iproute, ebtables, vlan, jsvc, ipset, python-libvirt, ethtool, iptables, lsb-release, init-system-helpers (>= 1.14~), aria2
25+
Depends: ${python:Depends}, openjdk-8-jre-headless | java8-runtime-headless | java8-runtime, cloudstack-common (= ${source:Version}), lsb-base (>= 4.0), libcommons-daemon-java, openssh-client, qemu-kvm (>= 1.0), libvirt-bin (>= 1.2.2), uuid-runtime, iproute2, ebtables, vlan, jsvc, ipset, python-libvirt, ethtool, iptables, lsb-release, init-system-helpers (>= 1.14~), aria2
2626
Recommends: init-system-helpers
2727
Conflicts: cloud-agent, cloud-agent-libs, cloud-agent-deps, cloud-agent-scripts
2828
Description: CloudStack agent

plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public boolean parseDomainXML(String domXML) {
121121
def.defBlockBasedDisk(diskDev, diskLabel,
122122
DiskDef.DiskBus.valueOf(bus.toUpperCase()));
123123
}
124-
if (diskCacheMode != null) {
124+
if (StringUtils.isNotBlank(diskCacheMode)) {
125125
def.setCacheMode(DiskDef.DiskCacheMode.valueOf(diskCacheMode.toUpperCase()));
126126
}
127127
}

plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -819,8 +819,12 @@ public String toString() {
819819
diskBuilder.append(" type='" + _diskType + "'");
820820
diskBuilder.append(">\n");
821821
if(qemuDriver) {
822-
diskBuilder.append("<driver name='qemu'" + " type='" + _diskFmtType
823-
+ "' cache='" + _diskCacheMode + "' ");
822+
diskBuilder.append("<driver name='qemu'" + " type='" + _diskFmtType + "' ");
823+
824+
if (_deviceType != DeviceType.CDROM) {
825+
diskBuilder.append("cache='" + _diskCacheMode + "' ");
826+
}
827+
824828
if(_discard != null && _discard != DiscardType.IGNORE) {
825829
diskBuilder.append("discard='" + _discard.toString() + "' ");
826830
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public Answer execute(final StopCommand command, final LibvirtComputingResource
7171
//move the command line file to backup.
7272
s_logger.debug("backing up the cmdline");
7373
try{
74-
Pair<Boolean, String> ret = SshHelper.sshExecute(command.getControlIp(), 3922, "root", pemFile, null,"mv -f "+CMDLINE_PATH+" "+CMDLINE_BACKUP_PATH);
74+
Pair<Boolean, String> ret = SshHelper.sshExecute(command.getControlIp(), 3922, "root", pemFile, null,"cp -f "+CMDLINE_PATH+" "+CMDLINE_BACKUP_PATH);
7575
if(!ret.first()){
7676
s_logger.debug("Failed to backup cmdline file due to "+ret.second());
7777
}

ui/scripts/system.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17484,6 +17484,10 @@
1748417484
item.powerstate = item.outofbandmanagement.powerstate;
1748517485
}
1748617486

17487+
if (!item.hypervisorversion && item.details && item.details["Host.OS"]) {
17488+
item.hypervisorversion = item.details["Host.OS"] + " " + item.details["Host.OS.Version"];
17489+
}
17490+
1748717491
if (item && item.hostha) {
1748817492
item.hastate = item.hostha.hastate;
1748917493
item.haprovider = item.hostha.haprovider;

0 commit comments

Comments
 (0)