Virtual Machine
A virtual machine (VM) on a switch is added to allow additional OS to run on top of the switch. The VM OS can connect through mgmt0 interface to the switch system’s management interface. In addition, the VM is also connected to the out-of-band network. This allows it to communicate through the network and to control the switch management software.
The number of VMs that may run on a system is user-configurable and also relies on resource availability.
The number of configurable VMs is limited to 4.
Each VM consumes the following resources:
Memory
Processing power which is not policed (the user may determine the core to be used)
MACs which are required for each vNIC (user configurable)
To configure a VM, take the following steps.
The example below installs Ubuntu 14 and defines 3GB storage with 512MB memory (default) using the first core of the switch system (default) through mgmt0 interface (default) with an auto-generated MAC (default).
Enable the VM feature.
switch
(config) # virtual-machine enableCreate a VM.
switch
(config) # virtual-machine host my-vmswitch
(config virtual-machine host my-vm) #Define storage for the VM.
switch
(config virtual-machine host my-vm) # storage create disk size-max3000
100.0
% [#################################################################] Created empty virtual disk volume'vdisk001.img'
in pool'default'
Device attached to drive number1
.switch
(config virtual-machine host my-vm) #Display the VM parameters (notice boldface).
switch
(config virtual-machine host my-vm) # show virtual-machine host my-vm VM'my-vm'
Status: shut off Architecture: x86_64 VCPU used:0
sec Number of VCPUs:1
Boot order: hd, cdrom Memory size:512
MB Consoles: text, graphics Storage: IDE bus, drive1
:default
/vdisk001.img (3000
MB capacity) Interfaces:1
: on bridge'mgmt0'
address unknown (MAC52
:54
:00
:2f:89
:69
)switch
(config virtual-machine host my-vm) # exitswitch
(config) #Import the VM image.
switch
(config) # virtual-machine volume fetch url scp://root@<ip>/.../ubuntu-14.04-server-amd64.iso
Password (if
required): *************100.0
% [#################################################################]Install the imported image.
switch
(config) # virtual-machine host my-vmswitch
(config virtual-machine host my-vm) # install cdrom file ubuntu-18.04
-server-amd64.isoSwitch to a different terminal, and run the following command to connect VNC viewer to the VM:
$ vncviewer -via admin@<
switch
IP>127.0
.0.1
:0
... Mellanox Onyx Switch Management Password: ************Continue VM installation from the VNC prompt.
WarningThe switch prompt is unresponsive pending a successful VM installation. Successful VM installation is indicated by the reboot of the VM.
WarningVM IP is determined by DHCP configuration according to the MAC address in Step 4.
To verify VM configuration, run the following:
switch
(config virtual-machine host my-vm) # show virtual-machine host my-vm
VM 'my-vm'
Status: running Architecture: x86_64
VCPU used: 12
min 27.440
sec Number of VCPUs: 1
Boot order: cdrom, hd Memory size: 512
MB
Consoles: text, graphics
Storage:
IDE bus, drive 1
: default
/vdisk001.img (3000
MB capacity)
IDE bus, drive 2
: default
/ubuntu-14.04
-server-amd64.iso (564
MB capacity) READ-ONLY
Interfaces:
1
: on bridge 'mgmt0'
address unknown (MAC 52
:54
:00
:2f:89
:69
)
To perform a VM installation from a USB stick:
USB stick with supported VM image should be supplied to the user
Insert the USB stick (supplied) to the USB port of your switch system.
Decide on a name for the VM (e.g., “my_vm”).
Decide on the network configuration of the VM.
•Use DHCP or alternately use static IP definitions
•Assign a MAC address or alternately use the default MAC addressLaunch the full installation of the VM with the network definitions of your choice.
virtual-machine enable
virtual-machine enable Enables VM feature on the switch. | ||
Syntax Description | N/A | |
Default | no virtual-machine enable | |
Configuration Mode | config | |
History | 3.4.0000 | |
Example | switch (config) # virtual-machine enable | |
Related Commands | ||
Notes |
virtual-machine host
virtual-machine host <vm-name> Creates a VM, or enters its configuration context if it already exists. | ||
Syntax Description | vm-name | Configures a name for the VM |
Default | N/A | |
Configuration Mode | config | |
History | 3.4.0000 | |
Example | switch (config)# virtual-machine host my-vm | |
Related Commands | ||
Notes |
arch
arch {i386 | x86_64} Configures VM CPU architecture. | ||
Syntax Description | i386 | 32-bit x86 CPU architecture |
x86_64 | 64-bit x86 CPU architecture | |
Default | x86_64 | |
Configuration Mode | config virtual machine host | |
History | 3.4.0000 | |
Example | switch (config virtual-machine host my-vm)# arch i386 | |
Related Commands | virtual-machine | |
Notes |
comment
comment <string> Configures a comment describing the VM. | ||
Syntax Description | string | Free string |
Default | N/A | |
Configuration Mode | config virtual machine host | |
History | 3.4.0000 | |
Example | switch (config virtual-machine host my-vm)# comment “example VM” | |
Related Commands | virtual-machine | |
Notes | To configure a multi-word string, the string must be placed within quotation marks |
console
console {connect [graphics | text [force]] | graphics vnc | text tty} Configures or connects to a text or graphical console. | ||
Syntax Description | connect | Connects to the text console unless specified otherwise:
|
graphics vnc | Enables graphical (VNC) console access | |
text tty | Enables TTY text console access | |
Default | Graphical and textual consoles are enabled | |
Configuration Mode | config virtual machine host | |
History | 3.4.0000 | |
Example | switch (config virtual-machine host my-vm)# console connect text | |
Related Commands | virtual-machine | |
Notes |
|
install
install {cancel |cdrom [pool <pool-name>] {file <volume-name> [connect-console <console-type> | disk-overwrite | timeout {<minutes> | none}]}} Installs an operating system onto this VM (temporarily attach a CD and boot from it). | ||
Syntax Description | cancel | Cancels an install already in progress |
cdrom | Installs an operating system from a CD-ROM (ISO) image | |
pool <pool-name> | Configures storage pool in which to find image to install:
| |
file <volume-name> | Specifies CD-ROM (ISO) image from which to install | |
connect-console <console-type> | Connects to the console during installation. The types may be:
| |
disk-overwrite | Installs even if primary target volume is not empty | |
timeout {<minutes> | none} | Configures a timeout for installation in minutes (default is no timeout) | |
Default | N/A | |
Configuration Mode | config virtual machine host | |
History | 3.4.0000 | |
Example | switch (config virtual-machine host my-vm)# install cdrom pool usb file <image> | |
Related Commands | virtual-machine | |
Notes | The default pool from which the system installs the ISO image is the /var/ partition in the switch |
install-from-usb
install-from-usb [ip-address <ip-address> <mask> default-gateway <gw-ip> [mac <mac-address>] | mac <mac-address>] Installs a VM including resource allocation and network configurations from a VM image file located on a USB stick. | ||
Syntax Description | ip-address | The IP address to configure for the installed VM |
mask | The IP mask to configure to the installed VM Format example: /24 or 255.255.255.0 Note that a space is required between the IP address and the netmask length | |
default-gateway | The IP address of the default gateway to configure for the installed VM | |
mac | The MAC address to configure for the installed VM (e.g., ff:ee:dd:cc:bb:aa) | |
Default | N/A | |
Configuration Mode | config virtual machine host | |
History | 3.6.2002 | |
Example | switch (config virtual-machine host my-vm)# install-from-usb | |
Related Commands | virtual-machine | |
Notes | USB stick supplied must be inserted into the USB port of the switch system prior to running this command |
interface
interface <id> {bridge <bridge> | macaddr <mac> | model <model> | name <name>} Configures virtual interfaces. | ||
Syntax Description | <id> | Interface ID number (1-8 permitted) |
bridge <bridge> | Configures bridge for this interface (i.e. mgmt0 or mgmt1) | |
macaddr <mac> | Configures MAC address (e.g., ff:ee:dd:cc:bb:aa) | |
model <model> | Configures virtual interface model:
| |
name <name> | Configures virtual interface name | |
Default | N/A | |
Configuration Mode | config virtual machine host | |
History | 3.4.0000 | |
Example | switch (config virtual-machine host my-vm)# interface 1 model virtio | |
Related Commands | virtual-machine | |
Notes |
memory
memory <MB> Configures memory allowance. | ||
Syntax Description | MB | Size in megabytes |
Default | 512MB | |
Configuration Mode | config virtual machine host | |
History | 3.4.0000 | |
Example | switch (config virtual-machine host my-vm)# memory 1024 | |
Related Commands | virtual-machine | |
Notes | It is recommended not to allocate more than 1GB of memory per VM |
power
power {cycle [force | connect-console {graphics | text}] | off [force] | on [connect-console {graphics | text}]} Turns the VM on or off, or other related options. | ||
Syntax Description | cycle | Powers the VM down and then on again immediately |
force | Forces an action on the system | |
connect-console <console-type> | Connects to the console after power-on. The types may be:
| |
off | Powers down the VM | |
on | Powers on VM | |
Default | N/A | |
Configuration Mode | config virtual machine host | |
History | 3.4.0000 | |
Example | switch (config virtual-machine host my-vm)# power cycle force | |
Related Commands | virtual-machine | |
Notes |
storage create
storage create disk [drive-number <number> | file <filename> | mode {read-only | read-write} | pool <pool-name> | size-max <MB>] Creates a new storage device for the VM, with an automatically assigned name. | ||
Syntax Description | create disk | Creates a new virtual disk image for this VM. |
drive-number <number> | Specifies the drive number to be assigned to the volume. | |
file <filename> | Specifies filename for new volume to be created. | |
mode {read-only | read-write} | Specifies initial device mode. | |
pool <pool-name> | Specifies storage pool in which to create new volume. | |
size-max <MB> | Specifies maximum disk capacity in megabytes. | |
Default | N/A | |
Configuration Mode | config virtual machine host | |
History | 3.4.0000 | |
Example | switch (config virtual-machine host my-vm)# storage create disk size-max 2000 | |
Related Commands | virtual-machine | |
Notes |
storage device
storage device [bus ide] drive-number <number> [mode {read-only | read-write}] source {[pool <pool-name>] file <filename>} Modifies existing storage device, or create a new one with a specific name. | ||
Syntax Description | device | Modifies existing storage device, or creates a new one with a specific name. |
bus ide | Configures bus type to IDE. | |
drive-number <number> | Selects device to configure by drive number. | |
mode {read-only | read-write} | Configures the device mode:
| |
source | Specifies where the data for this volume resides | |
file <filename> | Specifies the filename for this volume. | |
pool <pool-name> file <filename> | Specifies the storage pool for this volume. | |
Default | N/A | |
Configuration Mode | config virtual machine host | |
History | 3.4.0000 | |
Example | switch (config virtual-machine host my-vm)# storage create disk bus ide | |
Related Commands | virtual-machine | |
Notes |
vcpus
vcpus {count <count> | vcpu <vcpu> pin <cpu-list> [<cpu-list>]} Specifies virtual CPUs. | ||
Syntax Description | count <count> | Specifies the number of virtual CPUs. |
vcpu <vcpu> | Specifies options for a particular virtual CPU. | |
pin <cpu-list> | Specifies physical CPUs to pin to this vCPU. | |
Default | N/A | |
Configuration Mode | config virtual machine host | |
History | 3.4.0000 | |
Example | switch (config virtual-machine host my-vm)# vcpus count 1 | |
Related Commands | ||
Notes |
virtual-machine volume fetch url
virt volume fetch url <download-url> [filename <filename> | pool <pool-name> filename <filename>] Fetches volume image from a remote host. | ||
Syntax Description | download-url | Specifies URL from which to fetch a volume |
filename <filename> | Specifies new filename for fetched volume image | |
pool-name <pool-name> | Specifies storage pool for fetched volume image | |
Default | N/A | |
Configuration Mode | config virtual machine host | |
History | 3.4.0000 | |
Example | switch (config) # virtual-machine volume fetch scp://username[:password]@hostname/path/filename | |
Related Commands | ||
Notes |
virt volume file
virt volume file <name> {create disk size-max <MB> | move {new-name <new-name> | pool <pool-name> new-name <new-name>} | upload <upload-url>} Specifies name of volume file to manage. | ||
Syntax Description | name | Specifies name of volume file to manage. |
create | Creates a new volume file under this name. | |
disk size-max <MB> | Specifies maximum capacity of virtual disk to create. | |
move | Moves or renames this volume. | |
new-name <filename> | Specifies a name for the destination file. | |
pool <pool-name> new-name <filename> | Specifies a storage pool for the copy. | |
upload <upload-url> | Uploads this volume file to a remote host. | |
Default | N/A | |
Configuration Mode | config virtual machine host | |
History | 3.4.0000 | |
Example | switch (config) # virt volume file my-vm_file create cdrom extract cdrom1 | |
Related Commands | ||
Notes |
show virtual-machine configured
show virtual-machine configured Displays global virtualization configuration. | ||
Syntax Description | N/A | |
Default | N/A | |
Configuration Mode | Any command mode | |
History | 3.4.0000 | |
Example | switch (config) # show virtual-machine configured | |
Related Commands | ||
Notes |
show virtual-machine host
show virtual-machine host [<vm-name>] Displays status for this VM. | ||
Syntax Description | vm-name | The name of the VM |
Default | N/A | |
Configuration Mode | Any command mode | |
History | 3.4.0000 | |
Example | switch (config) # show virtual-machine host my-vm | |
Related Commands | ||
Notes | If the command is run in the middle of an installation, the following banner appears:
|
show virtual-machine host configured
show virtual-machine host <vm-name> configured [detail] Displays configuration for this VM. | ||
Syntax Description | vm-name | The name of the VM |
detail | Displays detailed configuration for this VM | |
Default | N/A | |
Configuration Mode | Any command mode | |
History | 3.4.0000 | |
Example | ||
| ||
Related Commands | ||
Notes |
show virtual-machine host detail
show virtual-machine host <vm-name> detail Displays detailed status for this VM. | ||
Syntax Description | vm-name | The name of the VM |
Default | N/A | |
Configuration Mode | Any command mode | |
History | 3.4.0000 | |
Example | ||
switch (config) # show virtual-machine host my-vm detail
| ||
Related Commands | ||
Notes |
show virtual-machine install
show virtual-machine host <vm-name> install Displays status of installation of guest OS. | ||
Syntax Description | vm-name | The name of the VM. |
Default | N/A | |
Configuration Mode | Any command mode | |
History | 3.4.0000 | |
3.7.0000 | Updated Example | |
Example |
| |
Related Commands | ||
Notes |
show virtual-machine interface
show virtual-machine host <vm-name> interface [brief | configure] Displays full status of all interfaces for this VM. | ||
Syntax Description | vm-name | The name of the VM |
brief | Displays brief status of all interfaces for this VM | |
configure | Displays configuration of all interfaces for this VM | |
Default | N/A | |
Configuration Mode | Any command mode | |
History | 3.4.0000 | |
3.7.0000 | Updated Example | |
Example | ||
switch (config) # show virtual-machine host my-vm interface
| ||
Related Commands | ||
Notes |
show virtual-machine storage
show virtual-machine host <vm-name> storage Displays statistics for attached storage. | ||
Syntax Description | vm-name | The name of the VM |
Default | N/A | |
Configuration Mode | Any command mode | |
History | 3.4.0000 | |
Example | switch (config) # show virtual-machine host my-vm storage | |
Related Commands | ||
Notes |