VMware {code} Community
sivadevel
Enthusiast
Enthusiast

Multidisk in a VM and boot order

When creating a VM with multidisks(IDE or SCSI or both) by populating the vw1__VirtualMachineConfigSpec sturcutre by a backed up info of vw1__VirtualMachineConfigInfo - the VM gets created along with the disks too. One thing that does not get reflected properly is boot priority among the disk in VM BIOS. If I manually go and change the VM options in the bios for the appropriate disk, the VM boots properly. Bootoptions in my code is being assigned like this

vmConfigSpec.bootOptions            = vmInfo.bootOptions;

but still boot order from the source machine is not getting restored during VM creation. Can someone throw light on this behaviour?

./Siva

Reply
0 Kudos
4 Replies
stumpr
Virtuoso
Virtuoso

What does your bootOptions object look like?

Reuben Stump | http://www.virtuin.com | @ReubenStump
Reply
0 Kudos
sivadevel
Enthusiast
Enthusiast

Hi,

That is where the actual problem is. Following are the related classes and the code

vmConfigSpec.bootOptions            = vmInfo.bootOptions;

is the object of the type vw1__VirtualMachoneBootOptions.

class SOAP_CMAC vw1__VirtualMachineBootOptions : public vw1__DynamicData
{
public:
    LONG64 *bootDelay;    /* optional element of type xsd:long */
    bool *enterBIOSSetup;    /* optional element of type xsd:boolean */
    bool *bootRetryEnabled;    /* optional element of type xsd:boolean */
    LONG64 *bootRetryDelay;    /* optional element of type xsd:long */
    int __sizebootOrder;    /* sequence of elements <bootOrder> */
  vw1__VirtualMachineBootOptionsBootableDevice **bootOrder;    /* optional element of type vw1:VirtualMachineBootOptionsBootableDevice */
public:
    virtual int soap_type() const { return 2738; } /* = unique id SOAP_TYPE_vw1__VirtualMachineBootOptions */
    virtual void soap_default(struct soap*);
    virtual void soap_serialize(struct soap*) const;
    virtual int soap_put(struct soap*, const char*, const char*) const;
    virtual int soap_out(struct soap*, const char*, int, const char*) const;
    virtual void *soap_get(struct soap*, const char*, const char*);
    virtual void *soap_in(struct soap*, const char*, const char*);
             vw1__VirtualMachineBootOptions() { vw1__VirtualMachineBootOptions::soap_default(NULL); }
    virtual ~vw1__VirtualMachineBootOptions() { }
};

class SOAP_CMAC vw1__VirtualMachineBootOptionsBootableDevice : public vw1__DynamicData
{
public:
    virtual int soap_type() const { return 2732; } /* = unique id SOAP_TYPE_vw1__VirtualMachineBootOptionsBootableDevice */
    virtual void soap_default(struct soap*);
    virtual void soap_serialize(struct soap*) const;
    virtual int soap_put(struct soap*, const char*, const char*) const;
    virtual int soap_out(struct soap*, const char*, int, const char*) const;
    virtual void *soap_get(struct soap*, const char*, const char*);
    virtual void *soap_in(struct soap*, const char*, const char*);
             vw1__VirtualMachineBootOptionsBootableDevice() { vw1__VirtualMachineBootOptionsBootableDevice::soap_default(NULL); }
    virtual ~vw1__VirtualMachineBootOptionsBootableDevice() { }
};

The bootorder variable's class vw1__VirtualMachineBootOptionsBootableDevice consists only of Soap related functions. There is a __sizeBootOrder - which I think would be one per harddisk and in sequce based on their boot order. I don't understand how to identify which object is for which virtualdrive.

Thanks,

./Siva.

Reply
0 Kudos
togtog
Hot Shot
Hot Shot

Hi Siva,

There is a __sizeBootOrder - which I think would be one per harddisk and in sequce based on their boot order. I don't understand how to identify which object is for which virtualdrive.

I am not quite sure what you mean by that. Just looking at what you have provided and combining that with the docs BootOptions, BootableDevice I would interpret as follows:

To build the boot order, i.e. which device/disk is the first, second, third to boot from you have to associate the VirtualMachineBootOptionsBootableDiskDevice via the actual device key. As you rewrite the device keys from the backed up ConfigInfo to negative values in the ConfigSpec you will have to rewrite the VirtualMachineBootOptionsBootableDiskDevice.deviceKey to same negative value. This holds also true for VirtualMachineBootOptionsBootableEthernetDevice. VirtualMachineBootOptionsBootableFloppyDevice and VirtualMachineBootOptionsBootableCdromDevice do not show a property deviceKey.

Further be aware of the fact that VirtualMachineBootOptions.bootOrder is only available Since vSphere API 5.0. That is for 4.1 4.0 etc the above will not work. Therefore check out RDM Disks and Virtual BIOS where there is the recommendation to backup the .nvram file. This approach should work on all vSphere editions as I understand it.

Does that help?

Thomas G.
Reply
0 Kudos
sivadevel
Enthusiast
Enthusiast

Wonderful. Let me try taking a backup of .nvram and test. Will get backup on the result,

Thanks,

./Siva

Reply
0 Kudos