NAME

vmreconfig.pl - Reconfigure a virtual machine.


SYNOPSIS

vmreconfig.pl [options]


DESCRIPTION

This VI Perl command-line utility provides an interface to reconfigure a virtual machine based on the parameters specified a valid XML input file. The syntax of the XML file is validated against the specified schema file. Reconfiguring a virtual machine involves the following operations:

 - Add/Remove NetworkAdapter, Floppy, CD, Disk.
 - Connect/Disconnect NetworkAdapter, Floppy, CD
 - connect the NIC, Floppy, CD when the virtual machine starts.
 - Increase/Decrease CPU and memory shares.


OPTIONS

GENERAL OPTIONS

filename

Optional. Specifies the location of the XML file containing re-configuration parameters. If this option is not specified, then the default file 'vmreconfig.xml' (in the "../sampledata" directory) is used. Review the vmreconfig.xml file to learn how to create your own input XML files.

schema

Optional. The location of the schema file against which the input XML file is validated. If this option is not specified, then the file 'vmreconfig.xsd' will be used from the "../schema" directory. This file need not be modified by the user.

INPUT PARAMETERS

The parameters for creating the virtual machine are specified in an XML file. Following are the input parameters in the XML file:

VIRTUAL MACHINE PARAMETERS

Name

Required. Name of the virtual machine.

Host

Required. Name of the host.

ADD-DEVICE PARAMETERS

Name

Optional. Name of the device. Each of the NetworkAdapter, Floppy, CD and Disk device has different <Name> element in the XML file.

Datastore

Optional. Name of the datastore. This parameter is required only for adding a CD/DVD drive where the media type is ISO image.

FileName

Optional. Name of the ISO image file. This parameter is required only for adding a CD/DVD drive where the media type is ISO image.

DeviceName

Optional. Name of the physical drive. This parameter is required only for adding a CD/DVD drive where the media type is physical drive.

REMOVE-DEVICE PARAMETER

Name

Optional. Name of the device. Each of the NetworkAdapter, Floppy, CD and Disk device has different <Name> element in the XML file.

CONNECT-DEVICE PARAMETER

Name

Optional. Name of the device. Each of the NetworkAdapter, Floppy and CD device has different <Name> element in the XML file.

DISCONNECT-DEVICE PARAMETER

Name

Optional. Name of the device. Each of the NetworkAdapter, Floppy and CD device has different <Name> element in the XML file.

POWERON-FLAG PARAMETERS

Name

Optional. Name of the device. Each of the NetworkAdapter, Floppy and CD device has different <Name> element in the XML file.

PowerOn

Optional. Flag to specify whether or not to connect the device when the virtual machine starts. Each of the NetworkAdapter, Floppy and CD device has different <Name> and <PowerOn> element in the XML file.

SHARES PARAMETERS

CPU

Optional. Value of the CPU share [Integral Value|low|normal|high].

Memory

Optional. Value of memory share [Integral Value|low|normal|high].


SAMPLE INPUT XML FILE

 <?xml version="1.0"?>
 <Reconfigure-Virtual-Machine>
  <Name>VMName</Name>
  <Host>HostName</Host>
  <Add-Device>
   <Network-Adapter>
    <Name>VM Network</Name>
   </Network-Adapter>
   <Floppy-Drive>
    <Name>Floppy1</Name>
   </Floppy-Drive>
   <CD-DVD-Drive>
    <Name>Drive22</Name>
    <Media-Type>
     <ISO-Image>
      <Datastore>storage1</Datastore>
      <FileName>iso2</FileName>
     </ISO-Image>
     <Physical-Drive>
      <DeviceName>/dev/cdrom</DeviceName>
     </Physical-Drive>
    </Media-Type>
   </CD-DVD-Drive>
   <Hard-Disk>
    <Name>Hard Disk12</Name>
    <Size>10</Size>
    <Persistent-Mode>persistent</Persistent-Mode>
   </Hard-Disk>
  </Add-Device>
  <Remove-Device>
   <Network-Adapter>
    <Name>VM Network</Name>
   </Network-Adapter>
   <Floppy-Drive>
    <Name>F1</Name>
   </Floppy-Drive>
   <CD-DVD-Drive>
    <Name>CD2</Name>
   </CD-DVD-Drive>
   <Hard-Disk>
    <Name>Disk22</Name>
   </Hard-Disk>
  </Remove-Device>
  <Connect-Device>
   <Network-Adapter>
    <Name>VM Network</Name>
   </Network-Adapter>
   <Floppy-Drive>
    <Name>Floppy</Name>
   </Floppy-Drive>
   <CD-DVD-Drive>
    <Name>CD2</Name>
   </CD-DVD-Drive>
  </Connect-Device>
  <Disconnect-Device>
   <Network-Adapter>
    <Name>VM Network</Name>
   </Network-Adapter>
   <Floppy-Drive>
    <Name>Floppy</Name>
   </Floppy-Drive>
   <CD-DVD-Drive>
    <Name>CD2</Name>
   </CD-DVD-Drive>
  </Disconnect-Device>
  <PowerOn-Flag>
   <Network-Adapter>
    <Name>VM Network</Name>
    <PowerOn>True</PowerOn>
   </Network-Adapter>
   <Floppy-Drive>
    <Name>Floppy1</Name>
    <PowerOn>False</PowerOn>
   </Floppy-Drive>
   <CD-DVD-Drive>
    <Name>CD 1</Name>
    <PowerOn>False</PowerOn>
   </CD-DVD-Drive>
  </PowerOn-Flag>
  <Shares>
   <CPU></CPU>
   <Memory></Memory>
  </Shares>
 </Reconfigure-Virtual-Machine>


EXAMPLES

Add a virtual disk with <Name> 'HardDisk 1', <Size> '10' MB and <Persistent-Mode> 'persistent'

 vmreconfig.pl --url https://<host>:<port>/sdk/vimService
                --username myuser --password mypassword
                --filename vmreconfig.xml --schema vmreconfig.xsd


SUPPORTED PLATFORMS

All operations work with VMware VirtualCenter 2.0.1 or later.

All operations work with VMware ESX Server 3.0.1 or later.