cloudstack-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CLOUDSTACK-10232) SystemVMs and VR to run as HVM on XenServer
Date Tue, 27 Mar 2018 10:19:00 GMT

    [ https://issues.apache.org/jira/browse/CLOUDSTACK-10232?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16415380#comment-16415380
] 

ASF GitHub Bot commented on CLOUDSTACK-10232:
---------------------------------------------

rhtyd closed pull request #2465: CLOUDSTACK-10232: SystemVMs and VR to run as HVM on XenServer
URL: https://github.com/apache/cloudstack/pull/2465
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
index 4b7080aa5ab..a233064332b 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
@@ -283,6 +283,11 @@ private static boolean isAlienVm(final VM vm, final Connection conn)
throws XenA
 
     protected StorageSubsystemCommandHandler storageHandler;
 
+    private static final String XENSTORE_DATA_IP = "vm-data/ip";
+    private static final String XENSTORE_DATA_GATEWAY = "vm-data/gateway";
+    private static final String XENSTORE_DATA_NETMASK = "vm-data/netmask";
+    private static final String XENSTORE_DATA_CS_INIT = "vm-data/cloudstack/init";
+
     public CitrixResourceBase() {
     }
 
@@ -1286,11 +1291,8 @@ public VM createVmFromTemplate(final Connection conn, final VirtualMachineTO
vmS
             if(guestOsDetails.containsKey("xenserver.dynamicMax")){
                 recommendedMemoryMax = Long.valueOf(guestOsDetails.get("xenserver.dynamicMax")).longValue();
             }
-
         }
 
-
-
         if (isDmcEnabled(conn, host) && vmSpec.isEnableDynamicallyScaleVm()) {
             // scaling is allowed
             vmr.memoryStaticMin = getStaticMin(vmSpec.getOs(), vmSpec.getBootloader() ==
BootloaderType.CD, vmSpec.getMinRam(), vmSpec.getMaxRam(),recommendedMemoryMin);
@@ -1312,7 +1314,6 @@ public VM createVmFromTemplate(final Connection conn, final VirtualMachineTO
vmS
             vmr.memoryStaticMin = vmSpec.getMinRam();
             vmr.memoryStaticMax = vmSpec.getMaxRam();
             vmr.memoryDynamicMin = vmSpec.getMinRam();
-            ;
             vmr.memoryDynamicMax = vmSpec.getMaxRam();
 
             vmr.VCPUsMax = (long) vmSpec.getCpus();
@@ -1326,17 +1327,15 @@ public VM createVmFromTemplate(final Connection conn, final VirtualMachineTO
vmS
             NicTO mgmtNic = vmSpec.getNics()[0];
             if(mgmtNic != null ) {
                 Map<String, String> xenstoreData = new HashMap<String, String>(3);
-                xenstoreData.put("vm-data/ip", mgmtNic.getIp().toString().trim());
-                xenstoreData.put("vm-data/gateway", mgmtNic.getGateway().toString().trim());
-                xenstoreData.put("vm-data/netmask", mgmtNic.getNetmask().toString().trim());
+                xenstoreData.put(XENSTORE_DATA_IP, mgmtNic.getIp().toString().trim());
+                xenstoreData.put(XENSTORE_DATA_GATEWAY, mgmtNic.getGateway().toString().trim());
+                xenstoreData.put(XENSTORE_DATA_NETMASK, mgmtNic.getNetmask().toString().trim());
                 vmr.xenstoreData = xenstoreData;
             }
         }
 
         final VM vm = VM.create(conn, vmr);
-        if (s_logger.isDebugEnabled()) {
-            s_logger.debug("Created VM " + vm.getUuid(conn) + " for " + vmSpec.getName());
-        }
+        s_logger.debug("Created VM " + vm.getUuid(conn) + " for " + vmSpec.getName());
 
         final Map<String, String> vcpuParams = new HashMap<String, String>();
 
@@ -1368,12 +1367,18 @@ public VM createVmFromTemplate(final Connection conn, final VirtualMachineTO
vmS
 
         final String bootArgs = vmSpec.getBootArgs();
         if (bootArgs != null && bootArgs.length() > 0) {
+            // send boot args for PV instances
             String pvargs = vm.getPVArgs(conn);
             pvargs = pvargs + vmSpec.getBootArgs().replaceAll(" ", "%");
-            if (s_logger.isDebugEnabled()) {
-                s_logger.debug("PV args are " + pvargs);
-            }
             vm.setPVArgs(conn, pvargs);
+            s_logger.debug("PV args are " + pvargs);
+
+            // send boot args into xenstore-data for HVM instances
+            Map<String, String> xenstoreData = new HashMap<>();
+
+            xenstoreData.put(XENSTORE_DATA_CS_INIT, bootArgs);
+            vm.setXenstoreData(conn, xenstoreData);
+            s_logger.debug("HVM args are " + bootArgs);
         }
 
         if (!(guestOsTypeName.startsWith("Windows") || guestOsTypeName.startsWith("Citrix")
|| guestOsTypeName.startsWith("Other"))) {
diff --git a/systemvm/debian/opt/cloud/bin/setup/cloud-early-config b/systemvm/debian/opt/cloud/bin/setup/cloud-early-config
index cec2d3cd2b5..a9ad094c8cb 100755
--- a/systemvm/debian/opt/cloud/bin/setup/cloud-early-config
+++ b/systemvm/debian/opt/cloud/bin/setup/cloud-early-config
@@ -42,7 +42,14 @@ hypervisor() {
   grep -q QEMU /var/log/messages && echo "kvm" && return 0
 
   [ -d /proc/xen ] && mount -t xenfs none /proc/xen
-  [ -d /proc/xen ] && echo "xen-domU" && return 0
+  if [ -d /proc/xen ]; then
+    $(dmesg | grep -q "Xen HVM")
+    if [ $? -eq 0 ]; then  # 1=PV,0=HVM
+      echo "xen-hvm" && return 0
+    else
+      echo "xen-pv" && return 0
+    fi
+  fi
 
   vmware-checkvm &> /dev/null && echo "vmware" && return 0
 
@@ -64,10 +71,17 @@ config_guest() {
 
 get_boot_params() {
   case $HYPERVISOR in
-     xen-domU|xen-hvm)
+     xen-pv)
           cat /proc/cmdline > $CMDLINE
           sed -i "s/%/ /g" $CMDLINE
           ;;
+     xen-hvm)
+          if [ ! -f /usr/sbin/xenstore-read ]; then
+            log_it "ERROR: xentools not installed, cannot found xenstore-read" &&
exit 5
+          fi
+          /usr/sbin/xenstore-read vm-data/cloudstack/init > /var/cache/cloud/cmdline
+          sed -i "s/%/ /g" /var/cache/cloud/cmdline
+          ;;
      kvm)
           VPORT=$(find /dev/virtio-ports -type l -name '*.vport' 2>/dev/null|head -1)
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> SystemVMs and VR to run as HVM on XenServer
> -------------------------------------------
>
>                 Key: CLOUDSTACK-10232
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10232
>             Project: CloudStack
>          Issue Type: New Feature
>      Security Level: Public(Anyone can view this level - this is the default.) 
>          Components: SystemVM, Virtual Router, XenServer
>    Affects Versions: 4.10.0.0, 4.9.3.0
>            Reporter: Pierre-Luc Dion
>            Priority: Major
>
> Following the recent Meltdown-Spectre security risk,one of the mitigation,as of Jan 2018,
for XenServer Hypervisor is to run Virtual-Machine in HVM mode.
> Currently SystemVMs and Virtual-Routers run as PV on XenServer and the eth0 is configured
using {{/etc/init.d/cloud-early-config}} using grub params from {{/proc/cmdline}}. When VM
run as HVM, it is not possible to push initial boot instruction via pygrub.
> Quick tests has been done using xenstore and it look like it would be possible to send
same initial boot instruction has pygrub but using xenstore for HVM instances.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message