Skip to content
PDF

Provisioning a Virtual machine workload

Before a Virtual Machine workload can be provisioned, it is required to set up the virtual machine. Virtual machine workloads can be created on any PC but an environment to effectively create a Virtual machine workload is not always readily available. Therefore, it is described how the Nerve Device can be utilized to create a Virtual machine workload. What needs to be done is:

  1. Creating a virtual machine on the node
  2. Installing an operating system on the virtual machine
  3. Obtaining the virtual machine IMG and XML files
  4. Provisioning the Virtual Machine workload in the Management System

In this version, Nerve Blue does not provide a GUI based method for installing an OS on a virtual machine and obtaining the virtual machine IMG and XML configuration files. Therefore, this chapter focuses on the manual process. Three tools are required for the instructions below, assuming Windows is used on the workstation:

  • an X Server application like Xming
  • an SSH client like PuTTY
  • a file transfer client like WinSCP

Also the workstation needs to be connected to the physical port of the Nerve Device associated with host access, and the network adapter IP address of the workstation needs to be configured in the correct range. This information is device specific. Refer to the device guide for information on the Nerve Device.

The instructions below are split up into multiple parts to make them easier to follow. The subsections of the instructions are connected and every subheading is a requirement for the next paragraph.

Note

The virtual machine generated in this chapter is a fresh installation and will be generated on the Nerve Device directly.

Creating a logical volume

Logical volumes are created using the lvcreate command, which takes a number of command line arguments. Firstly, the -L flag is used to specify the size of the volume. Secondly, the -n flag is used to specify a name for the logical volume. <image_size> and <volume_name> are used as placeholders in the instructions below. The volume group is already predefined with nerve as its name.

  1. Open an SSH client like PuTTY.
  2. Enter the IP address for host access to the Nerve Device under Host Name (or IP address) to log in to the host of the Nerve Device.

    !PuTTY Host Login

  3. Log in with the credentials for host access to the Nerve Device.

  4. Enter the following command:

    sudo lvcreate -L <image_size> -n <volume_name> nerve
    

    !Creating Logical Volume

Increasing storage in /opt/data and creating a filesystem

The ISO image of the OS needs to be copied to the device from which the virtual machine will be installed. In order to do that, the size of /opt/data needs to be increased. A path to store the ISO file will also be created. <size> is a placeholder for the amount of storage that is added, while nerve/data is the name of the volume group and the logical volume.

  1. Enter the following command to increase storage:

    sudo lvextend -L +<size> -r nerve/data
    

    !Increasing storage

  2. Enter the following command to create a filesystem:

    sudo mkfs.ext4 /dev/nerve/<volume_name>
    

    !Creating a filesystem

Creating a directory for the ISO file and mounting the filesystem

Create a directory in /opt/data in order to be able to generate the IMG file and XML file that are required for the provisioning of the Virtual machine in the Management System

  1. Enter the following command to create a directory for the ISO file:

    sudo mkdir /opt/data/<directory>
    
  2. Enter the following command to mount the filesystem:

    sudo mount /dev/nerve/<volume_name> /opt/data/<directory>
    

Granting permission for the newly created directory

Take ownership of the new directory in order to be able to work with it, e.g. copying the ISO file into the directory.

Enter the following command to take ownership of the created directory:

sudo chown admin:admin /opt/data/<directory>

!Directory and Ownership

Copying the ISO file to the Nerve Device

With the directory created and ownership established, copy the ISO file of the OS to the Nerve Device for the installation on the virtual machine.

Note

The instructions below are hardware specific. The MFN 100 is used as an example in the screenshots. Refer to the device guide for specific information on the Nerve Device.

  1. Open a file transfer client like WinSCP.
  2. Enter the IP address for host access to the Nerve Device under Host Name.
  3. Enter the credentials for host access to the Nerve Device below under User name and Password.

    !WinSCP Host Login

  4. Navigate to the /opt/data/ directory on the right side of the WinSCP window. It is located in the root directory.

    !WinSCP ISO Folder

  5. Copy the ISO file of the OS that is to be installed on the virtual machine to the directory on the Nerve Device.

Creating a virtual machine on a node

Using the Virtual Machine Manager is recommended to create a virtual machine and install the OS from the ISO file. Note that the virtual machine in this chapter is a fresh installation and will be generated on the Nerve Device directly.

  1. Run Xming or an alternative.
  2. Open an SSH client like PuTTY.
  3. Enter the IP address for host access to the Nerve Device under Host Name (or IP address) to log in to the host of the Nerve Device.

    !PuTTY Host Login

  4. Expand Connection > SSH > X11 on the left side.

  5. Tick the checkbox next to Enable X11 forwarding.

    !Enable X11 Forwarding

  6. Click Open.

  7. Log in with the credentials for host access to the Nerve Device.
  8. Enter virt-manager.

    !Open Virtual Machine Manager

    The interface of the Virtual Machine Manager will open.

    !Open Virtual Machine Manager

Inserting the installation file (ISO)

The creation of the virtual machine can now be initiated with the installation of the OS following right after. Note that the Virtual Machine Manager requires the virtual insertion of the ISO file in the beginning while resources for the virtual machine are defined later.

  1. Select File > New Virtual Machine or click the symbol.

    !New Virtual Machine

  2. Select Local install media (ISO image or CDROM).

  3. Click Forward.

    !Local Install

  4. Click Browse... in the next window.

  5. In the new window select Browse Local.

    !Browse Local

  6. Navigate to opt/data/ by clicking the left arrow next to admin. The opt directory is located in the root directory.

  7. Double-click the directory containing the ISO file.
  8. Select the ISO file of the OS that was copied before.

    !ISO Folder

  9. Click Open.

Defining resources for the virtual machine

Next, the amount of memory and the number of CPUs need to be defined, and the logical volume assigned to the virtual machine needs to be selected.

  1. Click Forward.

    !Forward

  2. Define how much memory and how many CPUs to assign to this virtual machine.

  3. Select Forward.

    !Memory and CPU

  4. Click Select or create custom storage.

  5. Select Manage....

    !Custom Storage

Installing the operating system

Now the virtual machine will be initiated and the installation of the OS will be started.

  1. Select the pool that was created in the command line on the left side in the Choose Storage Volume window. Make sure it is the volume with the location opt/data/.
  2. Select the plus symbol in the middle of the screen.

    !Choose Volume

  3. Enter a name for the IMG file.

    !Name IMG

    Note

    Make sure that the value entered for Max Capacity is a factor of 512 Bytes. Any value that is not a factor of 512 B will cause an error when the virtual machine workload is deployed. In other words, do not enter any decimal value except .0 or .5.

  4. Select Finish.

  5. Select the IMG file from the list in the middle.
  6. Click Choose Volume.

    !Choose IMG

  7. Click Forward to initialize the installation of the OS on the virtual machine.

    !Choose Volume

  8. Enter a name for the virtual machine.

  9. Click Finish. The virtual machine will be initiated and the installation of the OS will be started.

    !Initiate Installation

  10. Complete the installation of the OS. Follow the instructions provided by the vendor.

  11. After the installation is completed, right-click the virtual machine in the main Virtual Machine Manager window.
  12. Select Shut Down > Shut Down to shut down the VM.

    !Shut Down VM

Copying the IMG file to a local workstation

With the generation of the VM, the IMG file of the VM has also been generated on the Nerve Device. Copy the IMG file to the local workstation.

  1. Switch to the SSH client window.
  2. Enter the following command:

    sudo chmod o+r /opt/data/<directory>/<vmname>.img
    

    Note

    The IMG file is called <vmname>.img in the command example above. Replace the placeholder name of the image in the command with the actual name of the IMG file.

  3. Open a file transfer client like WinSCP.

  4. Enter the IP address for host access to the Nerve Device under Host Name.
  5. Enter the credentials for host access to the Nerve Device below under User name and Password.

    !WinSCP Host Login

  6. Navigate to /opt/data/<directory> on the right side of the window. The opt directory is located in the root directory.

  7. Copy the <vmname>.img file to the local workstation.

    !Copy IMG File

The virtual machine has now been generated on the Nerve Device and the IMG file of the virtual machine is now on the local workstation.

Note

Do not deploy the virtual machine from the process above to the same Nerve Device through the Management System. The virtual machine will be present twice. The deployment of the virtual machine from the process above should be done to different nodes.

Obtaining the XML file

When the IMG file was generated on the Nerve Device, an XML file for the IMG file was generated as well. It also has to be obtained manually. However, before it can be copied to the workstation. It has to be transferred out of the etc directory.

  1. Switch to the SSH client window.
  2. Navigate to /opt/data/<directory> by entering the following command:

    cd ../../opt/data/<directory>
    
  3. Enter the following command to dump the XML file into the directory:

    virsh dumpxml <volume_name> > <filename>.xml
    

    !Dump XML

  4. Enter the following command:

    sudo chmod o+r /opt/data/<directory>/<filename>.xml  
    

    Note

    Replace the placeholder name of the XML file in the command with the actual name of the XML file. The XML file is called vm.xml in the following screenshots below.

  5. Open a file transfer client like WinSCP.

  6. Enter the IP address for host access to the Nerve Device under Host Name.
  7. Enter the credentials for host access to the Nerve Device below under User name and Password.

    !WinSCP Host Login

  8. Navigate to /opt/data/<directory> on the right side of the window. The opt directory is located in the root directory.

  9. Copy the <filename>.xml file to the local workstation.

    !Copy XML File

With this all the necessary files to provision a Virtual Machine workload for this virtual machine are ready.

Provisioning a Virtual machine workload

The following instructions cover the basic requirements for provisioning a Virtual Machine workload. Optional settings will be left out. Extended options are addressed in the last section of this chapter.
There are two further types of workloads that can be provisioned: CODESYS workloads and Docker workloads. The process for each workload is highlighted in its respective chapter.

  1. Log in to the Management System.
  2. Select Workloads in the left-hand menu.
  3. Select the plus symbol in the upper-right corner.
  4. Select the virtual machine symbol (Virtual machine workload) in the middle of the three symbols that expanded.

    !Virtual Machine Workload

  5. In the new window, enter a name for the workload.

  6. Select the plus symbol next to Versions to add a new version of the workload.

    !New Version

  7. In the next window, enter the following information:

    Item Description
    Name In the new window, enter a Name for the version of this workload.
    Release name Enter a Release name for the version of this workload.
    Virtual machine image Click the upward arrow symbol here to add the virtual machine image. The image has to be an IMG or RAW file.
    Virtual machine xml Click the upward arrow symbol here to add the virtual machine XML file.
    Number of virtual CPUs Enter the number of virtual CPUs to use for this virtual machine.
    Limit memory to Assign how much system memory the workload is allowed to use.

    !Version Settings

  8. Select Save in the lower-left corner.

The workload has now been provisioned and is ready to be deployed in the Deploy menu.

Note

While some settings are not required to provision a Virtual Machine workload in the Management System, additional settings will have to be filled in for the workload to perform as desired. Depending on the virtual machine that will be deployed, new interfaces might have to be defined. Keep this in mind and make sure to learn the details about the virtual machine.

Settings for Virtual machine workloads

In the instructions above, all optional settings have been left out. Below is an overview of all the options with an explanation to each option.

Setting Description
VERSION SPECIFIC INFO Name
A name for the workload version. This could be a reminder for a certain configuration.
Example: "Unlimited" as a name for a virtual machine that has unlimited access to CPU resources.

Release name
A release name for the workload version. This could be a version number. Example: 1.0.1
VIRTUAL MACHINE FILES TO UPLOAD Two files need to be added here:

Virtual machine image
Upload the virtual machine image with the file extension RAW or IMG here. Do this by clicking the upward arrow symbol and selecting the file in the file browser. This is the first file generated in the process before.

Virtual machine xml
Upload the virtual machine XML file here. Do this by clicking the upward arrow symbol and selecting the file in the file browser. This is the second file generated in the process before.

Note that the settings defined under Virtual machine specific info are going to overwrite parts of this XML file.
Virtual machine specific info Number of virtual CPUs
Define the number of virtual CPUs to assign to this virtual machine. The CPUs are then reserved exclusively for the Virtual Machine workload and cannot be used by other processes. This setting is mandatory and the workload cannot be provisioned if it is left blank.

Limit memory to
Assign how much system memory the workload is allowed to use.
The memory assigned here will be reserved exclusively for this Virtual Machine workload and will not be available for any other processes. This setting is mandatory and the workload cannot be provisioned if it is left blank.

New data disk
Click the plus symbol to add a new data disk for the virtual machine. This data disk functions like an extra hard drive for data separate from the virtual machine. Enter a Data disk name and define the Disk size.

PCI passthrough
Click the plus symbol to add a PCI passthrough to the virtual machine. Enter the PCI address of the interface to pass through to be directly used by the virtual machine. Note that the PCIe address is specific to a certain hardware. When using this option, the installation targets to nodes with this specific hardware should be limited by using selectors. Refer to the labels chapter for more information on selectors.

New interface
Click the plus symbol to add a new interface. Choose between a bridged interface and a NAT-interface. For NAT interfaces port mappings for TCP and UDP can be defined.

The names of the interfaces here have to match the names of the pre-defined network interfaces. Also, make sure to not use reserved ports for the workload. Refer to the networking chapter for more detailed information.
SELECTOR Labels
If labels have been defined and assigned to nodes, add them as selectors to the workload. When deploying a workload, the list of nodes will be filtered automatically to the specified label.
Mark as released Tick this checkbox to mark this workload as released. Once marked as released, the workload cannot be edited anymore.