cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [1/2] git commit: updated refs/heads/master to 2478414
Date Mon, 14 Dec 2015 10:39:50 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 7c83e1b24 -> 2478414d4


CLOUDSTACK-9127 Missing PV-bootloader-args for "SUSE Linux Enterprise Server 10 SP2 and SP3"

Added Unit test for the new method


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9ae3c0a5
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9ae3c0a5
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9ae3c0a5

Branch: refs/heads/master
Commit: 9ae3c0a5a9f3438e9714ddb8307a6835231bf583
Parents: 312b9af
Author: SudharmaJain <sudharma.jain@citrix.com>
Authored: Wed Dec 9 11:53:51 2015 +0530
Committer: SudharmaJain <sudharma.jain@citrix.com>
Committed: Mon Dec 14 11:26:45 2015 +0530

----------------------------------------------------------------------
 .../xenserver/resource/CitrixHelper.java        | 11 +++++++
 .../xenserver/resource/CitrixResourceBase.java  |  1 +
 .../xenserver/resource/CitrixHelperTest.java    | 34 ++++++++++++++++++++
 3 files changed, 46 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ae3c0a5/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixHelper.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixHelper.java
b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixHelper.java
index 265573d..cf2bd76 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixHelper.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixHelper.java
@@ -236,4 +236,15 @@ public class CitrixHelper {
         }
         return prodVersion;
     }
+
+    public static String getPVbootloaderArgs(String guestOS) {
+        if (guestOS.startsWith("SUSE Linux Enterprise Server")) {
+            if (guestOS.contains("64-bit")) {
+                return "--kernel /boot/vmlinuz-xen --ramdisk /boot/initrd-xen";
+            } else if (guestOS.contains("32-bit")) {
+                return "--kernel /boot/vmlinuz-xenpae --ramdisk /boot/initrd-xenpae";
+            }
+        }
+        return "";
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ae3c0a5/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
----------------------------------------------------------------------
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 e1f7d3d..7c8bca7 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
@@ -1352,6 +1352,7 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
                 }
             } else if (vmSpec.getBootloader() == BootloaderType.PyGrub) {
                 vm.setPVBootloader(conn, "pygrub");
+                vm.setPVBootloaderArgs(conn,CitrixHelper.getPVbootloaderArgs(guestOsTypeName));
             } else {
                 vm.destroy(conn);
                 throw new CloudRuntimeException("Unable to handle boot loader type: " + vmSpec.getBootloader());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ae3c0a5/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/CitrixHelperTest.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/CitrixHelperTest.java
b/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/CitrixHelperTest.java
new file mode 100644
index 0000000..b656ec3
--- /dev/null
+++ b/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/CitrixHelperTest.java
@@ -0,0 +1,34 @@
+package com.cloud.hypervisor.xenserver.resource;
+
+import junit.framework.Assert;
+import org.junit.Test;
+
+
+/**
+ * Created by ajna123 on 12/11/2015.
+ */
+public class CitrixHelperTest {
+
+    @Test
+    public void testGetPVbootloaderArgs() throws Exception {
+
+        String os_name_Suse10Sp2_64 = "SUSE Linux Enterprise Server 10 SP2 (64-bit)";
+        String os_name_Suse10Sp2_32 = "SUSE Linux Enterprise Server 10 SP2 (32-bit)";
+        String os_name_Suse11Sp3_64 = "SUSE Linux Enterprise Server 11 SP3 (64-bit)";
+        String os_name_Suse11Sp3_32 = "SUSE Linux Enterprise Server 11 SP3 (32-bit)";
+
+        String os_name_Windows8_64 = "Windows 8 (64-bit)";
+        String os_name_Windows8_32 = "Windows 8 (32-bit)";
+
+        String pvBootLoaderArgs_32 = "--kernel /boot/vmlinuz-xenpae --ramdisk /boot/initrd-xenpae";
+        String pvBootLoaderArgs_64 = "--kernel /boot/vmlinuz-xen --ramdisk /boot/initrd-xen";
+
+        Assert.assertEquals(CitrixHelper.getPVbootloaderArgs(os_name_Suse10Sp2_32), pvBootLoaderArgs_32);
+        Assert.assertEquals(CitrixHelper.getPVbootloaderArgs(os_name_Suse10Sp2_64),pvBootLoaderArgs_64);
+        Assert.assertEquals(CitrixHelper.getPVbootloaderArgs(os_name_Suse11Sp3_32),pvBootLoaderArgs_32);
+        Assert.assertEquals(CitrixHelper.getPVbootloaderArgs(os_name_Suse11Sp3_64),pvBootLoaderArgs_64);
+
+        Assert.assertEquals(CitrixHelper.getPVbootloaderArgs(os_name_Windows8_32),"");
+        Assert.assertEquals(CitrixHelper.getPVbootloaderArgs(os_name_Windows8_64),"");
+    }
+}
\ No newline at end of file


Mime
View raw message