Bug 1308535

Summary: RFE: v2v: Copy bios.hddOrder to target
Product: Red Hat Enterprise Linux 9 Reporter: Richard W.M. Jones <rjones>
Component: virt-v2vAssignee: Virtualization Maintenance <virt-maint>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: bugs, juzhou, lersek, mavital, michal.skrivanek, mxie, mzhan, nsimsolo, ptoscano, rjones, sbonazzo, smelamud, snagar, tzheng, xiaodwan
Target Milestone: betaKeywords: FutureFeature, Reopened, Triaged
Target Release: ---Flags: knoel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: V2V
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1297202 Environment:
Last Closed: 2022-01-19 16:36:00 UTC Type: Feature Request
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Virt RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1794317    
Bug Blocks: 1758964    

Description Richard W.M. Jones 2016-02-15 13:16:26 UTC
+++ This bug was initially created as a clone of Bug #1297202 +++

Description of problem:
- When importing VM with many disks, the target VM may not run properly because bootable disk is not set on the correct disk or any other disks.
- When importing VM with 1 disk, the target VM is running properly although bootable disk does not set by import process.

Version-Release number of selected component (if applicable):
rhevm-3.6.2-0.1.el6
libvirt-client-1.2.17-13.el7_2.2.x86_64
qemu-kvm-rhev-2.3.0-31.el7_2.4.x86_64
vdsm-4.17.15-0.el7ev
sanlock-3.2.4-1.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Using import dialog, start import of VM with many disks (in my case, rhel7_21_disks).
2. Wait till import progress is completed.
3. Run VM.

Actual results:
VM is running but "no bootable device" message displayed when opening console.
Observing webadmin shows that none of the disks set as "bootable" disk.
Observing vdsm.log shows that bootorder definition is missing for the target disk.

Expected results:
Bootable disk should be defined by import process.

Comment 2 Richard W.M. Jones 2016-02-15 14:39:59 UTC
My analysis of the bug
======================

The current situation is that virt-v2v sets the ovf:boot flag to
"True" on the first disk, and "False" on subsequent disks.  This is a
direct copy of what old virt-v2v did.  This behaviour is not very
useful.

Reference: search for "boot" in
https://github.com/libguestfs/libguestfs/blob/master/v2v/OVF.ml

The reporter stated that this bug doesn't reproduce with < 9 disks.
I created a RHEL 7.1 guest in VMware with 21 vmw_pvscsi disks.

The boot settings in the vSphere UI are:

 - BIOS or EFI
 - Power On Boot Delay
 - Force BIOS Setup
 - Failed Boot Recovery

These are the same in the vCenter UI.  As far as I can tell, there is
no per-disk bootable option.

I also dumped out the libvirt XML from the source, and no boot
settings are added to libvirt.

I also looked at the VMware .vmx and .vmxf files from the VMware
source, and again there are no boot options.

(I will attached all these files to the current bug in case anyone
else wants to take a look).

Anyway, it is my contention that VMware has no boot settings that we
can copy over.

Comment 7 Richard W.M. Jones 2016-02-15 15:24:37 UTC
Reading some public documentation about this, there are two ways
to change the boot order of VMware guests.

(1) In the VMware BIOS.  Hit [F2] on the console during the guest
boot, and you can select the boot order in there:

https://pubs.vmware.com/vsphere-4-esx-vcenter/index.jsp?topic=/com.vmware.vsphere.config_iscsi.doc_41/esx_san_config/booting/t_change_boot_sequence_bios.html

(2) However the modern way to do this is to add some entries
to the .vmx file.  Settings include bios.bootOrder and bios.hddOrder.
Neither is available through the API, you have to edit the .vmx
file directly.  See:

https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2011654

The current libvirt driver does not expose the bios.bootOrder nor
bios.hddOrder settings.

If it did expose these, then it might be possible for virt-v2v to
translate these into the correct OVF, assuming we knew what the
correct OVF was meant to be.

-----

Here are some other things virt-v2v could do:

(a) Not put the ovf:boot option in the OVF at all.  This punts the
issue entirely over to oVirt to sort out.

(b) Do some kind of guest inspection to try to determine the boot
device.  (This sounds like it's going to be difficult to do).

-----

To take this further I'm going to need:

(i) *.vmx file from the source guest which failed to boot.

(ii) Some guidance about what you'd like to happen.

(iii) Exact description of how to control the boot order through OVF.

Comment 10 Richard W.M. Jones 2016-02-17 14:30:40 UTC
Updating Summary etc to make it clearer this is now a wishlist
item for virt-v2v.

Comment 11 Shmuel Melamud 2016-02-17 14:46:46 UTC
In any case, virt-v2v must set correct BootOrder in the OVF it generates (just ovf:boot is not enough, it just marks a disk as bootable, but doesn't set the boot order). Currently, this was fixed by patching on oVirt level (https://gerrit.ovirt.org/#/c/53037/), but this is not a correct solution.

Comment 12 Richard W.M. Jones 2016-02-17 14:51:54 UTC
(In reply to Shmuel Melamud from comment #11)
> In any case, virt-v2v must set correct BootOrder in the OVF it generates
> (just ovf:boot is not enough, it just marks a disk as bootable, but doesn't
> set the boot order). Currently, this was fixed by patching on oVirt level
> (https://gerrit.ovirt.org/#/c/53037/), but this is not a correct solution.

This is news to me.  What should the <BootOrder> element look like?

Comment 13 Shmuel Melamud 2016-02-17 14:59:37 UTC
Here's an example:

<Item>
            <rasd:Caption>VM100_Disk1</rasd:Caption>
            <rasd:InstanceId>cb39ad76-c80f-4b59-a2b9-ff2da59e9b73</rasd:InstanceId>
            <rasd:ResourceType>17</rasd:ResourceType>
            <rasd:HostResource>2c5fc317-5dd1-46ac-89cc-0208bb354196/cb39ad76-c80f-4b59-a2b9-ff2da59e9b73</rasd:HostResource>
            <rasd:Parent>00000000-0000-0000-0000-000000000000</rasd:Parent>
            <rasd:Template>00000000-0000-0000-0000-000000000000</rasd:Template>
            <rasd:ApplicationList />
            <rasd:StorageId>7990f391-063a-4258-8117-231e2ec821c2</rasd:StorageId>
            <rasd:StoragePoolId>e5838493-2ce1-44f0-8c02-77726cf2d96c</rasd:StoragePoolId>
            <rasd:CreationDate>2016/02/01 14:06:05</rasd:CreationDate>
            <rasd:LastModified>1970/01/01 00:00:00</rasd:LastModified>
            <rasd:last_modified_date>2016/02/01 14:06:36</rasd:last_modified_date>
            <Type>disk</Type>
            <Device>disk</Device>
            <rasd:Address />
            <BootOrder>1</BootOrder>
            <IsPlugged>true</IsPlugged>
            <IsReadOnly>false</IsReadOnly>
            <Alias />
         </Item>

Comment 14 Richard W.M. Jones 2016-06-22 14:47:42 UTC
The following commit sets the <BootOrder> element to 1 for the
first disk, 2 for the second disk and so on:

https://github.com/libguestfs/libguestfs/commit/94e1504146bfb2d0dd9661865d0a423b6be07eb7

This doesn't solve the problem of how to copy the correct boot
order from the source hypervisor, which isn't generally solvable
without changes to libvirt (see comment 7).

Comment 15 Richard W.M. Jones 2017-02-16 14:23:41 UTC
Still a wishlist item, and still requires changes to the libvirt
ESX driver to expose the bios.bootOrder and bios.hddOrder entries
from the source .vmx file

Comment 18 RHEL Program Management 2020-12-15 07:40:06 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.

Comment 21 RHEL Program Management 2021-07-31 07:27:14 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.

Comment 22 Richard W.M. Jones 2021-07-31 07:43:34 UTC
My apologies, this bug was closed by a broken process that we
do not have any control over.  Reopening.

Comment 25 Richard W.M. Jones 2022-01-19 16:36:00 UTC
Let's close this as it's virtually impossible to fix properly anyway.