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:
- Creating a virtual machine on the node
- Installing an operating system on the virtual machine
- Obtaining the virtual machine IMG and XML files
- 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:
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.
- Open an SSH client like PuTTY.
-
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.
-
Log in with the credentials for host access to the Nerve Device.
-
Enter the following command:
sudo lvcreate -L <image_size> -n <volume_name> nerve
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.
-
Enter the following command to increase storage:
sudo lvextend -L +<size> -r nerve/data
-
Enter the following command to create a filesystem:
sudo mkfs.ext4 /dev/nerve/<volume_name>
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
-
Enter the following command to create a directory for the ISO file:
sudo mkdir /opt/data/<directory>
-
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>
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.
- Open a file transfer client like WinSCP.
- Enter the IP address for host access to the Nerve Device under Host Name.
-
Enter the credentials for host access to the Nerve Device below under User name and Password.
-
Navigate to the /opt/data/
directory on the right side of the WinSCP window. It is located in the root directory. -
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.
- Run Xming or an alternative.
- Open an SSH client like PuTTY.
-
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.
-
Expand Connection > SSH > X11 on the left side.
-
Tick the checkbox next to Enable X11 forwarding.
-
Click Open.
- Log in with the credentials for host access to the Nerve Device.
-
Enter
virt-manager
.The interface of the Virtual Machine Manager will open.
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.
-
Select File > New Virtual Machine or click the symbol.
-
Select Local install media (ISO image or CDROM).
-
Click Forward.
-
Click Browse... in the next window.
-
In the new window select Browse Local.
-
Navigate to opt/data/
by clicking the left arrow next to admin. The opt directory is located in the root directory. - Double-click the directory containing the ISO file.
-
Select the ISO file of the OS that was copied before.
-
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.
-
Click Forward.
-
Define how much memory and how many CPUs to assign to this virtual machine.
-
Select Forward.
-
Click Select or create custom storage.
-
Select Manage....
Installing the operating system
Now the virtual machine will be initiated and the installation of the OS will be started.
- 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/
. -
Select the plus symbol in the middle of the screen.
-
Enter a name for the IMG file.
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
. -
Select Finish.
- Select the IMG file from the list in the middle.
-
Click Choose Volume.
-
Click Forward to initialize the installation of the OS on the virtual machine.
-
Enter a name for the virtual machine.
-
Click Finish. The virtual machine will be initiated and the installation of the OS will be started.
-
Complete the installation of the OS. Follow the instructions provided by the vendor.
- After the installation is completed, right-click the virtual machine in the main Virtual Machine Manager window.
-
Select Shut Down > Shut Down to shut down the 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.
- Switch to the SSH client window.
-
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. -
Open a file transfer client like WinSCP.
- Enter the IP address for host access to the Nerve Device under Host Name.
-
Enter the credentials for host access to the Nerve Device below under User name and Password.
-
Navigate to
/opt/data/<directory>
on the right side of the window. The opt directory is located in the root directory. -
Copy the
<vmname>.img
file to the local workstation.
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.
- Switch to the SSH client window.
-
Navigate to
/opt/data/<directory>
by entering the following command:cd ../../opt/data/<directory>
-
Enter the following command to dump the XML file into the directory:
virsh dumpxml <volume_name> > <filename>.xml
-
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. -
Open a file transfer client like WinSCP.
- Enter the IP address for host access to the Nerve Device under Host Name.
-
Enter the credentials for host access to the Nerve Device below under User name and Password.
-
Navigate to
/opt/data/<directory>
on the right side of the window. The opt directory is located in the root directory. -
Copy the
<filename>.xml
file to the local workstation.
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.
- Log in to the Management System.
- Select Workloads in the left-hand menu.
- Select the plus symbol in the upper-right corner.
-
Select the virtual machine symbol (Virtual machine workload) in the middle of the three symbols that expanded.
-
In the new window, enter a name for the workload.
-
Select the plus symbol next to Versions to add a new version of the workload.
-
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. -
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. |