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.

Warning

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.

Warning

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).

  1. Enable the VM feature.

    Copy
    Copied!
                

    switch (config) # virtual-machine enable

  2. Create a VM.

    Copy
    Copied!
                

    switch (config) # virtual-machine host my-vm switch (config virtual-machine host my-vm) #

  3. Define storage for the VM.

    Copy
    Copied!
                

    switch (config virtual-machine host my-vm) # storage create disk size-max 3000 100.0% [#################################################################] Created empty virtual disk volume 'vdisk001.img' in pool 'default' Device attached to drive number 1. switch (config virtual-machine host my-vm) #

  4. Display the VM parameters (notice boldface).

    Copy
    Copied!
                

    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, drive 1: default/vdisk001.img (3000 MB capacity) Interfaces: 1: on bridge 'mgmt0' address unknown (MAC 52:54:00:2f:89:69) switch (config virtual-machine host my-vm) # exit switch (config) #

  5. Import the VM image.

    Copy
    Copied!
                

    switch (config) # virtual-machine volume fetch url scp://root@<ip>/.../ubuntu-14.04-server-amd64.iso Password (if required): *************  100.0% [#################################################################]

  6. Install the imported image.

    Copy
    Copied!
                

    switch (config) # virtual-machine host my-vm switch (config virtual-machine host my-vm) # install cdrom file ubuntu-18.04-server-amd64.iso

  7. Switch to a different terminal, and run the following command to connect VNC viewer to the VM:

    Copy
    Copied!
                

    $ vncviewer -via admin@<switch IP> 127.0.0.1:0 ... Mellanox Onyx Switch Management   Password: ************

  8. Continue VM installation from the VNC prompt.

    Warning

    The switch prompt is unresponsive pending a successful VM installation. Successful VM installation is indicated by the reboot of the VM.

    Warning

    VM IP is determined by DHCP configuration according to the MAC address in Step 4.

To verify VM configuration, run the following:

Copy
Copied!
            

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:

Warning

USB stick with supported VM image should be supplied to the user

  1. Insert the USB stick (supplied) to the USB port of your switch system.

  2. Decide on a name for the VM (e.g., “my_vm”).

  3. 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 address

  4. Launch the full installation of the VM with the network definitions of your choice.

virtual-machine enable

virtual-machine enable
no virtual-machine enable

Enables VM feature on the switch.
The no form of the command disables 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>
no virtual-machine host <vm-name>

Creates a VM, or enters its configuration context if it already exists.
The no form of the command removes the VM with the specified name.

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
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>
no comment

Configures a comment describing the VM.
The no form of the command deletes the configured comment.

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}
no console {graphics vnc | text tty}

Configures or connects to a text or graphical console.
The no form of the command clears console settings.

Syntax Description

connect

Connects to the text console unless specified otherwise:

  • graphics—connects to the X11 graphical (VNC) console

  • text—connects to the text console

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
ssh server x11-forwarding enable

Notes

  • To exit the text console press Ctrl-6 (or Ctrl-Shift-6)

  • If the guest OS is not configured to receive input from a serial console (ttyS0), the VM console becomes unresponsive when connected to.

  • To view the graphical console, X display must be enabled. There are two options to activate it, the command “vncviewer -via admin@<switchIP> 127.0.0.1:<VNC display num>” (which is run from an external Linux host) and the command “ssh server x11-forwarding enable” (which is run from within the switch and requires that you log out and log back in again using ssh -X ). The latter command weakens the switch security, therefore, it is recommended to opt for the second option. The VNC display num parameter may be procured by running the command “show virtual-machine <vm-name> detail”.

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:

  • default

  • usb

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:

  • text—text console

  • graphics—graphical console

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
100.0% [##############################################################]
VM host my-vm MAC is: aa:bb:cc:dd:ee:ff
switch (config virtual-machine host my-vm)#

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:

  • realtek-8139—Realtek 8139 (default)

  • virtio—Virtual IO

name <name>

Configures virtual interface name
The name must begin with “vif”

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:

  • text—text console

  • graphics—graphical console

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.
Insert “new” to assign a new drive number 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>}
no storage device [bus ide] drive-number <id>

Modifies existing storage device, or create a new one with a specific name.
The no form of the command removes a storage device from the VM.

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:

  • read-only—sets the read-only attribute of the volume

  • read-write—sets the read-write attribute of the volume

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>]}
no vcpus {pin | vcpu <vcpu> pin}

Specifies virtual CPUs.
The no form of the command removes certain CPU configuration.

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
Supported formats: http, https, ftp, tftp, scp and sftp are supported (e.g., scp://username[:password]@hostname/path/filename)

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>}
no virt volume file <volume-name>

Specifies name of volume file to manage.
The no form of the command deletes the volume file.

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.
Supported format: ftp, tftp, scp and sftp are supported (e.g., scp://username[:password]@hostname/path/filename).

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
Virtualization enabled: yes
Virtual machines: 2 configured
Virtual networks: 0 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
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, drive 1: default/vdisk002.img (3000 MB capacity)
Interfaces:
1: on bridge 'mgmt0' address unknown (MAC 52:54:00:a4:45:ae)

Related Commands

Notes

If the command is run in the middle of an installation, the following banner appears:

Copy
Copied!
            

*** INSTALL IN PROGRESS: begun <time> ago ***

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

switch (config) # show virtual-machine host my-vm configured

VM 'my-vm'
Auto-power :on
Architecture :x86_64
Boot order :hd, cdrom
Number of VCPUs :1
Consoles: text, graphics
Memory size :512 MB

Storage:
IDE bus, drive 1: default/vdisk002.img (3000 MB capacity)
Interfaces:
Interface 1:
on bridge 'mgmt0'(MAC 52:5400A4:45:AE)

switch (config) # show virtual-machine host my-vm configured detail

VM 'my-vm'
UUID :0a177a99-f780-5951-877a-bd660e12e5db
Text console :enabled
Graphics console :enabled
Auto-power :last
Boot order :hd, cdrom
Architecture :x86_64
Memory size :512 MB
Features :ACPI, APIC
Number of VCPUs :1
State of individual VCPUs: No VCPUs pinned

Storage:
IDE bus, drive 1
Source pool: default
Source file: vdisk001.img (3000 MB capacity)
Mode: read-write

Interfaces:
Interface 1
Name: vif1
MAC address: 52:54:00:2f:89:69
Model: realtek-8139
Bound to: bridge 'mgmt0'

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

VM 'my-vm'
Status :shut off
UUID : c4c587fc-c394-5112-9cb2-8102b2ae861aText console :enabled
Device :N/A
Graphics console :enabled
VNC display num :N/A
Boot order :hd, cdrom
Architecture :x86_64
Memory size :512 MB
Features :ACPI, APIC
Number of VCPUs :1
State of individual VCPUs unavailable when VM is powered off

Storage:
IDE bus, drive 1
Source pool: default
Source file: vdisk001.img (3000 MB capacity)
Mode: read-write
Device type: disk
Read requests: N/A
Read bytes: N/A
Write requests: N/A
Write bytes: N/A

Interfaces:
Interface 1
Name: vif2
MAC address: 52:54:00:a8:ba:f3
Model: realtek-8139
Bound to: bridge 'mgmt0'
IP address:

RX bytes: 0
TX bytes: 0
RX packets: 0
TX packets: 0
RX errors: 0
TX errors: 0
RX drop: 0
TX drop: 0

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

switch (config) # show virtual-machine host my_host install

Install status for VM 'my_host':
Install in progress, begun 9 minutes 11 seconds ago.

Previous install:
Completed : 2018/09/12 14:08:45.041
Install status: FAILED
Failure reason: canceled by user

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

Interface 1
Name: vif1
MAC address: 52:54:00:2f:89:69
Model: realtek-8139
Bound to: bridge 'mgmt0'
IP address:

Counters:
RX bytes: 0 TX bytes: 0
RX packets: 0 TX packets: 0
RX errors: 0 TX errors: 0
RX drop: 0 TX drop: 0

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
Storage for VM 'my-vm'
IDE bus, drive 1
Source pool: default
Source file: vdisk001.img (3000 MB capacity)
Mode: read-write
Device type: disk
Read requests: N/A
Read bytes: N/A
Write requests: N/A
Write bytes: N/A

Related Commands

Notes

© Copyright 2023, NVIDIA. Last updated on May 23, 2023.