- Table of Contents
- Related Documents
-
Title | Size | Download |
---|---|---|
03-VM commands | 181.12 KB |
Contents
VM commands
This feature is supported only on the SR6600 RPE-X5E MPU.
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
In standalone mode:
add cdrom vm slot slot-number vm-name cdrom-file cdrom-file
In IRF mode:
add 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. (In IRF mode.)
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 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.
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 slot 0 centos7 cdrom-file slot0#sda1:/centos7.iso
Related commands
display vmdisklist
set bootorder vm
add disk vm
Use add disk vm 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 disk-bus { ide | virtio }
In IRF mode:
add disk vm chassis chassis-number slot slot-number vm-name format { raw | qcow2 } disk-file path-file disk-bus { ide | virtio }
Views
VMM view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID. (In IRF mode.)
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 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 running VM, you must restart the VM for the configuration to take effect. If you add a disk to 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] add disk vm slot 0 centos7 format qcow2 disk-file slot0#sda1:/centos7.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 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. (In IRF mode.)
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.
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
# 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 vm
Use add vtap vm 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. (In IRF mode.)
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. 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 running VM, you must restart the VM for the configuration to take effect. If you add a vTap NIC to 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.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] add vtap vm slot 0 centos7 mac 0010-1110-5872
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
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. (In IRF mode.)
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
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 slot 0 centos7
backup vm
Use backup vm 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. (In IRF mode.)
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. 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 slot 0 centos7 slot0#sda1:/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 slot0#sda1:/centos7.qcow size 30 format qcow2
delete disk vm
Use delete disk vm to remove a disk or CD-ROM 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. (In IRF mode.)
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.
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 slot 0 centos7 target hdb
delete sriov vm
Use delete sriov vm 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. (In IRF mode.)
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.
Usage guidelines
Remove a PF from a VM to remove the SR-IOV NIC from that 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
# Remove PF 0 from VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] delete sriov vm slot 0 centos7 pf 0
Related commands
display vminterface
delete vtap vm
Use delete vtap vm 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. (In IRF mode.)
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.
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 slot 0 centos7 mac 0010-1110-5872
Related commands
display vminterface
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. (In IRF mode.)
slot slot-number: Specifies an MPU by its slot number.
Examples
# Display passthrough NIC information.
<Sysname> display 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. (In IRF mode.)
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
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
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. (In IRF mode.)
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 configuration that will take effect at the next VM startup.
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/slot0#sda1:/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 vCPU cores 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. 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 vmcpupin
Use display vmcpupin to display the bindings between vCPU cores and physical CPU cores 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. (In IRF mode.)
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 vCPU cores and physical CPU cores for VM centos7.
<Sysname> display 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 vm
Use display vmcpu-usage vm 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. (In IRF mode.)
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
Use this command only on running VMs.
Examples
# Display CPU usage information about VM centos7.
<Sysname> display vmcpu-usage vm slot 0 centos7
CpuNum Cpu-Usage
---------------------------------------
0 27%
1 16%
...
Table 3 Command output
Field |
Description |
CpuNum |
CPU core number. |
Cpu-Usage |
CPU usage. |
display vmdisklist
Use display vmdisklist to display disk or CD-ROM information for 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. (In IRF mode.)
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 disk or CD-ROM information for VM centos7.
<Sysname> display vmdisklist vm slot 0 centos7
Device Target BootOrder Source
disk vda 1 /mnt/slot0#sda1:/windows_server_2012_r2_x64.qcow2
cdrom hda 8 /mnt/slot0#sda1:/windows_server_2012_r2_x64.iso
cdrom hdc - /mnt/slot0#sda1:/virtio-win-0.1.171.iso
Table 4 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 on the slot where the VM resides. |
display vmdisk-usage vm
Use display vmdisk-usage vm to display information about the raw storage that a VM occupies on the router.
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. (In IRF mode.)
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
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 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. (In IRF mode.)
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. (In IRF mode.)
slot slot-number: Specifies an MPU by its slot number.
Usage guidelines
In standalone mode, 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. · shut off—The VM is stopped. |
display vmmem-usage vm
Use display vmmem-usage vm 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. (In IRF mode.)
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 vm
Use display vncport vm 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. (In IRF mode.)
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
Use this command only for a running VM.
Examples
# Display the VNC port number of a VM.
<Sysname> display vncport vm slot 0 centos7
:12
export vm
Use export vm 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. (In IRF mode.)
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.
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 sda1:/ on slot 0.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] export vm slot 0 centos7 slot0#sda1:/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 } disk-bus { ide | virtio } [ 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 } disk-bus { ide | virtio } [ 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. (In IRF mode.)
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 vCPU cores allocated to the VM. The value range for the vcpu-count argument is 0 to the maximum number of CPU cores allocated to the VM plane.
memory size: Sets the size of memory allocated to the VM, in KB. The value range for the size argument is 512000 to 15728640.
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 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.
vlan vlan-id: Specifies the VLAN to which the NIC belongs. The value range for the vlan-id argument is 1 to 4094.
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 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 slot0#sda1:/centos7.qcow format qcow2 disk-bus ide cdrom slot0#sda1:/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
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. (In IRF mode.)
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 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 slot 0 vm-pkg slot0#sda1:/centos7.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. (In IRF mode.)
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 vm
Use resume vm 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. (In IRF mode.)
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
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 slot 0 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
In standalone mode:
set bootorder vm slot slot-number vm-name target target order-number
In IRF mode:
set bootorder vm chassis chassis-number slot slot-number vm-name target target order-number
Views
VMM view
Predefined user roles
network-admin
Parameters
chassis chassis-number: Specifies an IRF member device by its member ID. (In IRF mode.)
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 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 slot 0 centos7 target hda 1
set memory vm
Use set memory vm 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. (In IRF mode.)
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 is 512000 to 15728640.
Usage guidelines
If the RPE-X5E MPU is used, the amount of memory available for VMs is the total amount of memory on the MPU minus 3 GB. The Comware platform occupies 3 GB of memory on the MPU.
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 slot 0 centos7 size 1048576
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. (In IRF mode.)
slot slot-number: Specifies an MPU by its slot number.
vcpu-number: Sets the total number of CPU cores allocated to the VM plane. The value range is 0 to the maximum number of CPU cores on the device - 2.
Usage guidelines
For the configuration to take effect, you must reboot the device.
After you modify the number of CPU cores allocated to the VM plane, you must reallocate vCPU cores to VMs and bind vCPU cores to physical CPU cores. For the reallocation and binding to take effect on a VM, you must restart the VM.
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 vcpupin vm
Use set vcpupin vm to bind a vCPU core on a VM to a physical CPU core 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. (In IRF mode.)
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 core by its index. To obtain the vCPU core index, use the display vmcpupin command.
cpuindex cpuindex: Specifies a physical CPU core by its index. To obtain the physical CPU core index, use the display vmcpupin command.
Usage guidelines
If you bind multiple vCPU cores of a VM to only one physical CPU core, the VM might fail to start up because of CPU resource conflict. As a best practice to ensure correct VM startup, bind the vCPU cores to different physical CPU cores.
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 vCPU cores 0 and 1 on VM centos7 to physical CPU cores 2 and 3, respectively.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm]set vcpupin vm slot 0 centos7 vcpuindex 0 cpuindex 2
[Sysname-vmm]set vcpupin vm slot 0 centos7 vcpuindex 1 cpuindex 3
Related commands
display vmcpupin
set vcpu vm
Use set vcpu vm to set the number of vCPU cores 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. (In IRF mode.)
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 vCPU cores. The value range for the vcpu-count argument is 0 to the maximum number of CPU cores allocated to the VM plane.
Usage guidelines
If you set the number of vCPU cores allocated to a VM to 0, the VM will be inaccessible at the next startup. To access the VM, you must reallocate vCPU cores 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 vCPU cores to 2 for VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] set vcpu vm slot 0 centos7 vcpu-count 2
set vnc vm
Use set vnc vm 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. (In IRF mode.)
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.
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 slot 0 centos7 vncport 12
[Sysname-vmm] set vnc vm slot 0 centos7 setpasswd 12344556
[Sysname-vmm] set vnc vm slot 0 centos7 delpasswd
[Sysname-vmm] set vnc vm slot 0 centos7 listen 172.33.3.158
set vtap vm
Use set vtap vm 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. (In IRF mode.)
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.
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 slot 0 centos7 mac 0010-1110-5872 vlan 10
Related commands
display vminterface
start vm
Use start vm 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. (In IRF mode.)
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.
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 slot 0 centos7
Related commands
display vmlist
stop vm
stop vm
Use stop vm 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. (In IRF mode.)
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 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 slot 0 centos7
Related commands
display vmlist
start vm
suspend vm
Use suspend vm 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. (In IRF mode.)
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
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 slot 0 centos7
Related commands
display vmlist
resume vm
uninstall vm
Use uninstall vm 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. (In IRF mode.)
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
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 slot 0 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]