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/03/27 10:18:42 UTC
[cloudstack] branch 4.11 updated: CLOUDSTACK-10232: SystemVMs and
VR to run as HVM on XenServer (#2465)
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 535e615 CLOUDSTACK-10232: SystemVMs and VR to run as HVM on XenServer (#2465)
535e615 is described below
commit 535e6153cce89d213c53b89dc331f3e5ebc39211
Author: Khosrow Moossavi <kh...@gmail.com>
AuthorDate: Tue Mar 27 06:18:37 2018 -0400
CLOUDSTACK-10232: SystemVMs and VR to run as HVM on XenServer (#2465)
Publishing boot args both to grub and xenstore-data and let
cloud-early-config decides if the VM is in PV or HVM mode
to read from correct source.
---
.../xenserver/resource/CitrixResourceBase.java | 31 +++++++++++++---------
.../debian/opt/cloud/bin/setup/cloud-early-config | 18 +++++++++++--
2 files changed, 34 insertions(+), 15 deletions(-)
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 4b7080a..a233064 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 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
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 abstract class CitrixResourceBase implements ServerResource, HypervisorRe
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 abstract class CitrixResourceBase implements ServerResource, HypervisorRe
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 abstract class CitrixResourceBase implements ServerResource, HypervisorRe
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 abstract class CitrixResourceBase implements ServerResource, HypervisorRe
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 cec2d3c..a9ad094 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)
--
To stop receiving notification emails like this one, please contact
rohit@apache.org.