Skip to content

Commit 2478414

Browse files
committed
Merge pull request #1196 from SudharmaJain/cs-9127
CLOUDSTACK-9127 Missing PV-bootloader-args for "SUSE Linux Enterprise Server 10 SP2 and SP3" ISSUE -------- STOP-START of SUSE Linux VMs fail, as PV-bootloader-args are missing during the start command. DESCRIPTION ---------------------- Repro steps 1. Upload Suse ISO 2. Create a VM with this ISO, and install it. 3. Detach ISO from the VM. 4. Reboot the VM, :>>>> This will work fine, as the pv-bootloader-args are not missing during reboot. 5.Stop the VM from CCP(VM will get destroyed in Xencenter) 6. Start the same VM from CCP , it will try to start but will fail. Before Applying the fix -------------------------------- Before applying the starting the VM failed with following exception com.cloud.utils.exception.CloudRuntimeException: Unable to start VM(i-2-6-VM) on host(7cfd6388-b763-4c09-b3a3-9679db2904a3) due to Task failed! Task record: uuid: 21a6799f-9523-7c0e-bb86-1de750a38d74 nameLabel: Async.VM.start_on nameDescription: allowedOperations: [] currentOperations: {} created: Wed Dec 09 07:00:29 UTC 2015 finished: Wed Dec 09 07:00:31 UTC 2015 status: failure residentOn: com.xensource.xenapi.Host@513d238c progress: 1.0 type: <none/> result: errorInfo: [BOOTLOADER_FAILED, OpaqueRef:0b10b6ac-837d-29af-da9d-6ef1e11a064a, Unable to find partition containing kernel ] otherConfig: {} subtaskOf: com.xensource.xenapi.Task@aaf13f6f subtasks: [] ![image](https://cloud.githubusercontent.com/assets/12229259/11678758/bd0fc9aa-9e70-11e5-9687-c77bfecaa4dd.png) After Applying the fix -------------------------- After applying the fix I am able to start the vm. ![image](https://cloud.githubusercontent.com/assets/12229259/11678938/6d44f5b0-9e72-11e5-83b0-60a736408b4d.png) * pr/1196: CLOUDSTACK-9127 Missing PV-bootloader-args for "SUSE Linux Enterprise Server 10 SP2 and SP3" Signed-off-by: Daan Hoogland <daan@onecht.net>
2 parents 7c83e1b + 9ae3c0a commit 2478414

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixHelper.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,4 +236,15 @@ public static String getProductVersion(final Host.Record record) {
236236
}
237237
return prodVersion;
238238
}
239+
240+
public static String getPVbootloaderArgs(String guestOS) {
241+
if (guestOS.startsWith("SUSE Linux Enterprise Server")) {
242+
if (guestOS.contains("64-bit")) {
243+
return "--kernel /boot/vmlinuz-xen --ramdisk /boot/initrd-xen";
244+
} else if (guestOS.contains("32-bit")) {
245+
return "--kernel /boot/vmlinuz-xenpae --ramdisk /boot/initrd-xenpae";
246+
}
247+
}
248+
return "";
249+
}
239250
}

plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,6 +1352,7 @@ public VM createVmFromTemplate(final Connection conn, final VirtualMachineTO vmS
13521352
}
13531353
} else if (vmSpec.getBootloader() == BootloaderType.PyGrub) {
13541354
vm.setPVBootloader(conn, "pygrub");
1355+
vm.setPVBootloaderArgs(conn,CitrixHelper.getPVbootloaderArgs(guestOsTypeName));
13551356
} else {
13561357
vm.destroy(conn);
13571358
throw new CloudRuntimeException("Unable to handle boot loader type: " + vmSpec.getBootloader());
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.cloud.hypervisor.xenserver.resource;
2+
3+
import junit.framework.Assert;
4+
import org.junit.Test;
5+
6+
7+
/**
8+
* Created by ajna123 on 12/11/2015.
9+
*/
10+
public class CitrixHelperTest {
11+
12+
@Test
13+
public void testGetPVbootloaderArgs() throws Exception {
14+
15+
String os_name_Suse10Sp2_64 = "SUSE Linux Enterprise Server 10 SP2 (64-bit)";
16+
String os_name_Suse10Sp2_32 = "SUSE Linux Enterprise Server 10 SP2 (32-bit)";
17+
String os_name_Suse11Sp3_64 = "SUSE Linux Enterprise Server 11 SP3 (64-bit)";
18+
String os_name_Suse11Sp3_32 = "SUSE Linux Enterprise Server 11 SP3 (32-bit)";
19+
20+
String os_name_Windows8_64 = "Windows 8 (64-bit)";
21+
String os_name_Windows8_32 = "Windows 8 (32-bit)";
22+
23+
String pvBootLoaderArgs_32 = "--kernel /boot/vmlinuz-xenpae --ramdisk /boot/initrd-xenpae";
24+
String pvBootLoaderArgs_64 = "--kernel /boot/vmlinuz-xen --ramdisk /boot/initrd-xen";
25+
26+
Assert.assertEquals(CitrixHelper.getPVbootloaderArgs(os_name_Suse10Sp2_32), pvBootLoaderArgs_32);
27+
Assert.assertEquals(CitrixHelper.getPVbootloaderArgs(os_name_Suse10Sp2_64),pvBootLoaderArgs_64);
28+
Assert.assertEquals(CitrixHelper.getPVbootloaderArgs(os_name_Suse11Sp3_32),pvBootLoaderArgs_32);
29+
Assert.assertEquals(CitrixHelper.getPVbootloaderArgs(os_name_Suse11Sp3_64),pvBootLoaderArgs_64);
30+
31+
Assert.assertEquals(CitrixHelper.getPVbootloaderArgs(os_name_Windows8_32),"");
32+
Assert.assertEquals(CitrixHelper.getPVbootloaderArgs(os_name_Windows8_64),"");
33+
}
34+
}

0 commit comments

Comments
 (0)