- Table of Contents
- Related Documents
-
Title | Size | Download |
---|---|---|
03-VM commands | 321.84 KB |
Contents
VM commands
This feature is supported only on the RPE-X5E MPU.
To ensure correct operation of VMs, make sure the storage medium where the VMs are installed has sufficient storage space.
add disk
Use add disk to add a disk to a VM.
Syntax
In standalone mode:
add disk vm slot slot-number vm-name format { raw | qcow2 } disk-file path-file
In IRF mode:
add disk vm chassis chassis-number slot slot-number vm-name format { raw | qcow2 } disk-file path-file
Views
VMM view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
format: Specifies the disk format.
raw: Specifies the RAW format.
qcow2: Specifies the QCOW2 format.
disk-file path-file: Specifies the disk file path. The path-file argument is a case-sensitive of 1 to 63 characters.
Usage guidelines
Before you add a disk to a VM, you must use the create-disk command to create the disk.
Examples
# Add a disk in QCOW2 format to VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] add disk vm slot 0 centos7 format qcow2 disk-file hda0:/centos7.qcow
add sriov
Use add sriov to assign an SR-IOV NIC to a VM.
Syntax
In standalone mode:
add sriov vm slot slot-number vm-name pf pfid
In IRF mode:
add sriov vm chassis chassis-number slot slot-number vm-name pf pfid
Views
VMM view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
pf pfid: Specifies a physical NIC by its PF ID. The value for the pfid argument is 0 or 1.
Examples
# Assign an SR-IOV NIC to VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] add sriov vm slot 0 centos7 pf 0
add vtap
Use add vtap to add a vTap NIC to a VM.
Syntax
In standalone mode:
add vtap vm slot slot-number vm-name mac mac-address [ vlan vlan-id ]
In IRF mode:
add vtap vm chassis chassis-number slot slot-number vm-name mac mac-address [ vlan vlan-id ]
Views
VMM view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
mac mac-address: Specifies a vTap NIC by its MAC address. The mac-address argument is a hexadecimal string in the format of xxxx-xxxx-xxxx.
vlan vlan-id: Specifies a VLAN for the vTap interface. The value range for the vlan-id argument is 1 to 4094.
Examples
# Add a vTap NIC to VM centos7 and the MAC address of the NIC is 0010-1110-5872.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] add vtap vm slot 0 centos7 mac 0010-1110-5872
autostart
Use autostart to enable auto-start for a VM.
Use undo autostart to disable auto-start for a VM.
Syntax
In standalone mode:
autostart vm slot slot-number vm-name
undo autostart vm slot slot-number vm-name
In IRF mode:
autostart vm chassis chassis-number slot slot-number vm-name
undo autostart vm chassis chassis-number slot slot-number vm-name
Default
Auto-start is disabled for a VM.
Views
VMM view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
Examples
# Enable auto-start for VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] autostart vm slot 0 centos7
backup
Use backup to back up the images of a VM to a .vmb file in the specified path.
Syntax
In standalone mode:
backup vm slot slot-number vm-name backup-path
In IRF mode:
backup vm chassis chassis-number slot slot-number vm-name backup-path
Views
VMM view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
backup-path: Specifies the backup file path, a case-sensitive string of 1 to 63 characters.
Examples
# Back up VM centos7 to the specified path.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] backup vm slot 0 centos7 hda0:/VmImages/centos7.vmb
create-disk
Use create-disk to create a VM disk.
Syntax
create-disk disk-file size size format { raw | qcow2 }
Views
VMM view
Predefined user roles
network-admin
Parameters
disk-file: Specifies the disk file path, a case-sensitive string of 1 to 63 characters.
size size: Sets the maximum disk size, in GB. The value for the size argument must be an integer. The value range for this argument depends on the available amount of storage space on the device.
format: Specifies the disk format.
raw: Specifies the RAW format.
qcow2: Specifies the QCOW2 format.
Usage guidelines
Use the size size option to set the maximum amount of disk space that a VM can occupy. The actual amount of disk space occupied by the VM might differ from the configured value. If the disk format is RAW, the dir command displays the disk size configured for the VM. If the disk format is QCOW2, the dir command displays the disk size actually occupied by the VM.
Examples
# Create a disk in QCOW2 format.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] create-disk hda0:/centos7.qcow size 30 format qcow2
delete disk
Use delete disk to remove a disk from a VM.
Syntax
In standalone mode:
delete disk vm slot slot-number vm-name target target
In IRF mode:
delete disk vm chassis chassis-number slot slot-number vm-name target target
Views
VMM view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
target target: Specifies a disk by its name. The target argument is a case-sensitive string of three characters.
Examples
# Remove disk hdb from VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] delete disk vm slot 0 centos7 target hdb
delete vtap
Use delete vtap to remove a vTap NIC from a VM.
Syntax
In standalone mode:
delete vtap vm slot slot-number vm-name mac mac-address
In IRF mode:
delete vtap vm chassis chassis-number slot slot-number vm-name mac mac-address
Views
VMM view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
mac mac-address: Specifies a vTap NIC by its MAC address. The mac-address argument is a hexadecimal string in the format of xxxx-xxxx-xxxx.
Examples
# Delete a vTap NIC from VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] delete vtap vm slot 0 centos7 mac 0011-0111-1234
delete sriov
Use delete sriov to remove an SR-IOV NIC from a VM.
Syntax
In standalone mode:
delete sriov vm slot slot-number vm-name pf pfid
In IRF mode:
delete sriov vm chassis chassis-number slot slot-number vm-name pf pfid
Views
VMM view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
pf pfid: Specifies a physical NIC by its PF ID. The value for the pfid argument is 0 or 1.
Examples
# Delete PF 0 from VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] delete sriov vm slot 0 centos7 pf 0
display passthrough
Use display passthrough to display passthrough NIC information.
Syntax
In standalone mode:
display passthrough slot slot-number
In IRF mode:
display passthrough chassis chassis-number slot slot-number
Views
Any view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
Examples
# Display passthrough NIC information.
<Sysname> dis passthrough slot 0
PF???????? pciaddr???????? macaddr?????????????????????????????????????????????
--------------------------------------------------?????????????????????????????
0????????? 0000:03:00.0??? 00:02:00:03:00:05???????????????????????????????????
1????????? 0000:03:00.1??? 00:02:00:03:00:06
Table 1 Command output
Field |
Description |
PF |
PF ID of the physical NIC. |
pciaddr |
PCI address of the PF interface. |
macaddr |
MAC address of the NIC. |
display vcpu-pool
Use display vcpu-pool to display the number of CPU cores allocated to VMs.
Syntax
In standalone mode:
display vcpu-pool slot slot-number
In IRF mode:
display vcpu-pool chassis chassis-number slot slot-number
Views
Any view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
Examples
# Display the number of CPU cores allocated to VMs.
<Sysname> display vcpu-pool slot 0
CPU Pool for VMPlane is 1.
display vm
Use display vm to display VM information.
Syntax
In standalone mode:
display vm slot slot-number vm-name [ static-configuration ]
In IRF mode:
display vm chassis chassis-number slot slot-number vm-name [ static-configuration ]
Views
Any view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
static-configuration: Specifies the current configuration of the VM.
Examples
# Display information about VM centos7.
<Sysname> display vm slot 0 centos7
VM: centos7
? CPU count: 1
? Memory size: 1024000 KB
? Disks:
? ??Disk0: hda
???? capacity: 200 GB
???? path: /mnt/hda0:/he.qcow
? Interfaces:
??? Interface0: -
????? Type: ethernet
????? Mode: e1000
????? MAC: 5254-00f2-1aec
??? Interface1: PF0
????? Type: hostdev
????? Mode: -
????? MAC: 0010-1110-5881
? VNC port:
????????? :10? AutoStart: disabled
Table 2 Command output
Field |
Description |
VM |
VM name. |
CPU count |
Number of vCPUs on the VM. |
Memory size |
Memory size of the VM, in KB. |
Disks |
Disk information of the VM. |
Disk |
Disk number. The following values are available: · Disk0. · Disk1. · Disk2. · Disk3. |
path |
Disk file path of the VM. The path is on the slot that hosts the VM. |
capacity |
Disk capacity of the VM, in GB. |
Interfaces |
NIC information of the VM. |
Type |
NIC type of the VM. |
Mode |
NIC mode of the VM. |
MAC |
MAC address of the NIC. |
VNC port |
VNC port number of the VM. |
AutoStart |
Status of the auto-start feature: · Disabled. · Enabled. |
# Display the current configuration of VM centos7.
<Sysname> display vm slot 0 centos7 static-configuration
<!--
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
? virsh edit centos7
or other application using the libvirt API.
-->
<domain type='kvm'>
? <name>centos7</name>
? <uuid>85c9881e-ae7e-41c9-9f00-9de517733f83</uuid>
? <memory unit='KiB'>512000</memory>
? <currentMemory unit='KiB'>512000</currentMemory>
? <vcpu placement='static' cpuset='2-7'>1</vcpu>
? <os>
??? <type arch='x86_64' machine='pc-i440fx-1.7,accel=kvm,usb=off'>hvm</type>
??? <boot dev='hd'/>
??? <boot dev='cdrom'/>
??? <bootmenu enable='yes'/>
? </os>
? <features>
??? <acpi/>
? </features>
? <cpu mode='host-model'>
??? <model fallback='allow'/>
??? <topology sockets='8' cores='1' threads='1'/>
? </cpu>
? <clock offset='utc'/>
? <on_poweroff>destroy</on_poweroff>
? <on_reboot>restart</on_reboot>
? <on_crash>destroy</on_crash>
? <devices>
??? <emulator>/bin/qemu-system-x86_64</emulator>
??? <disk type='file' device='disk'>
????? <driver name='qemu' type='qcow2' cache='writethrough'/>
????? <source file='/mnt/sda1:/s0sda1.qcow'/>
????? <target dev='hda' bus='ide'/>
????? <address type='drive' controller='0' bus='0' target='0' unit='0'/>
??? </disk>
??? <controller type='usb' index='0'>
????? <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/
>
??? </controller>
??? <controller type='pci' index='0' model='pci-root'/>
??? <controller type='ide' index='0'>
????? <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/
>
??? </controller>
??? <controller type='virtio-serial' index='0'>
????? <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/
>
??? </controller>
??? <channel type='unix'>
????? <source mode='bind' path='/mnt/sda1:/centos7.agent'/>
????? <target type='virtio' name='org.qemu.guest_agent.0'/>
????? <address type='virtio-serial' controller='0' bus='0' port='1'/>
??? </channel>
??? <input type='tablet' bus='usb'/>
??? <input type='mouse' bus='ps2'/>
??? <input type='keyboard' bus='ps2'/>
??? <graphics type='vnc' port='5950' autoport='no' listen='0.0.0.0'>
????? <listen type='address' address='0.0.0.0'/>
??? </graphics>
??? <video>
????? <model type='cirrus' vram='16384' heads='1'/>
????? <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/
>
??? </video>
??? <memballoon model='virtio'>
????? <stats period='10'/>
????? <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/
>
??? </memballoon>
? </devices>
display vmcpupin
Use display vmcpupin to display the bindings between vCPUs and physical CPUs for a VM.
Syntax
In standalone mode:
display vmcpupin vm slot slot-number vm-name
In IRF mode:
display vmcpupin vm chassis chassis-number slot slot-number vm-name
Views
Any view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
Examples
# Display the bindings between vCPUs and physical CPUs for VM centos7.
<Sysname> dis vmcpupin vm slot 0 centos7
VCPU: CPU Affinity
----------------------------------
?? 0: 2-7
?? 1: 2-7
?? 2: 2-7
?? 3: 2-7
?? 4: 2-7
?? 5: 2-7
?? 6: 2-7
display vmcpu-usage
Use display vmcpu-usage to display CPU usage information about a VM.
Syntax
In standalone mode:
display vmcpu-usage vm slot slot-number vm-name
In IRF mode:
display vmcpu-usage vm chassis chassis-number slot slot-number vm-name
Views
Any view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
Examples
# Display CPU usage information about VM centos7.
<Sysname> dis vmcpu-usage vm slot 0 CentOS-7
CpuNum?????????????? Cpu-Usage
---------------------------------------
0??????????????????? 27%
Table 3 Command output
Field |
Description |
CpuNum |
CPU number. |
Cpu-Usage |
CPU usage. |
display vmdisklist
Use display vmdisklist to display the disk list of a VM.
Syntax
In standalone mode:
display vmdisklist vm slot slot-number vm-name
In IRF mode:
display vmdisklist vm chassis chassis-number slot slot-number vm-name
Views
Any view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
Examples
# Display the disk list of VM centos7.
<Sysname> display vmdisklist vm slot 0 centos7
Target???? Source
------------------------------------------------
hda??????? /mnt/hda0:/test1.qcow
Table 4 Command output
Field |
Description |
Target |
Disk name. |
Source |
Disk file path on the slot that hosts the VM. |
display vmdisk-usage
Use display vmdisk-usage to display information about the raw storage used by a VM.
Syntax
In standalone mode:
display vmdisk-usage vm slot slot-number vm-name
In IRF mode:
display vmdisk-usage vm chassis chassis-number slot slot-number vm-name
Views
Any view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
Usage guidelines
To view actual storage usage of a VM, use VNC Viewer to access the VM.
Examples
# Display disk usage information about VM centos7.
<Sysname> dis vmdisk-usage vm slot 0 centos7
Target????????? Capacity(KB)?????? Blk-Used(KB)?????? Usage
------------------------------------------------------------
hda???????????? 32212254720 ???????4659224576 ????????14%
hdc???????????? 4148080640 ????????4148084736 ????????100%
Table 5 Command output
Field |
Description |
Target |
Disk name. |
Capacity |
Raw disk capacity, in KB. |
Blk-Used |
Amount of used raw storage, in KB. |
Usage |
Disk usage in percentage. |
display vminterface
Use display vminterface to display network interface information about a VM.
Syntax
In standalone mode:
display vminterface vm slot slot-number vm-name
In IRF mode:
display vminterface vm chassis chassis-number slot slot-number vm-name
Views
Any view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
Examples
# Display network interface information about VM centos7.
<Sysname> display vminterface vm slot 0 centos7
Interface? Type?????? Model?????? MAC
-----------------------------------------------------------
VMEth0/0/0 ethernet?? e1000?????? 0003-0004-000c
PF0??????? hostdev??? -?????????? 0003-0004-0006
Table 6 Command output
Field |
Description |
Interface |
Name of the network interface. |
Type |
Type of the network interface. |
Model |
vTap NIC mode. |
MAC |
MAC address of the VM NIC. |
display vmlist
Use display vmlist to display the VM list.
Syntax
In standalone mode:
display vmlist [ slot slot-number ]
In IRF mode:
display vmlist [ chassis chassis-number slot slot-number ]
Views
Any view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
Usage guidelines
The list displays VMs in startup order. The lower the ID, the earlier the VM starts up.
In standalone node, this command displays all VMs on the router if you do not specify a slot.
In IRF mode, this command displays all VMs on the IRF fabric if you do not specify a slot.
Examples
# Display the VM list.
<Sysname> display vmlist
Slot 0:????????????????????????????????????????????????????????????????????????
?Id??? Name??????????????? ???????????State????????????????????????????????????
----------------------------------------------------???????????????????????????
?-???? centos???????????????????????? running?????????????????????????????????
?-???? vfw??????????????????????????? shut off?????????????????????????????????
Slot 1:????????????????????????????????????????????????????????????????????????
?Id??? Name?????????????????????????? State????????????????????????????????????
----------------------------------------------------? ??????????????????????????
?-???? vfw?? ?????????????????????????shut off?????????????????????????????????
?-???? vfw1?????????????????????????? shut off?????????????????????????????????
?-???? win?? ?????????????????????????shut off?????????????????????????????????
Table 7 Command output
Field |
Description |
Id |
VM ID in the list. |
Name |
VM name. |
State |
VM operating state: · Running—The VM is operating. · Paused—The VM is suspended. · Shutoff—The VM is stopped. |
display vmmem-usage
Use display vmmem-usage to display the memory usage of a VM.
Syntax
In standalone mode:
display vmmem-usage vm slot slot-number vm-name
In IRF mode:
display vmmem-usage vm chassis chassis-number slot slot-number vm-name
Views
Any view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
Usage guidelines
This command is supported only on systems that support the virtio driver.
Release versions of the Linux operating system support the memballon virtio driver of the guest OS. On the Windows operating system, you need to install a separate virtio driver. The vFW does not support the virtio driver.
Examples
# Display the memory usage of VM centos7.
<Sysname> display vmmem-usage vm slot 0 centos7
Total??????????????? Used?????????????? Mem-usage
----------------------------------------------------------
2973036????????????? 82988??????????????? 3%
Table 8 Command output
Field |
Description |
Total |
Total amount of memory on the VM. |
Used |
Amount of memory in use. |
Mem-usage |
Memory usage in percentage. |
display vncport
Use display vncport to display the VNC port number of a VM.
Syntax
In standalone mode:
display vncport vm slot slot-number vm-name
In IRF mode:
display vncport vm chassis chassis-number slot slot-number vm-name
Views
Any view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
Examples
# Display the VNC port number of a VM.
<Sysname> display vncport vm slot 0 centos7
:12
export
Use export to export the images of a VM to a .pkg file.
Syntax
In standalone mode:
export vm slot slot-number vm-name pkg-path
In IRF mode:
export vm chassis chassis-number slot slot-number vm-name pkg-path
Views
VMM view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
pkg-path: Specifies the absolute path of the .pkg file, a case-sensitive string of 1 to 63 characters.
Examples
# Export VM centos7 to hda0:/ on slot 0.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] export vm slot 0 centos7 hda0:/centos7.pkg
install vm-name
Use install vm-name to install a VM based on the specified parameters.
Syntax
In standalone mode:
install slot slot-number vm-name vm-name vcpu vcpu-count memory size vncport vncport disk disk-file format { raw | qcow2 } [ cdrom cdrom-file ] [ vnic { vtap [ mac mac-address ] [ vlan vlan-id ] | sriov pf pfid } ]
In IRF mode:
install chassis chassis-number slot slot-number vm-name vm-name vcpu vcpu-count memory size vncport vncport disk disk-file format { raw | qcow2 } [ cdrom cdrom-file ] [ vnic { vtap [ mac mac-address ] [ vlan vlan-id ] | sriov pf pfid } ]
Views
VMM view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vm-name vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
vcpu vcpu-count: Sets the number of vCPUs allocated to the VM. The value range for the vcpu-count argument depends on the number of CPUs on the device.
memory size: Sets the size of memory allocated to the VM, in KB. The value range for the size argument depends on the memory size of the device.
vncport vncport: Sets the number of the VNC port, in the range of 0 to 99.
disk disk-file: Specifies the disk file path of the VM. The disk-file argument is a case-sensitive string of up to 63 characters.
raw: Sets the disk format to RAW.
qcow2: Sets the disk format to QCOW2.
vnic: Configures the virtual NIC of the VM.
sriov: Specifies the SR-IOV type of NIC for the VM.
vtap: Specifies the vTap type of NIC for the VM. This type of NIC is virtualized by software.
cdrom cdrom-file: Specifies the VM system image file path. The cdrom-file argument is a case-sensitive string of 1 to 63 characters.
mac mac-address: Specifies the MAC address of the NIC. The mac-address argument is a hexadecimal string in the format of xxxx-xxxx-xxxx.
vlan vlan-id: Specifies the VLAN to which the NIC belongs. The value range for the vlan-id argument is 1 to 4094.
pf pfid: Specifies a physical SR-IOV NIC by its PF ID. The value for the pfid argument is 0 or 1.
Usage guidelines
Before you add a disk to a VM, you must use the create-disk command to create the disk.
Examples
# Install a VM based on the specified parameters.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] install slot 0 vm-name centos7 vcpu 1 memory 1048576 vncport 12 disk hda0:/centos7.qcow format qcow2 cdrom hda0:/centos7.iso vnic vtap mac 0010-1110-5872 vlan 21
install vm-pkg
Use install vm-pkg to install a VM based on the parameters in the specified .pkg file.
Syntax
In standalone mode:
install slot slot-number vm-pkg pkg-path
In IRF mode:
install chassis chassis-number slot slot-number vm-pkg pkg-path
Views
VMM view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
pkg-path: Specifies the absolute path of the .pkg file, a case-sensitive string of 1 to 63 characters.
Usage guidelines
Prepare the .pkg file before you use the file to install a VM. You can use the export command to export .pkg files.
Examples
# Install a VM based on the specified .pkg file.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] install slot 0 vm-pkg hda0:/VmImages/CentOS-7.pkg
restore pakagepath
Use restore pakagepath to restore a VM based on a .vmb VM backup file in the specified path.
Syntax
In standalone mode:
restore slot slot-number pakagepath backup-image-path
In IRF mode:
restore chassis chassis-number slot slot-number pakagepath backup-image-path
Views
VMM view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
backup-image-path: Specifies the absolute path of the VM backup file, a case-sensitive string of 1 to 63 characters.
Examples
# Restore a VM based on the specified VM backup file.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] restore slot 0 pakagepath usba0:/VmImages/centos7.vmb
resume
Use resume to resume a suspended VM.
Syntax
In standalone mode:
resume vm slot slot-number vm-name
In IRF mode:
resume vm chassis chassis-number slot slot-number vm-name
Views
VMM view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
Examples
# Resume VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] resume vm slot 0 centos7
set cdrom
Use set cdrom to specify the path of the system image file for a VM.
Syntax
In standalone mode:
set cdrom vm slot slot-number vm-name cdrom-file cdrom-file
In IRF mode:
set cdrom vm chassis chassis-number slot slot-number vm-name cdrom-file cdrom-file
Views
VMM view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
cdrom-file cdrom-file: Specifies the path of the system image file. The cdrom-file argument is a case-sensitive string of 1 to 63 characters.
Examples
# Specify hda0:/centos7.iso as the path of the system image file for VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] set cdrom vm slot 0 centos7 cdrom-file hda0:/centos7.iso
set memory
Use set memory to allocate memory to a VM.
Syntax
In standalone mode:
set memory vm slot slot-number vm-name size size
In IRF mode:
set memory vm chassis chassis-number slot slot-number vm-name size size
Views
VMM view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
size size: Sets the size of the VM memory, in KB. The value range for the size argument depends on the memory size of the device.
Examples
# Allocate 1048576 KB of memory to VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] set memory vm slot 0 centos7 size 1048576
set vcpupin
Use set vcpupin to bind a vCPU on a VM to a physical CPU on the device.
Syntax
In standalone mode:
set vcpupin vm slot slot-number vmname vcpuindex vcpuindex cpuindex cpuindex
In IRF mode:
set vcpupin vm chassis chassis-number slot slot-number vmname vcpuindex vcpuindex cpuindex cpuindex
Views
VMM view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vmname: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
vcpuindex vcpu-index: Specifies a vCPU by its index.
cpuindex cpuindex: Specifies a physical CPU by its index.
Examples
# Bind vCPU 0 on VM centos7 to physical CPU 2.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] set vcpupin vm slot 0 centos7 vcpuindex 0 cpuindex 2
set vcpu
Use set vcpu to set the number of vCPUs allocated to a VM.
Syntax
In standalone mode:
set vcpu vm slot slot-number vm-name vcpu-count vcpu-count
In IRF mode:
set vcpu vm chassis chassis-number slot slot-number vm-name vcpu-count vcpu-count
Views
VMM view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
vcpu-count vcpu-count: Sets the number of vCPUs. The value range for the vcpu-count argument depends on the number of CPUs on the device.
Examples
# Set the number of vCPUs to 2 for VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] set vcpu vm slot 0 centos7 vcpu-count 2
set vcpu-pool
Use set vcpu-pool to set the total number of CPU cores allocated to the VM plane.
Syntax
In standalone mode:
set vcpu-pool slot slot-number vcpu-number
In IRF mode:
set vcpu-pool chassis chassis-number slot slot-number vcpu-number
Views
System view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vcpu-number: Set the total number of CPU cores allocated to the VM plane. The number depends on the number of CPU cores on the device.
Usage guidelines
For the configuration to take effect, you must reboot the device. If you set the number to 0, VMs will be inaccessible after the device reboots.
Examples
# Allocate two CPU cores to the VM plane.
<Sysname> system-view
[Sysname] set vcpu-pool slot 0 2
VCPU pool changed, please reconfig vcpu-pin for each virtual machine and reboot the router.
set vnc
Use set vnc to configure the VNC parameters for connecting to a VM.
Syntax
In standalone mode:
set vnc vm slot slot-number vm-name { vncport vncport | delpasswd | listen ip-address | setpasswd password }
In IRF mode:
set vnc vm chassis chassis-number slot slot-number vm-name { vncport vncport | delpasswd | listen ip-address | setpasswd password }
Views
VMM view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
vncport vncport: Sets the VNC port number, in the range of 0 to 99.
setpassword password: Sets the VNC login password. The password argument is a case-sensitive string of 6 to 15 characters.
listen ip-address: Specifies an IP address on the device for connecting to the VM. If you specify 0.0.0.0, any IP address on the device can be used to connect to the VM.
delpasswd: Deletes the VNC login password.
Examples
# Configure VNC parameters for VM CentOS-7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] set vnc vm slot 0 CentOS-7 vncport 12
[Sysname-vmm] set vnc vm slot 0 CentOS-7 setpasswd 12344556
[Sysname-vmm] set vnc vm slot 0 CentOS-7 delpasswd
[Sysname-vmm] set vnc vm slot 0 CentOS-7 listen 172.33.3.158
set vtap
Use set vtap to specify the VLAN to which a vTap interface belongs.
Syntax
In standalone mode:
set vtap vm slot slot-number vm-name mac mac-address vlan vlan-id
In IRF mode:
set vtap vm chassis chassis-number slot slot-number vm-name mac mac-address vlan vlan-id
Views
VMM view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
mac mac-address: Specifies a vTap NIC by its MAC address. The mac-address argument is a hexadecimal string in the format of xxxx-xxxx-xxxx.
vlan vlan-id: Specifies a VLAN by its VLAN ID. The value range for the vlan-id argument is 1 to 4094.
Examples
# Assign the vTap interface of VM centos7 to VLAN 10.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] set vtap vm slot 0 centos7 mac 5254-00f2-1aec vlan 10
start
Use start to start a VM.
Syntax
In standalone mode:
start vm slot slot-number vm-name
In IRF mode:
start vm chassis chassis-number slot slot-number vm-name
Views
VMM view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
Usage guidelines
Make sure the VM you want to start has been created on the device and the system has sufficient memory to start the VM.
Besides allocating memory to VMs, the system needs to allocate some amount of memory to run the VM plane. As a best practice to make sure the system has sufficient memory to run the VM plane, adjust the amount of memory allocated to VMs to a small number if multiple VMs start. If the memory is insufficient, the system automatically shuts off the VM that occupies the most amount of memory.
Examples
# Start VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] start vm slot 0 centos7
stop
Use stop to stop a VM.
Syntax
In standalone mode:
stop vm slot slot-number vm-name [ force ]
In IRF mode:
stop vm chassis chassis-number slot slot-number vm-name [ force ]
Views
VMM view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
force: Forcibly stops the VM.
Usage guidelines
CAUTION: A force stop might cause data loss. Do not force a VM down unless necessary. |
If a VM fails to stop because of an abnormal process, access the VM, manually close the process, and retry the stop operation.
If the VM does not have an operating system, you must specify the force keyword to force it down.
Examples
# Stop VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] stop vm slot 0 centos7
suspend
Use suspend to suspend a VM.
Syntax
In standalone mode:
suspend vm slot slot-number vm-name
In IRF mode:
suspend vm chassis chassis-number slot slot-number vm-name
Views
VMM view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
Examples
# Suspend VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] suspend vm slot 0 centos7
uninstall
Use uninstall to uninstall a VM.
Syntax
In standalone mode:
uninstall vm slot slot-number vm-name
In IRF mode:
uninstall vm chassis chassis-number slot slot-number vm-name
Views
VMM view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID.
slot slot-number: Specifies an MPU by its slot number.
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
Usage guidelines
You must stop a VM before you can uninstall it.
Examples
# Uninstall VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] uninstall vm slot 0 centos7
Related commands
install
stop
vmm
Use vmm to enter virtual machine management (VMM) view from system view.
Syntax
vmm
Views
System view
Predefined user roles
network-admin
Examples
# Enter VMM view.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm]