You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2018/05/08 10:26:55 UTC

[cloudstack] branch 4.11 updated: hypervisor: allow Ubuntu 18.04 to be added as KVM host (#2626)

This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch 4.11
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.11 by this push:
     new bd09595  hypervisor: allow Ubuntu 18.04 to be added as KVM host (#2626)
bd09595 is described below

commit bd0959517b5bdee3aaf42890faba586459528562
Author: Rohit Yadav <ro...@apache.org>
AuthorDate: Tue May 8 15:56:49 2018 +0530

    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 <ro...@shapeblue.com>
---
 debian/control                                                    | 2 +-
 .../com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java | 2 +-
 .../kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java   | 8 ++++++--
 .../kvm/resource/wrapper/LibvirtStopCommandWrapper.java           | 2 +-
 ui/scripts/system.js                                              | 4 ++++
 5 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/debian/control b/debian/control
index 42d3e1a..b444cfa 100644
--- a/debian/control
+++ b/debian/control
@@ -22,7 +22,7 @@ Description: CloudStack server library
 
 Package: cloudstack-agent
 Architecture: all
-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
+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
 Recommends: init-system-helpers
 Conflicts: cloud-agent, cloud-agent-libs, cloud-agent-deps, cloud-agent-scripts
 Description: CloudStack agent
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java
index 5f2af5c..2eeff88 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java
@@ -121,7 +121,7 @@ public class LibvirtDomainXMLParser {
                         def.defBlockBasedDisk(diskDev, diskLabel,
                             DiskDef.DiskBus.valueOf(bus.toUpperCase()));
                     }
-                    if (diskCacheMode != null) {
+                    if (StringUtils.isNotBlank(diskCacheMode)) {
                         def.setCacheMode(DiskDef.DiskCacheMode.valueOf(diskCacheMode.toUpperCase()));
                     }
                 }
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
index 7c12c07..08ece9a 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
@@ -819,8 +819,12 @@ public class LibvirtVMDef {
             diskBuilder.append(" type='" + _diskType + "'");
             diskBuilder.append(">\n");
             if(qemuDriver) {
-                diskBuilder.append("<driver name='qemu'" + " type='" + _diskFmtType
-                        + "' cache='" + _diskCacheMode + "' ");
+                diskBuilder.append("<driver name='qemu'" + " type='" + _diskFmtType + "' ");
+
+                if (_deviceType != DeviceType.CDROM) {
+                    diskBuilder.append("cache='" + _diskCacheMode + "' ");
+                }
+
                 if(_discard != null && _discard != DiscardType.IGNORE) {
                     diskBuilder.append("discard='" + _discard.toString() + "' ");
                 }
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtStopCommandWrapper.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtStopCommandWrapper.java
index bb837b5..7a0375f 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtStopCommandWrapper.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtStopCommandWrapper.java
@@ -71,7 +71,7 @@ public final class LibvirtStopCommandWrapper extends CommandWrapper<StopCommand,
                 //move the command line file to backup.
                 s_logger.debug("backing up the cmdline");
                 try{
-                    Pair<Boolean, String> ret = SshHelper.sshExecute(command.getControlIp(), 3922, "root", pemFile, null,"mv -f "+CMDLINE_PATH+" "+CMDLINE_BACKUP_PATH);
+                    Pair<Boolean, String> ret = SshHelper.sshExecute(command.getControlIp(), 3922, "root", pemFile, null,"cp -f "+CMDLINE_PATH+" "+CMDLINE_BACKUP_PATH);
                     if(!ret.first()){
                         s_logger.debug("Failed to backup cmdline file due to "+ret.second());
                     }
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index d5b9976..ef944d9 100755
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -17484,6 +17484,10 @@
                                                 item.powerstate = item.outofbandmanagement.powerstate;
                                             }
 
+                                            if (!item.hypervisorversion && item.details && item.details["Host.OS"]) {
+                                                item.hypervisorversion =  item.details["Host.OS"] + " " +  item.details["Host.OS.Version"];
+                                            }
+
                                             if (item && item.hostha) {
                                                 item.hastate = item.hostha.hastate;
                                                 item.haprovider = item.hostha.haprovider;

-- 
To stop receiving notification emails like this one, please contact
rohit@apache.org.