- Table of Contents
- Related Documents
-
Title | Size | Download |
---|---|---|
02-VM commands | 180.00 KB |
Contents
VM commands
This feature is supported only on the following MSR routers:
· MSR3610-I-DP.
· MSR3610-I-XS.
· MSR3610-IE-DP.
· MSR3610-IE-XS.
· MSR3610-IE-ES.
· MSR3610-IE-EAD.
To ensure correct operation of VMs, make sure the storage medium where the VMs are installed has sufficient storage space.
If removable hard disks or USB flash drives are used, make sure their file system format is EXT4.
add cdrom vm
Use add cdrom vm to add an operating system image or driver image to a VM.
Syntax
add cdrom vm vm-name cdrom-file cdrom-file
Views
VMM view
Predefined user roles
network-admin
Parameters
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 image file path. The cdrom-file argument is a case-sensitive string of 1 to 63 characters. The file must be an .iso file.
Usage guidelines
The device supports a maximum of four CD-ROMs. CD-ROMs can contain operating system image files or hardware driver image files.
The CD-ROMs and IDE disks share drive names hda, hdb, hdc, and hdd. When you add a CD-ROM or IDE disk to a VM, the VM randomly assigns a drive name to the CD-ROM or IDE disk.
If you use this command on a running VM, you must restart the VM for the configuration to take effect. If you use this command on a stopped VM, the configuration takes effect after you start the VM.
Before using a newly added CD-ROM, specify a boot order number for it. CD-ROMs that contain operating system image files always have higher boot priority that those containing hardware driver image files. The same type of CD-ROMs boot according to the priority of their boot order numbers.
If you do not change the boot disk or uninstall the images of a CD-ROM after the CD-ROM is installed, the CD-ROM will no longer be used for booting.
When a VM is deployed, the VM automatically assigns a boot order number of 8 to the CD-ROM that contains the operating system image file. To replace the operating system images, perform the following operations:
1. Add a new CD-ROM that contains the new operating system image file.
2. Set the boot order of the new CD-ROM to take precedence over that of the original CD-ROM.
3. (Optional.) Add a new hard disk as the boot disk of the VM.
Alternatively, you can remove the CD-ROM that contains the current operating system image file and add the CD-ROM that contains the new operating system image file to the VM.
For more information about boot order configuration, see "set bootorder vm." To view the disk boot order, use the display vmdisklist command.
Examples
# Add an operating system image to VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] add cdrom vm centos7 cdrom-file hda0:/centos7.iso
Related commands
display vmdisklist
set bootorder vm
add disk vm
Use add disk vm to add a disk to a VM.
Syntax
add disk vm vm-name format { raw | qcow2 } disk-file path-file disk-bus { ide | virtio }
Views
VMM view
Predefined user roles
network-admin
Parameters
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 string of 1 to 63 characters. The file must be a .qcow2 or .raw file.
disk-bus: Specifies the disk bus type.
ide: Specifies the Integrated Device Electronics (IDE) bus type.
virtio: Specifies the virtio bus type. For some operating systems (for example, Windows Server 2008/2012 or FreeBsd), you must install a driver for this bus type.
Usage guidelines
Before you add a disk to a VM, you must use the create-disk command to create the disk.
After you add a disk to a VM, you must partition and format that disk on the guest OS before you can use it.
A VM supports the following bus types of disks:
· IDE—IDE disks and CD-ROMs share disk drive names hda, hdb, hdc, and hdd. The VM randomly assigns a drive name to an IDE disk or CD-ROM.
· Virtio—The drive names of virtio disks are vda, vdb, vdc, and vdd. The VM randomly assigns a drive name to a virtio disk.
A VM supports a maximum of four disks for each bus type. However, a vFW VM supports only one disk.
When a VM is deployed, the VM automatically assigns a boot order number of 1 to its boot disk. To change the boot disk, you can perform the following operations:
1. (Optional.) Add a new disk to the VM.
2. Modify the boot order number of the original boot disk.
3. Assign the new boot disk a boot order number that has higher priority than that of the original boot disk.
For more information about boot order configuration, see "set bootorder vm." To view the disk boot order, use the display vmdisklist command.
If you add a disk to a VM on a running VM, you must restart the VM for the configuration to take effect. If you add a disk to a VM on a stopped VM, the configuration takes effect after you start the VM.
Examples
# Add a disk in QCOW2 format to VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] create-disk hda0:/centos.qcow size 30 format qcow2
[Sysname-vmm] add disk vm centos7 format qcow2 disk-file hda0:/centos.qcow disk-bus ide
Related commands
create-disk
display vmdisklist
set bootorder vm
add sriov vm
Use add sriov vm to assign an SR-IOV NIC to a VM.
Syntax
In passthrough mode:
add sriov vm vm-name pf pfid
In SR-IOV share mode:
add sriov vm vm-name pf pfid vf vfid [ vlan vlan-id ]
Views
VMM view
Predefined user roles
network-admin
Parameters
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.
vf vfid: Specifies a vNIC by its VF ID. The value range for the vfid argument is 0 to 7.
vlan vlan-id: Specifies a VLAN for the VF interface. The value range for the vlan-id argument is 1 to 4094.
Usage guidelines
For an SR-IOV NIC to operate on a VM, you must install an SR-IOV NIC driver on the VM.
If you use this command on a running VM, you must restart the VM for the configuration to take effect. If you use this command on a stopped VM, the configuration takes effect after you start the VM.
Examples
# In SR-IOV share mode, assign VF 0 as an SR-IOV NIC to VM centos7 and assign the NIC to VLAN 10.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] add sriov vm centos7 pf 0 vf 0 vlan 10
add vtap vm
Use add vtap vm to add a vTap NIC to a VM.
Syntax
add vtap vm vm-name mac mac-address [ vlan vlan-id ]
Views
VMM view
Predefined user roles
network-admin
Parameters
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. The Comware system has reserved eight MAC addresses for vTap NICs. To obtain the MAC addresses, use the add vtap vm vm-name mac ? command.
vlan vlan-id: Specifies a VLAN for the vTap interface. The value range for the vlan-id argument is 1 to 4094.
Usage guidelines
You can add a vTap NIC only to one VM. To display the MAC addresses of NICs that have been added to a VM, use the display vminterface command.
If you add a vTap NIC to a VM on a running VM, you must restart the VM for the configuration to take effect. If you add a vTap NIC to a VM on a stopped VM, the configuration takes effect after you start the VM.
Examples
# Add a vTap NIC to VM centos7 and the MAC address of the NIC is 0010-1110-5872. Assign the NIC to VLAN 10.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] add vtap vm centos7 mac 0010-1110-5872 vlan 10
Related commands
display vminterface
autostart vm
Use autostart vm to enable auto-start for a VM.
Use undo autostart vm to disable auto-start for a VM.
Syntax
autostart vm vm-name
undo autostart vm vm-name
Default
Auto-start is disabled for a VM.
Views
VMM view
Predefined user roles
network-admin
Parameters
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
Usage guidelines
If you use this command on a running VM, you must restart the VM for the configuration to take effect. If you use this command on a stopped VM, the configuration takes effect after you start the VM.
Examples
# Enable auto-start for VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] autostart vm centos7
backup vm
Use backup vm to back up the images of a VM to a .vmb file in the specified path.
Syntax
backup vm vm-name backup-path
Views
VMM view
Predefined user roles
network-admin
Parameters
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. The file must be a .vmb file.
Usage guidelines
Make sure the file path is correct and the target storage medium has sufficient storage space.
If a USB flash drive is used to store the backup file, make sure the file system format of the USB flash drive is EXT4.
You must stop a VM by using the stop vm command before you can back up it.
Examples
# Back up VM centos7 to the specified path.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] backup vm centos7 hda0:/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. The file must be a .qcow2 or .raw file.
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:/centos.qcow size 30 format qcow2
delete disk vm
Use delete disk vm to remove a disk or CD-ROM from a VM.
Syntax
delete disk vm vm-name target target
Views
VMM view
Predefined user roles
network-admin
Parameters
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 or CD-ROM by its drive name. The target argument is a case-sensitive string of three characters.
Usage guidelines
If you use this command on a running VM, you must restart the VM for the configuration to take effect. If you use this command on a stopped VM, the configuration takes effect after you start the VM.
Removing a disk or CD-ROM from a VM does not delete the disk or delete the image files uploaded by the CD-ROM. To release storage space, you must use the delete command to manually delete the disk or the image files. For more information, see file system management in Fundamentals Configuration Guide.
Examples
# Remove disk hdb from VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] delete disk vm centos7 target hdb
delete sriov vm
Use delete sriov vm to remove an SR-IOV NIC from a VM.
Syntax
In passthrough mode:
delete sriov vm vm-name pf pfid
In SR-IOV share mode:
delete sriov vm vm-name pf pfid vf vfid
Views
VMM view
Predefined user roles
network-admin
Parameters
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.
vf vfid: Specifies a vNIC by its VF ID. The value range for the vfid argument is 0 to 7.
Usage guidelines
If you use this command on a running VM, you must restart the VM for the configuration to take effect. If you use this command on a stopped VM, the configuration takes effect after you start the VM.
To obtain the ID of the PF or VF to be removed, use the display vminterface command.
Examples
# Remove VF 0 from VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] delete sriov vm centos7 pf 0 vf 0
Related commands
display vminterface
delete vtap vm
Use delete vtap vm to remove a vTap NIC from a VM.
Syntax
delete vtap vm vm-name mac mac-address
Views
VMM view
Predefined user roles
network-admin
Parameters
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.
Usage guidelines
If you use this command on a running VM, you must restart the VM for the configuration to take effect. If you use this command on a stopped VM, the configuration takes effect after you start the VM.
To obtain the MAC address of a vTap NIC to be removed, use the display vminterface command.
Examples
# Remove a vTap NIC from VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] delete vtap vm centos7 mac 0010-1110-5872
Related commands
display vminterface
display comware-memory
Use display comware-memory to display the minimum amount of physical memory available for the Comware system.
Syntax
display comware-memory
Views
Any view
Predefined user roles
network-admin
Usage guidelines
This command is supported only on the following MSR routers:
· MSR3610-I-DP.
· MSR3610-I-XS.
· MSR3610-IE-DP.
· MSR3610-IE-XS.
Examples
# Display the minimum amount of physical memory available for the Comware system.
<Sysname> display comware-memory
Current comware reserved memory size is 3GB.
Next comware reserved memory size is 2GB.
Related commands
set comware-memory
display passthrough
Use display passthrough to display NIC information in SR-IOV passthrough mode.
Syntax
display passthrough
Views
Any view
Predefined user roles
network-admin
Usage guidelines
Make sure the physical NIC network mode is passthrough when you use this command.
Examples
# Display NIC information in SR-IOV passthrough mode.
<Sysname> display passthrough
PF pciaddr macaddr
--------------------------------------------------
0 0000:03:00.0 80:48:c9:00:00:02
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. |
Related commands
vm network-mode
display sriov
Use display sriov to display NIC information in SR-IOV share mode.
Syntax
display sriov
Views
Any view
Predefined user roles
network-admin
Usage guidelines
Make sure the physical NIC network mode is SR-IOV share when you use this command.
Examples
# Display NIC information in SR-IOV share mode.
<Sysname> display sriov
PF VF vlan pciaddr macaddr
-------------------------------------------------------------------------
0 0 - 0000:03:10.0 00:10:11:10:58:7a
0 1 - 0000:03:10.2 00:10:11:10:58:7b
0 2 - 0000:03:10.4 00:10:11:10:58:7c
0 3 - 0000:03:10.6 00:10:11:10:58:7d
0 4 - 0000:03:11.0 00:10:11:10:58:7e
0 5 - 0000:03:11.2 00:10:11:10:58:7f
0 6 - 0000:03:11.4 00:10:11:10:58:80
0 7 - 0000:03:11.6 00:10:11:10:58:81
Table 2 Command output
Field |
Description |
PF |
PF ID of the physical NIC. |
VF |
VF ID of the vNIC. |
vlan |
VLAN to which the vNIC belongs. |
pciaddr |
PCI address of the vNIC. |
macaddr |
MAC address of the vNIC. |
display vcpu-pool
Use display vcpu-pool to display the number of CPU cores allocated to VMs.
Syntax
display vcpu-pool
Views
Any view
Predefined user roles
network-admin
Examples
# Display the number of CPU cores allocated to VMs.
<Sysname> display vcpu-pool
Current CPU Pool for VMPlane is 6.
Next CPU Pool for VMPlane is 6.
display vm
Use display vm to display detailed VM information.
Syntax
display vm [ vm-name [ static-configuration ] ]
Views
Any view
Predefined user roles
network-admin
Parameters
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters. If you do not specify a VM, this command displays detailed information about all VMs.
static-configuration: Specifies the configuration that will take effect at the next VM startup.
Examples
# Display information about all VMs.
<Sysname> display vm
VM: centos7
CPU count: 1
Memory size: 1024000 KB
Disks:
Disk0: hda
capacity: 30 GB
path: /mnt/hda0:/centos.qcow
Interfaces:
Interface0: VMEth0/9
Type: ethernet
Mode: e1000
MAC: 0010-1110-5872
Interface1: PF0/VF0
Type: hostdev
Mode: -
MAC: 0010-1110-587a
VNC port:
:12
AutoStart: disabled
VM: winserver2012
CPU count: 2
Memory size: 2048000 KB
Disks:
Disk0: vda
capacity: 30 GB
path: /mnt/hda0:/winserver.qcow2
Disk1: hdc
capacity: 89 MB
path: /mnt/hda0:/winserver2012.iso
Interfaces:
Interface0: VMEth0/10
Type: ethernet
Mode: e1000
MAC: 0255-0255-0261
VNC port:
:10
AutoStart: disabled
# Display information about VM centos7.
<Sysname> display vm centos7
VM: centos7
CPU count: 1
Memory size: 1024000 KB
Disks:
Disk0: hda
capacity: 30 GB
path: /mnt/hda0:/centos.qcow
Interfaces:
Interface0: -
Type: ethernet
Mode: e1000
MAC: 0010-1110-5872
Interface1: PF0/VF0
Type: hostdev
Mode: -
MAC: 0010-1110-587a
VNC port:
:12
AutoStart: disabled
Table 3 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 or CD-ROM drive name. The following values are available: · hda, hdb, hdc, and hdd. · vda, vdb, vdc, and vdd. |
path |
Disk file path of 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 vmcpupin
Use display vmcpupin to display the bindings between vCPUs and physical CPUs for a VM.
Syntax
display vmcpupin vm [ vm-name ]
Views
Any view
Predefined user roles
network-admin
Parameters
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters. If you do not specify a VM, this command displays the bindings between vCPUs and physical CPUs for all VMs.
Examples
# Display the bindings between vCPUs and physical CPUs for all VMs.
<Sysname> display vmcpupin
VM: centos7
VCPU: CPU Affinity
----------------------------------
0: 2-7
VM: winserver2012
VCPU: CPU Affinity
----------------------------------
0: 2-7
1: 2-7
# Display the bindings between vCPUs and physical CPUs for VM centos7.
<Sysname> display vmcpupin vm centos7
VCPU: CPU Affinity
----------------------------------
0: 2-7
Table 4 Command output
Field |
Description |
VCPU |
vCPU core number. |
CPU Affinty |
Physical CPU core number. |
display vmcpu-usage vm
Use display vmcpu-usage vm to display CPU usage information about a VM.
Syntax
display vmcpu-usage vm vm-name
Views
Any view
Predefined user roles
network-admin
Parameters
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
Usage guidelines
Use this command only for a running VM.
Examples
# Display CPU usage information about VM centos7.
<Sysname> display vmcpu-usage vm centos7
CpuNum Cpu-Usage
---------------------------------------
0 27%
Table 5 Command output
Field |
Description |
CpuNum |
CPU number. |
Cpu-Usage |
CPU usage. |
display vmdisklist
Use display vmdisklist to display disk and CD-ROM information for a VM.
Syntax
display vmdisklist [ vm vm-name ]
Views
Any view
Predefined user roles
network-admin
Parameters
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters. If you do not specify a VM, this command displays disk and CD-ROM information for all VMs.
Examples
# Display disk and CD-ROM information for all VMs.
<Sysname> display vmdisklist
VM: centos7
Device Target BootOrder Source
-----------------------------------------------------------
disk hda 1 /mnt/hda0:/centos.qcow2
VM: winserver2012
Device Target BootOrder Source
-----------------------------------------------------------
disk vda 1 /mnt/hda0:/winserver.qcow2
cdrom hdc 8 /mnt/hda0:/winserver2012.iso
# Display disk and CD-ROM information for VM winserver2012.
<Sysname> display vmdisklist vm winserver2012
Device Target BootOrder Source
-----------------------------------------------------------
disk vda 1 /mnt/hda0:/winserver.qcow2
cdrom hdc 8 /mnt/hda0:/winserver2012.iso
Table 6 Command output
Field |
Description |
Device |
Disk or CD-ROM. |
Target |
Disk or CD-ROM drive name. |
BootOrder |
Boot order number. The lower the value, the higher the boot priority. |
Source |
Disk or CD-ROM file path. |
display vmdisk-usage vm
Use display vmdisk-usage vm to display information about the raw storage that a VM occupies on the router.
Syntax
display vmdisk-usage vm vm-name
Views
Any view
Predefined user roles
network-admin
Parameters
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
Usage guidelines
Use this command only for a running VM.
To view actual storage usage of a VM, use VNC Viewer to access the VM.
Examples
# Display disk usage information about VM centos7.
<Sysname> display vmdisk-usage vm centos7
Target Capacity(KB) Blk-Used(KB) Usage
------------------------------------------------------------
hda 32212254720 4659224576 14%
hdc 4148080640 4148084736 100%
Table 7 Command output
Field |
Description |
Target |
Disk drive 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 for a VM.
Syntax
display vminterface [ vm vm-name ]
Views
Any view
Predefined user roles
network-admin
Parameters
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters. If you do not specify a VM, this command displays network interface information for all VMs.
Examples
# Display network interface information for all VMs.
<Sysname> display vminterface
VM: centos7
Interface Type Model MAC
---------------------------------------------------
VMEth0/9 ethernet e1000 0010-1110-5872
PF0/VF0 hostdev - 0010-1110-587a
VM: winserver2012
Interface Type Model MAC
---------------------------------------------------
VMEth0/10 ethernet e1000 0255-0255-0261
# Display network interface information for VM centos7.
<Sysname> display vminterface vm centos7
Interface Type Model MAC
---------------------------------------------------
VMEth0/9 ethernet e1000 0010-1110-5872
PF0/VF0 hostdev - 0010-1110-587a
Table 8 Command output
Field |
Description |
Interface |
Name of the network interface. |
Type |
Type of the network interface. |
Model |
NIC mode. |
MAC |
MAC address of the VM NIC. |
display vmlist
Use display vmlist to display the VM list.
Syntax
display vmlist
Views
Any view
Predefined user roles
network-admin
Examples
# Display the VM list.
<Sysname> display vmlist
Id Name Status
------------------------------------------
1 centos7 running
2 winserver2012 shutoff
Table 9 Command output
Field |
Description |
Id |
VM ID in the list. |
Name |
VM name. |
Status |
VM operating state: · running—The VM is operating. · paused—The VM is suspended. · shutoff—The VM is stopped. |
display vmmem-usage vm
Use display vmmem-usage vm to display the memory usage of a VM.
Syntax
display vmmem-usage vm vm-name
Views
Any view
Predefined user roles
network-admin
Parameters
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 centos7
Total Used Mem-usage
----------------------------------------------------------
2973036 82988 3%
Table 10 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 vm-network-mode
Use display vm-network-mode to display the physical NIC network mode for VMs.
Syntax
display vm-network-mode
Views
Any view
Predefined user roles
network-admin
Examples
# Display the physical NIC network mode for VMs.
<Sysname> display vm-network-mode
vm networkmode: sr-iov
Table 11 Command output
Field |
Description |
vm networkmode |
Physical NIC network mode for VMs: · passthrough—Passthrough mode. · sr-iov—SR-IOV share mode. |
display vncport vm
Use display vncport vm to display the VNC port number of a VM.
Syntax
display vncport vm vm-name
Views
Any view
Predefined user roles
network-admin
Parameters
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
Usage guidelines
Use this command only for a running VM.
Examples
# Display the VNC port number of a VM.
<Sysname> display vncport vm centos7
:12
export vm
Use export vm to export the images of a VM to a .pkg file.
Syntax
export vm vm-name pkg-path
Views
VMM view
Predefined user roles
network-admin
Parameters
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.
Usage guidelines
Make sure you have access permissions to the target path and the target path has sufficient storage space.
If the .pkg file is saved on a USB flash drive, make sure the file system format of the USB flash drive is EXT4.
You must stop a VM by using the stop vm command before you can export it.
Examples
# Export VM centos7 to hda0:/.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] export vm centos7 hda0:/centos7.pkg
install vm-name
Use install vm-name to install a VM based on the specified parameters.
Syntax
In passthrough mode:
install vm-name vm-name vcpu vcpu-count memory size vncport vncport disk disk-file format { raw | qcow2 } disk-bus { ide | virtio } [ cdrom cdrom-file ] [ vnic { vtap [ mac mac-address ] [ vlan vlan-id ] | sriov pf pfid } ]
In SR-IOV share mode:
install vm-name vm-name vcpu vcpu-count memory size vncport vncport disk disk-file format { raw | qcow2 } disk-bus { ide | virtio } [ cdrom cdrom-file ] [ vnic { vtap [ mac mac-address ] [ vlan vlan-id ] | sriov pf pfid vf vfid [ vlan vlan-id ] } ]
Views
VMM view
Predefined user roles
network-admin
Parameters
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. The file must be a .qcow2 or .raw file.
format: Specifies the disk format.
raw: Sets the disk format to RAW.
qcow2: Sets the disk format to QCOW2.
disk-bus: Specifies the disk bus type.
ide: Specifies the IDE bus type.
virtio: Specifies the virtio bus type. For some operating systems (for example, Windows Server 2008/2012 or FreeBsd), you must install a driver for this bus type.
cdrom cdrom-file: Specifies the VM operating system image or driver image file path. The cdrom-file argument is a case-sensitive string of 1 to 63 characters. The file must be an .iso file.
vnic: Configures the virtual NIC of the VM.
vtap: Specifies the vTap type of NIC for the VM. This type of NIC is virtualized by software.
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.
sriov: Specifies the SR-IOV type of NIC for the VM.
pf pfid: Specifies a physical SR-IOV NIC by its PF ID. The value for the pfid argument is 0.
vf vfid: Specifies a virtual SR-IOV NIC by its VF ID. The value range for the vfid argument is 0 to 7.
vlan vlan-id: Specifies the VLAN to which the NIC belongs. The value range for the vlan-id argument is 1 to 4094.
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 vm-name centos7 vcpu 1 memory 1048576 vncport 12 disk hda0:/centos.qcow format qcow2 disk-bus ide cdrom hda0:/centos7.iso vnic vtap mac 0010-1110-5872 vlan 21
Related commands
create-disk
install vm-pkg
Use install vm-pkg to install a VM based on the parameters in the specified .pkg file.
Syntax
install vm-pkg pkg-path
Views
VMM view
Predefined user roles
network-admin
Parameters
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 and save the file on the device. You can use the export vm command to export .pkg files.
Examples
# Install a VM based on the specified .pkg file.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] install vm-pkg hda0:/centos7.pkg
install VM package centos7.pkg...
restore pakagepath
Use restore pakagepath to restore a VM based on a .vmb VM backup file in the specified path.
Syntax
restore pakagepath backup-image-path
Views
VMM view
Predefined user roles
network-admin
Parameters
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 on a USB flash drive.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] restore pakagepath usba0:/centos7.vmb
resume vm
Use resume vm to resume a suspended VM.
Syntax
resume vm vm-name
Views
VMM view
Predefined user roles
network-admin
Parameters
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
Usage guidelines
Before you use this command, make sure the VM is in paused (suspended) state. To view VM status, use the display vmlist command.
Examples
# Resume VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] resume vm centos7
Related commands
display vmlist
suspend vm
set bootorder vm
Use set bootorder vm to specify a boot order number for a disk or CD-ROM on a VM.
Syntax
set bootorder vm vm-name target target order-number
Views
VMM view
Predefined user roles
network-admin
Parameters
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 drive name. The target argument is a case-sensitive string of three characters.
order-number: Specifies a boot order number in the range of 0 to 99. A value of 0 indicates that the disk or CD-ROM does not boot when the VM starts. The lower the value, the higher the boot priority.
Usage guidelines
To ensure that a VM can start, make sure no disk or CD-ROM has the same boot order number as the disk or CD-ROM used to boot the VM.
If you use this command on a running VM, you must restart the VM for the configuration to take effect. If you use this command on a stopped VM, the configuration takes effect after you start the VM.
Examples
# Specify boot order number 1 for disk hda on VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] set bootorder vm centos7 target hda 1
set comware-memory
Use set comware-memory to set the minimum amount of physical memory available for the Comware system.
Syntax
set comware-memory size
Default
A minimum of 3 GB of physical memory is available for the Comware system.
Views
VMM view
Predefined user roles
network-admin
Parameters
size size: Sets the minimum amount of physical memory available for the Comware system, in GB.
Usage guidelines
This command is supported only on the following routers:
· MSR3610-I-DP.
· MSR3610-I-XS.
· MSR3610-IE-DP.
· MSR3610-IE-XS.
Make sure the Comware system is allocated a minimum of 2 GB of physical memory. In addition, the amount of physical memory allocated to the Comware system cannot exceed (the total amount of physical memory on the device - 2) GB.
The amount of physical memory available for the Comware system equals the total amount of physical memory on the device minus the amount of physical memory occupied by all VMs. As a best practice to avoid memory conflicts, set the minimum amount of physical memory available for the Comware system to a proper value.
For this command to take effect, you must save the configuration and reboot the device.
Examples
# Reserve a minimum of 2 GB of physical memory for the Comware system.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] set comware-memory 2
Comware reserved memory size has been changed, please reboot the router to make
the configuration take effect.
Comware reserved memory size has been setted lower than default value 3G, and it
may be insufficient to use.
set memory vm
Use set memory vm to allocate memory to a VM.
Syntax
set memory vm vm-name size size
Views
VMM view
Predefined user roles
network-admin
Parameters
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.
Usage guidelines
To ensure that a VM can operate, make sure the VM is allocated a minimum of 512 MB of memory.
If you use this command on a running VM, you must restart the VM for the configuration to take effect. If you use this command on a stopped VM, the configuration takes effect after you start the VM.
Examples
# Allocate 1048576 KB of memory to VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] set memory vm centos7 size 1048576
set sriov
Use set sriov to specify the VLAN to which a VF interface belongs.
Use undo set sriov to remove a VF interface from a VLAN.
Syntax
set sriov pf pfid vf vfid vlan vlan-id
undo set sriov pf pfid vf vfid vlan vlan-id
Views
VMM view
Predefined user roles
network-admin
Parameters
pf pfid: Specifies a physical SR-IOV NIC by its PF ID. The value for the pfid argument is 0.
vf vfid: Specifies a vNIC by its VF ID. The value range for the vfid argument is 0 to 7.
vlan vlan-id: Specifies a VLAN ID in the range of 1 to 4094.
Usage guidelines
Make sure the physical NIC network mode is SR-IOV share.
Examples
# Assign the VF interface on VF 0 of PF 0 to VLAN 20.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] set sriov pf 0 vf 0 vlan 20
set vcpu-pool
Use set vcpu-pool to set the total number of CPU cores allocated to the VM plane.
Syntax
set vcpu-pool vcpu-number
Views
System view
Predefined user roles
network-admin
Parameters
vcpu-number: Sets 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
After you modify the number of CPU cores allocated to the VM plane, you must reallocate vCPUs to VMs and bind vCPUs to physical CPUs. For the reallocation and binding to take effect on a VM, you must restart the VM.
For this command to take effect, you must save the configuration and reboot the device.
Examples
# Allocate two CPU cores to the VM plane.
<Sysname> system-view
[Sysname] set vcpu-pool 2
VCPU pool changed, please reconfig vcpu-pin for each virtual machine and reboot the router.
set vcpupin vm
Use set vcpupin vm to bind a vCPU on a VM to a physical CPU on the device.
Syntax
set vcpupin vm vmname vcpuindex vcpuindex cpuindex cpuindex
Views
VMM view
Predefined user roles
network-admin
Parameters
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. To obtain the vCPU index, use the display vmcpupin command.
cpuindex cpuindex: Specifies a physical CPU by its index. To obtain the physical CPU index, use the display vmcpupin command.
Usage guidelines
If you bind multiple vCPUs of a VM to only one physical CPU, the VM might fail to start up because of CPU resource conflict. As a best practice to ensure correct VM startup, bind the vCPUs to different physical CPUs.
If you use this command on a running VM, you must restart the VM for the configuration to take effect. If you use this command on a stopped VM, the configuration takes effect after you start the VM.
Examples
# Bind vCPUs 0 and 1 on VM centos7 to physical CPUs 2 and 3, respectively.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm]set vcpupin vm centos7 vcpuindex 0 cpuindex 2
[Sysname-vmm]set vcpupin vm centos7 vcpuindex 1 cpuindex 3
Related commands
display vmcpupin
set vcpu vm
Use set vcpu vm to set the number of vCPUs allocated to a VM.
Syntax
set vcpu vm vm-name vcpu-count vcpu-count
Views
VMM view
Predefined user roles
network-admin
Parameters
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.
Usage guidelines
If you set the number of vCPUs allocated to a VM to 0, the VM will be inaccessible at the next startup. To access the VM, you must reallocate vCPUs to the VM.
If you use this command on a running VM, you must restart the VM for the configuration to take effect. If you use this command on a stopped VM, the configuration takes effect after you start the VM.
Examples
# Set the number of vCPUs to 2 for VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] set vcpu vm centos7 vcpu-count 2
set vnc vm
Use set vnc vm to configure the VNC parameters for connecting to a VM.
Syntax
set vnc vm vm-name { vncport vncport | delpasswd | listen ip-address | setpasswd password }
Views
VMM view
Predefined user roles
network-admin
Parameters
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.
Usage guidelines
If you use this command on a running VM, you must restart the VM for the configuration to take effect. If you use this command on a stopped VM, the configuration takes effect after you start the VM.
Examples
# Configure VNC parameters for VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] set vnc vm centos7 vncport 12
[Sysname-vmm] set vnc vm centos7 setpasswd 12344556
[Sysname-vmm] set vnc vm centos7 delpasswd
[Sysname-vmm] set vnc vm centos7 listen 172.33.3.158
set vtap vm
Use set vtap vm to specify the VLAN to which a vTap interface belongs.
Syntax
set vtap vm vm-name mac mac-address vlan vlan-id
Views
VMM view
Predefined user roles
network-admin
Parameters
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.
Usage guidelines
Before you use this command, use the display vminterface command to obtain the MAC address of the vTap NIC.
Examples
# Assign the vTap interface of VM centos7 to VLAN 10.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] set vtap vm centos7 mac 0010-1110-5872 vlan 10
Related commands
display vminterface
start vm
Use start vm to start a VM.
Syntax
start vm vm-name
Views
VMM view
Predefined user roles
network-admin
Parameters
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.
Use this command to start a VM only when the VM is in shut off state. To view VM status, use the display vmlist command.
Examples
# Start VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] start vm centos7
Related commands
display vmlist
stop vm
stop vm
Use stop vm to stop a VM.
Syntax
stop vm vm-name [ force ]
Views
VMM view
Predefined user roles
network-admin
Parameters
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 stop operation still fails, force the VM down.
If the VM does not have an operating system, you must specify the force keyword to force it down.
Use this command to stop a VM only when the VM is in running state. To view VM status, use the display vmlist command.
Examples
# Stop VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] stop vm centos7
Related commands
display vmlist
start vm
suspend vm
Use suspend vm to suspend a VM.
Syntax
suspend vm vm-name
Views
VMM view
Predefined user roles
network-admin
Parameters
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
Usage guidelines
Use this command to suspend a VM only when the VM is in running state. To view VM status, use the display vmlist command.
Examples
# Suspend VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] suspend vm centos7
Related commands
display vmlist
resume vm
uninstall vm
Use uninstall vm to uninstall a VM.
Syntax
uninstall vm vm-name
Views
VMM view
Predefined user roles
network-admin
Parameters
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30 characters.
Usage guidelines
The system cannot recover a VM after you uninstall it. As a best practice, use the backup vm command to back up the VM before you uninstall it.
You must stop a VM by using the stop vm command before you can uninstall it.
After you uninstall a VM, the disks allocated to the VM still retain the VM image files and running data files. To release storage space, you must use the delete command to manually delete the hard disks. For more information about deleting hard disks, see file system management in Fundamentals Configuration Guide.
Examples
# Uninstall VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] uninstall vm centos7
Related commands
backup vm
install vm-name
install vm-pkg
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]
vm network-mode
Use vm network-mode to set the physical NIC network mode for VMs.
Syntax
vm network-mode { passthrough | sr-iov }
Default
The SR-IOV share mode is used.
Views
System view
Predefined user roles
network-admin
Parameters
passthrough: Specifies the passthrough mode. In this mode, a VM uses the PF interface of a physical NIC for communication.
sr-iov: Specifies the SR-IOV share mode. In this mode, VMs use the VF interfaces of a physical NIC for communication.
Usage guidelines
For the configuration to take effect, you must save the configuration and reboot the device.
To ensure that VMs can start up after the device reboots, make sure the NIC interfaces added to VMs are the interfaces required by the configured NIC network mode.
Examples
# Set the physical NIC network mode for VMs to passthrough mode.
<Sysname> system-view
[Sysname] vm network-mode passthrough
Related commands
add sriov vm