mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 11:52:28 +01:00
CLOUDSTACK-9127 Missing PV-bootloader-args for "SUSE Linux Enterprise Server 10 SP2 and SP3"
Added Unit test for the new method
This commit is contained in:
parent
312b9aff94
commit
9ae3c0a5a9
@ -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 "";
|
||||
}
|
||||
}
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -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),"");
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user