VMware {code} Community
chufall
Contributor
Contributor

How to change virtual disk adapter of virtual machine with perl

Hi

I have use the tool "vmcreate.pl" in the Perl SDK  to create a virtual machine on the ESXi 5.

I have specified the guestid to windows 2008 x64 r2, and the whole xml is the following:

<?xml version="1.0"?>
<Virtual-Machines>
         <Virtual-Machine>
            <Name>test_web5</Name>
                <Host>vmware16.openqrm</Host>
                <Datacenter>ha-datacenter</Datacenter>
                <Guest-Id>windows7Server64Guest</Guest-Id>
                <Datastore>bak</Datastore>
                <Disksize>10240000</Disksize>
                <Memory>512</Memory>
                <Number-of-Processor>1</Number-of-Processor>
                <Nic-Network>VM Network</Nic-Network>
                <Nic-Poweron>0</Nic-Poweron>
         </Virtual-Machine>
</Virtual-Machines>

After the tool runs, the virtual machine has been created on the ESXi server.

The problem is  that the scsi adapter of the machine is buslogic,and the machine cannot be started due to the windows server 2008 r2 cannot figure out the buslogic. I have to change the disk adapter to lsilogic manually.

So my question is how to change the disk adapter by perl, and any code example will be better.

Thank you so much!

Best reguard!

chu

0 Kudos
1 Reply
stumpr
Virtuoso
Virtuoso

It doesn't look like the script supports the VirtualLsiLogicController device.

If you know you won't need the VirtualBusLogicController device, you can change the vmcreate.pl script to default to VirtualLsiLogicController by changing line number 222 from:

      VirtualBusLogicController->new(key => 0,

to:

      VirtualLsiLogicController->new(key => 0,
Reuben Stump | http://www.virtuin.com | @ReubenStump
0 Kudos