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 in theinput valid XML 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.

The user can perform multiple operation at a time. For e.g a user can add a hard disk, remove a floppy and change the memory shares in a single run. Suppose a user wants to remove a hard disk which is not present and also remove a floppy which exists, then the reconfigure operation will be completed successfully for the floppy but it will ignore the settings for invalid hard disk name because the script will create the device config spec for floppy only. If the XML file only contains the parameters for removing a non-existent disk then the device config spec will not be created and no reconfiguration will be performed.


OPTIONS

GENERAL OPTIONS

filename

Optional. The location of the XML file which contains the reconfiguration parameters. If this option is not specified, then the default file 'vmreconfig.xml' will be used from the ``../sampledata'' directory. The user can use this file as a reference to create there own input XML files and specify the file's location using the <filename> option.

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.

Size

Optional. Size of the hard disk.

Persistent-Mode
 Optional. Mode of the hard disk. The mode must be one of the following:
   persistent
   nonpersistent
   undoable
   independent_persistent
   independent_nonpersistent
   append

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. Value must be 'true' or 'false'.

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>
   </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.