Bug 646895 (LibvirtBootOrder)

Summary: RFE: Explicit per-device ordering for bootable devices.
Product: Red Hat Enterprise Linux 6 Reporter: Glauber Costa <gcosta>
Component: libvirtAssignee: Jiri Denemark <jdenemar>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: berrange, dallan, dyuan, eblake, khong, mjenner, tburke, vbian, xen-maint, yimwang, yoyzhang
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.8.7-3.el6 Doc Type: Enhancement
Doc Text:
Device boot order could not be set more explicitly than Network, Disk, CD ROM, or Floppy. This meant that users could not select the exact boot device that they wished to use. A per-device <boot> element has been introduced, which can be used to specify the exact order of boot devices.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 13:23:22 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 643687, 643688    
Bug Blocks: 628823, 644849    

Description Glauber Costa 2010-10-26 15:16:33 UTC
Right now we can specify the boot order between network, disk, cdrom, etc,
but not between multiple instances of the same device type.

The current limitation is that qemu can't specify this.

We should be able to do it in upper levels as soon as qemu acquires this capability

Comment 1 Jiri Denemark 2010-12-21 15:55:55 UTC
The qemu support for this is now upstream:

commit 1ca4d09ae0bcc2fdd6aeef0fdc11f82394f7e757
Author: Gleb Natapov <gleb>
Date:   Wed Dec 8 13:35:05 2010 +0200

    Add bootindex parameter to net/block/fd device
    
    If bootindex is specified on command line a string that describes device
    in firmware readable way is added into sorted list. Later this list will
    be passed into firmware to control boot order.
    
    Signed-off-by: Gleb Natapov <gleb>
    Signed-off-by: Blue Swirl <blauwirbel>

The firmware support is not there yet so it's not usable now but we have the interface to use.

Comment 2 Gleb Natapov 2010-12-22 08:51:15 UTC
*** Bug 663275 has been marked as a duplicate of this bug. ***

Comment 3 Dave Allan 2011-01-05 19:44:55 UTC
(In reply to comment #1)
> The qemu support for this is now upstream:
> 
> commit 1ca4d09ae0bcc2fdd6aeef0fdc11f82394f7e757
> Author: Gleb Natapov <gleb>
> Date:   Wed Dec 8 13:35:05 2010 +0200
> 
>     Add bootindex parameter to net/block/fd device
> 
>     If bootindex is specified on command line a string that describes device
>     in firmware readable way is added into sorted list. Later this list will
>     be passed into firmware to control boot order.
> 
>     Signed-off-by: Gleb Natapov <gleb>
>     Signed-off-by: Blue Swirl <blauwirbel>
> 
> The firmware support is not there yet so it's not usable now but we have the
> interface to use.

Is the firmware support in qemu now?

Comment 4 Dor Laor 2011-01-06 11:21:36 UTC
(In reply to comment #3)

> Is the firmware support in qemu now?

yes

Comment 5 Jiri Denemark 2011-01-13 14:06:03 UTC
The patches were sent for upstream review: https://www.redhat.com/archives/libvir-list/2011-January/msg00540.html

Comment 6 Jiri Denemark 2011-01-17 16:39:21 UTC
Patches sent to rhvirt-patches.

Comment 9 zhanghaiyan 2011-01-18 06:12:42 UTC
This bug cannot be verified at this time because the latest qemu-kvm-0.12.1.2-2.129.el6.x86_64 in brew hasn't support this feature yet.


At the beginning I thought qemu-kvm has supported it and did the following test.
- libvirt-0.8.7-2.el6.x86_64
- rhel6-1.img is a bootable image file while haha.img is a fake null file.

1. Edit an xml specifying boot order as below
....
  <os>
    <type arch='x86_64' machine='rhel6.0.0'>hvm</type>
  </os>
....
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source file='/mnt/Share/yoyzhang/haha.img'/>
      <target dev='hdb' bus='ide'/>
      <boot order='1'/>
      <address type='drive' controller='0' bus='0' unit='1'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source file='/mnt/Share/yoyzhang/rhel6-1.img'/>
      <target dev='hda' bus='ide'/>
      <boot order='2'/>
      <address type='drive' controller='0' bus='0' unit='0'/>
    </disk>
2. Define and start the guest
# virsh start rhel6
Domain rhel6 started
The guest boot up successfully from the 2nd order hda device rhel6-1.img and can log in the guest
3. Check qemu command line
# ps axu|grep qemu
qemu     16065 10.1  4.3 1317348 346952 ?      Sl   00:59   0:18 /usr/libexec/qemu-kvm -S -M rhel6.0.0 -enable-kvm -m 1024 -smp 1,sockets=1,cores=1,threads=1 -name rhel6 -uuid a895bf3f-1354-68ac-5c49-c16af2c6a4d5 -nodefconfig -nodefaults -chardev socket,id=monitor,path=/var/lib/libvirt/qemu/rhel6.monitor,server,nowait -mon chardev=monitor,mode=control -rtc base=utc -drive file=/mnt/Share/yoyzhang/haha.img,if=none,id=drive-ide0-0-1,format=raw,cache=none -device ide-drive,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 -drive file=/mnt/Share/yoyzhang/rhel6-1.img,if=none,id=drive-ide0-0-0,format=raw,cache=none -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -netdev tap,fd=24,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:b1:94:d2,bus=pci.0,addr=0x3 -chardev pty,id=serial0 -device isa-serial,chardev=serial0 -usb -vnc 127.0.0.1:0 -k en-us -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
root     16333  0.0  0.0 103152   832 pts/0    S+   01:02   0:00 grep qemu

Then I realized qemu-kvm doesn't support at all, because cannot see "bootindex=n" in qemu command line.

I have the 2 concerns about this bug
1) It seems strange that qemu-kvm doesn't support this in RHEL while libvirt does. For me and user cannot use this feature supported by libvirt at all without building upsteam qemu-kvm ourselves. And IMHO customers won't like to build package themselves. :)
2) As qemu-kvm doesn't support this feature, especillay in order qemu-kvm version, I think libvirt should report an error 'config is not supported' and not pretend everything is fine. For this I will report a bug and attach bug ID soon.

Comment 10 zhanghaiyan 2011-01-18 06:21:10 UTC
bug 670399 is filed to track issue 2) in comment 9

Comment 11 Keqin Hong 2011-01-18 06:29:41 UTC
FYI:
Patches are still in POST, see Bug 643687

Comment 12 Jiri Denemark 2011-01-18 08:12:12 UTC
This feature requires patches for qemu-kvm and seabios, both of them are planned for 6.1 and the corresponding bugs are in POST already so you just need to wait a little while until the review process finishes and packages are built.

qemu-kvm side is tracked by bug 643687
seabios side is tracked by bug 643688

Comment 14 Eric Blake 2011-01-18 18:13:33 UTC
Moving back into POST - additional patches from upstream should also be backported:

http://post-office.corp.redhat.com/archives/rhvirt-patches/2011-January/msg00878.html
http://post-office.corp.redhat.com/archives/rhvirt-patches/2011-January/msg00872.html

Comment 16 Vivian Bian 2011-01-28 06:10:20 UTC
bug 643687 is on POST status, and isn't pushed into the latest qemu-kvm-0.12.1.2-2.132. So leave this bug status to ON_QA till the patch is pushed into related kvm build .

Comment 18 zhanghaiyan 2011-02-10 09:35:36 UTC
Verified PASS with libvirt-0.8.7-5.el6.x86_64
- 2.6.32-94.el6.x86_64
- qemu-img-0.12.1.2-2.144.el6.x86_64
- qemu-kvm-0.12.1.2-2.144.el6.x86_64
- seabios-0.6.1.2-3.el6.x86_64

1. Edit an xml specifying boot order as below
....
  <os>
    <type arch='x86_64' machine='rhel6.0.0'>hvm</type>
  </os>
....
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source file='/mnt/Share/yoyzhang/rhel6-1.img'/>
      <target dev='hda' bus='ide'/>
      <boot order='2'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source file='/mnt/Share/yoyzhang/haha.img'/>
      <target dev='hdb' bus='ide'/>
      <boot order='1'/>
    </disk>
2. Define and start the guest
# virsh start rhel6
Domain rhel6 started
The guest failed to boot up from order1 haha.img
3. Change order between 2 disk 
The guest could be boot up from rhel6-1.img

Comment 19 Jiri Denemark 2011-05-03 13:02:52 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause
    device boot order could only be set to network, disk, cdrom, or floppy

Consequence
    users cannot chose the exact boot device

Change
    per-device <boot> element was introduced in domain XML

Result
    the <boot> element can be used to specify the exact order of boot devices

Comment 22 Laura Bailey 2011-05-04 05:40:22 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,11 +1 @@
-Cause
+Device boot order could not be set more explicitly than Network, Disk, CD ROM, or Floppy. This meant that users could not select the exact boot device that they wished to use. A per-device <boot> element has been introduced, which can be used to specify the exact order of boot devices.-    device boot order could only be set to network, disk, cdrom, or floppy
-
-Consequence
-    users cannot chose the exact boot device
-
-Change
-    per-device <boot> element was introduced in domain XML
-
-Result
-    the <boot> element can be used to specify the exact order of boot devices

Comment 23 errata-xmlrpc 2011-05-19 13:23:22 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0596.html