Managing Virtual Machines Using the
Cisco SRE-V CLI
Note We recommend that you use the vSphere Client GUI instead of the Cisco SRE-V CLI to manage virtual machines. See Chapter 7, "Managing Virtual Machines."
You can use the Cisco SRE-V CLI to export, import, power-on, power-off, shutdown, delete, troubleshoot, or view details about virtual machines. See the following topics for more information:
•Exporting the Virtual Machine to a Remote Location
•Importing the Virtual Machine to VMware vSphere Hypervisor
•Deleting a Virtual Machine
•Managing System Logs
•Changing the VMware vSphere Hypervisor Root Password
•Viewing Information About a Specific Virtual Machine
•Viewing Information About All Virtual Machines
•Viewing VMware vSphere Hypervisor Management Settings
•Viewing vSwitches in the VMware vSphere Hypervisor
•Viewing VMkernel NICs in the VMware vSphere Hypervisor
•Power on, Power off, or Shut Down a Virtual Machine
Exporting the Virtual Machine to a Remote Location
To export the virtual machine in OVF format and upload it to a specified remote location, use the following command:
virtual-machine export vm name remote url [username username password password]
PREREQUISITES
Make sure that the virtual machine that you want to export is not running.
SUMMARY STEPS
From the Console Manager interface, enter:
1. virtual-machine export vm name remote url [username username password password]
DETAILED STEPS
To perform configuration tasks on the Cisco SRE Service Module, you must enter the Cisco SRE-V command environment, and then enter the configuration commands. See the "Entering the Cisco SRE-V Command Environment" section on page 5-3
|
|
|
Step 1 |
virtual-machine export vm name remote url [username username password password]
SRE-Module# virtual-machine export Win2K3
ftp://ftpserver.com/dir
|
Exports the virtual machine in OVF format and uploads it to a specified remote location. •vm name—Unique string used to identify the virtual machine. Maximum string length: 32 alphanumeric characters. Note If the virtual machine name contains a space, make sure that you add the name in quotes, otherwise, the export operation will fail. For example "Win 2K3". •remote url—URL where the virtual machine (Microsoft Windows image) must be exported. Supported protocols: FTP, FTPS, and SFTP. •username username—(Optional) Specifies the login name of the user who has access to the remote site. username—Unique string to log into the remote site. •password password—(Optional) Specifies the password used with the username to access the remote site. password—Unique string used with the username to access the remote site. |
.
Related Topics
•Importing the Virtual Machine to VMware vSphere Hypervisor
Importing the Virtual Machine to VMware vSphere Hypervisor
To import a virtual machine in OVF format from a specified remote location to a data store in VMware vSphere HypervisorTM, use the following command:
virtual-machine import remote url datastore data store name [username username password password] [name vm name]
PREREQUISITES
Make sure you have done the following:
•Cisco SRE-V license is activated.
•Firewall rules are set up correctly so that the Cisco SRE Service Module console manager interface can reach the remote URL.
•VMware vSphere HypervisorTM default gateway IP address is configured. See the "Setting up the VMware vSphere Hypervisor Default Gateway" section on page 7-1.
•Read the "Important Information About Creating Virtual Machines" section on page 7-5.
SUMMARY STEPS
From the Console Manager interface, enter:
1. virtual-machine import remote url datastore data store name [username username password password] [name vm name]
DETAILED STEPS
To perform configuration tasks on the Cisco SRE Service Module, you must enter the Cisco SRE-V command environment, and then enter the configuration commands. See the "Entering the Cisco SRE-V Command Environment" section on page 5-3
|
|
|
Step 1 |
virtual-machine import remote url datastore data store name [username username password password] [name vm name]
SRE-Module# virtual-machine import
ftp://1.1.1.1/x/y.ovf datastore datastore1
Evaluation licenses are being activated in the
device for the following feature(s):
Feature Name: SRE-V-HOST-LIC
---------------------------------
---------------------------------
ACCEPT? [y/n]? y-------------------
|
Imports the virtual machine from the specified remote location to a data store in VMware vSphere HypervisorTM. The imported image must be in OVF format. Note Make sure that the OVF file name does not contain a space, otherwise, the import operation will fail. •remote url—URL where the virtual machine to be imported is located. Supported protocols: FTP, FTPS, and SFTP. •datastore data store name—Specifies the name of the data store where the virtual machine you are importing must reside. data store name—Name of the data store where the virtual machine you are importing must reside. •username username—(Optional) Specifies the login name of the user who has access to the remote site. username—Unique string to log into the remote site. •password password—(Optional) Specifies the password used with the username to provide access to the remote site. password—Unique string used with the username to access the remote site. •name vm name—(Optional) Specifies the name of the virtual machine. vm name—Unique string used to identify the virtual machine. Maximum string length: 32 alphanumeric characters. Note If the virtual machine name contains a space, make sure that you add the name in quotes, otherwise, the import operation will fail. For example "Win 2K3". |
.
Note If you purchased the Cisco SRE-V Option 3 (Hardware, plus Virtualization software, plus Microsoft Windows software), a virtual machine is provided to you by default. Both the Virtualization software license and the Microsoft Windows software license on this virtual machine are preactivated. If you choose to export this virtual machine and then import it back, you must do the following, otherwise, the Microsoft Windows software license activation will fail:
•Manually add the following configuration lines to the OVF file in the Virtual Hardware section:
<vmw:ExtraConfig vmw:key="acpi.passthru.slic" vmw:value="true"/>
<vmw:ExtraConfig vmw:key="acpi.passthru.slicvendor" vmw:value="true"/>
<vmw:ExtraConfig vmw:key="smbios.addhostvendor" vmw:value="true"/>
•Before you power on the virtual machine, verify that the VMX files contain the following parameters. If these parameters are missing, you must add them:
pcie.reportDataLink= "TRUE"
Related Topics
•Exporting the Virtual Machine to a Remote Location
Deleting a Virtual Machine
To remove the specified virtual machine from the inventory and delete all of its files from the data store, use the following command:
virtual-machine delete vm name [noconfirm]
PREREQUISITES
Make sure that virtual machine is shut down or powered off.
SUMMARY STEPS
From the Console Manager interface, enter:
1. virtual-machine delete vm name [noconfirm]
DETAILED STEPS
To perform configuration tasks on the Cisco SRE Service Module, you must enter the Cisco SRE-V command environment, and then enter the configuration commands. See the "Entering the Cisco SRE-V Command Environment" section on page 5-3
|
|
|
Step 1 |
virtual-machine delete vm name [noconfirm]
SRE-Module# virtual-machine delete windows-2008
This will delete the virtual machine and all of
its related files. Do you wish to continue?
(y/n) y
|
Removes the specified virtual machine from the inventory and deletes all of its files from the data store. •vm name—Unique string used to identify the virtual machine. Maximum string length: 32 alphanumeric characters. The virtual machine name is case sensitive. •noconfirm—(Optional) Powers on, powers off, or shuts down the specified virtual machine without providing a confirmation message. |
.
Managing System Logs
System logs list events, alarms, and assorted logs that contain information about activities in your vSphere environment. For information about storing, removing, and viewing logs see the following sections:
•Storing System Logs in a File in the Local Datastore
•Storing System Logs in a Remote Server
•Removing System Logs from a Local File or a Remote Server
•Viewing VMware vSphere Hypervisor Logs
•Viewing VMware vSphere Hypervisor Datastore Information
Storing System Logs in a File in the Local Datastore
To store system logs in a file in the local datastore, use the following command:
hypervisor set syslog local datastore datastore name file file name
SUMMARY STEPS
From the Console Manager interface, enter:
1. hypervisor set syslog local datastore datastore name file file name
DETAILED STEPS
To perform configuration tasks on the Cisco SRE Service Module, you must enter the Cisco SRE-V command environment, and then enter the configuration commands. See the "Entering the Cisco SRE-V Command Environment" section on page 5-3
|
|
|
Step 1 |
hypervisor set syslog local datastore datastore name file file name
SRE-Module# hypervisor set syslog local
datastore datastore0 file /var/log/mysyslog.log
|
Specifies the file in a local datastore in which the system logs are stored. •datastore name—Name of the datastore in which to store the system log file. •file file name—Specifies the name of the file in which to store the system logs. file name—Name of the file in which to store the system logs. |
.
Storing System Logs in a Remote Server
To store system log file in a remote server, use the following command:
hypervisor set syslog remote hostname hostname port port number
SUMMARY STEPS
From the Console Manager interface, enter:
1. hypervisor set syslog remote hostname hostname port port number
DETAILED STEPS
To perform configuration tasks on the Cisco SRE Service Module, you must enter the Cisco SRE-V command environment, and then enter the configuration commands. See the "Entering the Cisco SRE-V Command Environment" section on page 5-3
|
|
|
Step 1 |
hypervisor set syslog remote hostname hostname port port number
SRE-Module# hypervisor set syslog remote
hostname 1.100.50.11 port 1000
|
Specifies the remote server in which the system logs are stored. •hostname—Hostname or IP address of the remote server in which to store the system logs. •port port number—Specifies the port number of the remote syslog server in which to store the system logs. port number—Port number of the remote syslog server in which to store the system logs. |
.
Removing System Logs from a Local File or a Remote Server
To remove the system logs from a local file in the datastore or from a remote server, use the following command:
hypervisor unset syslog {local | remote}
SUMMARY STEPS
From the Console Manager interface, enter:
1. hypervisor unset syslog {local | remote}
DETAILED STEPS
To perform configuration tasks on the Cisco SRE Service Module, you must enter the Cisco SRE-V command environment, and then enter the configuration commands. See the "Entering the Cisco SRE-V Command Environment" section on page 5-3
|
|
|
Step 1 |
hypervisor unset syslog {local | remote}
SRE-Module# hypervisor set syslog remote
hostname 1.100.50.11 port 1000
|
Removes the system logs from a local file in the datastore or from a remote server. •local—Removes the system logs from the local file in the datastore in which the logs reside. •remote—Removes the system logs from the remote server in which the logs reside. |
.
Viewing VMware vSphere Hypervisor Logs
To display system messages, system boot logs, and host VMware vSphere HypervisorTM logs, use the following command:
show hypervisor log {messages | config | mgmt-agent}
SUMMARY STEPS
From the Console Manager interface, enter:
1. show hypervisor log {messages | config | mgmt-agent}
DETAILED STEPS
To perform configuration tasks on the Cisco SRE Service Module, you must enter the Cisco SRE-V command environment, and then enter the configuration commands. See the "Entering the Cisco SRE-V Command Environment" section on page 5-3.
|
|
|
Step 1 |
show hypervisor log {messages | config | mgmt-agent}
SRE-Module# show hypervisor log config |
Displays system messages, system boot logs, and host VMware vSphere HypervisorTM logs. •messages—Displays the VMware vSphere HypervisorTM system messages. This log file is located at /var/log/messages. File size: Approximately 1.1 MB. •config—Displays the VMware vSphere HypervisorTM system boot logs. This log file is located at /var/log/sysboot.log. File size: Approximately 12 K. •mgmt-agent—Displays the VMware vSphere HypervisorTM host logs. This log file is located at /var/log/VMware/hostd.log. File size: Approximately 512 K. |
Viewing VMware vSphere Hypervisor Datastore Information
To view details such as name, capacity, and free space available on all of the existing datastores in VMware vSphere HypervisorTM, use the following command:
show hypervisor datastore [all]
SUMMARY STEPS
From the Console Manager interface, enter:
1. show hypervisor datastore [all]
DETAILED STEPS
To perform configuration tasks on the Cisco SRE Service Module, you must enter the Cisco SRE-V command environment, and then enter the configuration commands. See the "Entering the Cisco SRE-V Command Environment" section on page 5-3.
|
|
|
Step 1 |
show hypervisor datastore [all]
SRE-Module# show hypervisor datastore Name Capacity Free Space datastore1 500GB 200GB |
Displays details, such as the name, capacity, and free space available on all of the existing data stores in the VMware vSphere HypervisorTM. •all—(Optional) Displays details, such as the name, capacity, and free space available on all of the existing data stores in the VMware vSphere HypervisorTM. |
Changing the VMware vSphere Hypervisor Root Password
The root password is the password used between the Management virtual machine and the VMware vSphere HypervisorTM. The root password is used internally for management purposes, which you can change. To change the root password, you provide a password seed. The system uses the password seed to generate the new root password.
To change the root password, use the following command:
hypervisor set password seed password_seed
SUMMARY STEPS
From the Console Manager interface, enter:
1. hypervisor set password seed password_seed
DETAILED STEPS
To perform configuration tasks on the Cisco SRE Service Module, you must enter the Cisco SRE-V command environment, and then enter the configuration commands. See the "Entering the Cisco SRE-V Command Environment" section on page 5-3
|
|
|
Step 1 |
hypervisor set password seed password_seed
SRE-Module# hypervisor set password seed Ci5co$ysTems |
Specifies the password seed, which the system uses to generate the new root password. After the new password is generated, it takes effect immediately. Ensure that you keep the password seed securely. You cannot retrieve the root password, but the password seed is required to help recover the root password for technical assistance. •seed password_seed—Unique string used by the system to generate the root password. The seed password is case sensitive and can contain a mix of characters from the following four character classes: –Lowercase letters –Uppercase letters –Digits –Special characters, such as ~ ! @ # $ % ^ & * ( ) - _ + = / < > . , |
.
Viewing Information About a Specific Virtual Machine
To view details such as CPU, memory size, disk size, interfaces, status, and VMware tools about a specific virtual machine, use the following command:
show virtual-machine name vm name
SUMMARY STEPS
From the Console Manager interface, enter:
1. show virtual-machine name vm name
DETAILED STEPS
To perform configuration tasks on the Cisco SRE Service Module, you must enter the Cisco SRE-V command environment, and then enter the configuration commands. See the "Entering the Cisco SRE-V Command Environment" section on page 5-3.
|
|
|
Step 1 |
show virtual-machine name vm name
SRE-Module# show virtual-machine name Win2K3 CPU: 2 vCPUs Memory Size: 1 GB vDisk(s): Disk 1(200 GB) vNIC(s): NIC 1(MAC=1234.5678.ABCD) NIC 2(MAC=1234.5678.EFGH) Status: Running VMware Tools: Installed |
Displays details such as, CPU, memory size, disk size, interfaces, status, and VMware tools about a specific virtual machine. •vm name—Unique string used to identify the virtual machine. Maximum string length: 32 alphanumeric characters. The virtual machine name is case sensitive. |
Viewing Information About All Virtual Machines
To view a list of all of the virtual machines in the system and their running status, use the following command:
show virtual-machine [all]
SUMMARY STEPS
From the Console Manager interface, enter:
1. show virtual-machine [all]
DETAILED STEPS
To perform configuration tasks on the Cisco SRE Service Module, you must enter the Cisco SRE-V command environment, and then enter the configuration commands. See the "Entering the Cisco SRE-V Command Environment" section on page 5-3.
|
|
|
Step 1 |
show virtual-machine [all]
SRE-Module# show virtual-machine Name Status Win2K3 Running Win2K8 Stopped |
Lists all of the virtual machines in the system and their running status: Running or Stopped. •all—(Optional) Lists all the virtual machines in the system and their running status: Running or Stopped. Note The management virtual machine is not displayed in the list. |
Viewing VMware vSphere Hypervisor Management Settings
The management network is the network that is used to connect to the VMware vSphere HypervisorTM remotely. To view the VMware vSphere HypervisorTM management network settings, such as the hostname, IP address, subnet mask, IP gateway, and DNS server, use the following command:
show hypervisor ip
SUMMARY STEPS
From the Console Manager interface, enter:
1. show hypervisor ip
DETAILED STEPS
To perform configuration tasks on the Cisco SRE Service Module, you must enter the Cisco SRE-V command environment, and then enter the configuration commands. See the "Entering the Cisco SRE-V Command Environment" section on page 5-3.
|
|
|
Step 1 |
show hypervisor ip
SRE-Module# show hypervisor ip Hostname: esxi-blade IP Address: 1.100.80.30 Subnet Mask: 255.255.255.0 IP Gateway: 1.100.80.1 Preferred DNS Server: 1.100.80.5 Alternative DNS Server: 1.100.80.6 |
Displays the VMware vSphere HypervisorTM management network settings, such as the hostname, IP address, subnet mask, IP gateway, and the primary and secondary DNS servers. Note The preferred DNS server is the primary DNS server and the alternative DNS server is the secondary DNS server. |
Viewing vSwitches in the VMware vSphere Hypervisor
To view the vSwitches and port groups in VMware vSphere HypervisorTM, use the following command:
show hypervisor vswitch [all]
SUMMARY STEPS
From the Console Manager interface, enter:
1. show hypervisor vswitch [all]
DETAILED STEPS
To perform configuration tasks on the Cisco SRE Service Module, you must enter the Cisco SRE-V command environment, and then enter the configuration commands. See the "Entering the Cisco SRE-V Command Environment" section on page 5-3.
|
|
|
Step 1 |
show hypervisor vswitch [all] |
Displays all of the existing vSwitches and port groups in the VMware vSphere HypervisorTM. See the "Information About vSwitches" section on page 7-8. •all—(Optional) Displays all of the existing vSwitches and port groups in the VMware vSphere HypervisorTM. |
SRE-Module# show hypervisor vswitch
Switch Name Num Ports Used Ports Configured Ports MTU Uplinks
vSwitch0 128 3 128 1500 vmnic2
PortGroup Name VLAN ID Used Ports Uplinks
Management Network 0 1 vmnic2
Switch Name Num Ports Used Ports Configured Ports MTU Uplinks
PortGroup Name VLAN ID Used Ports Uplinks
Switch Name Num Ports Used Ports Configured Ports MTU Uplinks
ciscoSwitch 8 3 8 1500 vmnic1
PortGroup Name VLAN ID Used Ports Uplinks
Viewing VMkernel NICs in the VMware vSphere Hypervisor
The VMkernel TCP/IP stack handles traffic for VMware vSphere HypervisorTM services such as, VMware vMotion, ISCSI, NFS, and host management.
To view all of the VMkernel NICs on the VMware vSphere HypervisorTM, use the following command:
show hypervisor vmknic [all]
SUMMARY STEPS
From the Console Manager interface, enter:
1. show hypervisor vmknic [all]
DETAILED STEPS
To perform configuration tasks on the Cisco SRE Service Module, you must enter the Cisco SRE-V command environment, and then enter the configuration commands. See the "Entering the Cisco SRE-V Command Environment" section on page 5-3.
|
|
|
Step 1 |
show hypervisor vmknic [all] |
Displays all of the VMkernel NICs on the VMware vSphere HypervisorTM. •all—(Optional) Displays all of the VMkernel NICs on the VMware vSphere HypervisorTM. |
SRE-Module# show hypervisor vmknic
Intf. Portgroup/DVPort IP Address Netmask MAC
---------------------------------------------------------------------------
vmk0 Management Network 1.100.50.160 255.255.255.0 00:23:eb:a1:05:e7
vmk1 hgNet 169.254.1.1 255.255.255.0 00:50:56:73:96:e8
2 total VMkernel nic(s)
Power on, Power off, or Shut Down a Virtual Machine
To power on, power off, or shut down a virtual machine, use the following command:
virtual-machine {power-on | power-off | shutdown} vm name [noconfirm]
PREREQUISITES
•To power on a virtual machine, make sure that the virtual machine is not running.
•To power off a virtual machine, make sure that the virtual machine is running.
•To shut down a virtual machine, verify the following:
–Make sure that the virtual machine is running.
–Make sure that VMware tools are installed on the virtual machine.
SUMMARY STEPS
From the Console Manager interface, enter:
1. virtual-machine {power-on | power-off | shutdown} vm name [noconfirm]
DETAILED STEPS
To perform configuration tasks on the Cisco SRE Service Module, you must enter the Cisco SRE-V command environment, and then enter the configuration commands. See the "Entering the Cisco SRE-V Command Environment" section on page 5-3
|
|
|
Step 1 |
virtual-machine {power-on | power-off | shutdown} vm name [noconfirm]
SRE-Module# virtual-machine power-on
windows-2008
SRE-Module# virtual-machine power-off
windows-2008
This will do a forced shutdown of the virtual
machine. This may cause data loss or
corruption. Do you wish to continue? (y/n) n
SRE-Module# virtual-machine power-off noconfirm
windows-2008
SRE-Module# virtual-machine shutdown
windows-2008
The virtual machine "windows-2008" cannot be
shutdown, no VMware tools installed.
|
Powers on, powers off, or shuts down the specified virtual machine. •power-on—Powers on the virtual machine. •power-off—Powers off the virtual machine. The power-off command causes a forced shutdown of the virtual machine, which might result in loss or corruption of data. •shutdown—Shuts down the virtual machine gracefully. Only the virtual machines that have VMware tools installed on them shutdown gracefully. •vm name—Unique string used to identify the virtual machine. Maximum string length: 32 alphanumeric characters. The virtual machine name is case sensitive. •noconfirm—(Optional) Powers on, powers off, or shuts down the specified virtual machine without providing a confirmation message. |
.