NAME

hostops.pl - Performs these operations: add standalone, disconnect, reconnect, enter maintenance mode, exit from maintenance mode, reboot, shutdown host, add host, remove host, and move host into folder/cluster.


SYNOPSIS

 hostops.pl --operation <disconnect|reconnect|enter_maintenance|
              exit_maintenance|reboot|shutdown|add_standalone|
              addhost|moveintofolder|moveintocluster|removehost> [options]


DESCRIPTION

This script allows users to perform basic operations on the host server. The supported operations are: add_standalone ,disconnect, reconnect, enter_maintenance,exit_maintenance, reboot,shutdown, addhost and moveintofolder, moveintocluster, removehost.


OPTIONS

GENERAL OPTIONS

operation

Required. Operation to be performed must be one of the following:

 shutdown (shutdown the host)
 reboot (reboot the host)
 enter_maintenance (set host into maintenance mode)
 exit_maintenance (exit the maintenance mode)
 disconnect (disconnect the host)
 reconnect (reconnect the host)
 add_standalone (add new host)
 addhost (add host to a cluster)
 moveintofolder (move host out of a cluster to a folder)
 moveintocluster (move host out of a folder to a cluster)
 removehost (remove move host)

ADD STANDALONE OPTIONS

target_host

Required. Domain name or IP address of the target host.

target_username

Required. Username for logging into the VirtualCenter server host to be added.

target_password

Required. Password for logging into the VirtualCenter server host to be added.

ADD HOST OPTIONS

target_host

Required. Domain name or IP address of the target host.

target_username

Required. Username for logging into the VirtualCenter server host to be added.

target_password

Required. Password for logging into the VirtualCenter server host to be added.

cluster

Required. Name of the cluster into which host is to be added.

force

Optional. Flag to specify whether or not to force the addition of host even if this is being managed by other virtual center.

port

Optional. Port number for the connection.

MOVE HOST INTO FOLDER OPTIONS

target_host

Required. Domain name or IP address of the target host.

target_username

Required. Username for logging into the VirtualCenter server host to be added.

target_password

Required. Password for logging into the VirtualCenter server host to be added.

folder

Required. Folder name into which host is to be moved in from the cluster in the current datacenter.

MOVE HOST INTO CLUSTER OPTIONS

target_host

Required. Domain name or iIP address of the target host.

target_username

Required. Username for logging into the VirtualCenter server host to be added.

target_password

Required. Password for logging into the VirtualCenter server host to be added.

cluster

Required. Cluster name into which host is to be moved in from the folder in the current datacenter.

REMOVE HOST OPTIONS

target_host

Required. Domain name or IP address of the target host.

target_username

Required. Username for logging into the VirtualCenter server host to be added.

target_password

Required. Password for logging into the VirtualCenter server host to be added.

DISCONNECT HOST OPTIONS

target_host

Required. Domain name or IP address of the target host.

RECONNECT HOST OPTIONS

target_host

Required. Domain name or IP address of the target host.

ENTER MAINTENANCE MODE OPTIONS

target_host

Required. Domain name or IP address of the target host.

suspend

Optional. Flag to specify whether or not to suspend to virtual machine.

quiet

Optional. Flag to specify whether or not to provide progress messages as the virtual machines are suspended for some operations.

EXIT MAINTENANCE MODE OPTIONS

target_host

Required. Domain name or IP address of the target host.

SHUTDOWN OPTIONS

target_host

Required. Domain name or IP address of the target host.

suspend

Optional. Flag to specify whether or not to suspend to virtual machine.

quiet

Optional. Flag to specify whether or not to provide progress messages as the virtual machines are suspended for some operations.

REBOOT OPTIONS

target_host

Required. Domain name or IP address of the target host.

suspend

Optional. Flag to specify whether or not to suspend to virtual machine. Default: 0

quiet

Optional. Flag to specify whether or not to provide progress messages as the virtual machines are suspended for some operations. Default: 1


EXAMPLES

Shut down a host with progress messages. i.e ``quiet = 0'':

 hostops.pl --username root --password esxadmin --operation shutdown
           --url https://<ipaddress>:<port>/sdk/webService
           --target_host targetABC --suspend 1 --quiet 0

Reboot a host with progress messages. i.e ``quiet = 0'':

 hostops.pl --username root --password esxadmin --operation reboot
           --url https://<ipaddress>:<port>/sdk/webService
            --target_host targetABC --suspend 1 --quiet 0

Enter maintenance mode with no progress messages. i.e ``quiet = 1'':

 hostops.pl --username root --password esxadmin --operation enter_maintenance
           --url https://<ipaddress>:<port>/sdk/webService
           --target_host targetABC --suspend 1 --quiet 1

Exit maintenance mode:

 hostops.pl --username root --password esxadmin --operation exit_maintenance
           --url https://<ipaddress>:<port>/sdk/webService
           --target_host targetABC

Reconnect a host:

 hostops.pl --url https://<ipaddress>:<port>/sdk/webService --username user
           --password mypassword --target_host targetABC
           --operation reconnect

Disconnect a host:

 hostops.pl --url https://<ipaddress>:<port>/sdk/webService --username user
           --password mypassword --target_host targetABC
           --operation disconnect

Add standalone host, this host is already being managed by other virtual center use force option to add it to the given virtual center:

 hostops.pl --url https://<ipaddress>:<port>/sdk/webService --username user
           --password mypassword --target_host targetABC
           --target_username root --target_password esxadmin
           --operation add_standalone --force 1

Remove host:

 hostops.pl --url https://<ipaddress>:<port>/sdk/webService --username user
           --password mypassword --target_host targetABC
           --target_username root --target_password esxadmin
           --operation removehost

Add host to a cluster:

 hostops.pl --url https://<ipaddress>:<port>/sdk/webService --username user
           --password mypassword --target_host targetABC
           --target_username root --target_password esxadmin
           --operation addhost --cluster myCluster

Move host from cluster to a folder:
 hostops.pl --url https://<ipaddress>:<port>/sdk/webService --username user
           --password mypassword --target_host targetABC
           --target_username root --target_password esxadmin
           --operation moveintofolder --folder myFolder

Move host from folder to a cluster:

 hostops.pl --url https://<ipaddress>:<port>/sdk/webService --username user
           --password mypassword --target_host targetABC
           --target_username root --target_password esxadmin
           --operation moveintocluster --cluster mycluster


SUPPORTED PLATFORMS

All operations supported via Virtual Center Server 2.0.1.

Only enter_maintenance, exit_maintenance, shutdown, and reboot work with ESX Sever 3.0.1.