Hypervisor Assets
Starting from version 5.1, VirtFusion allows the configuration of asset sets on a per-hypervisor basis. This feature is especially useful for offering additional resources such as GPUs, USB access, or even basic CPU pinning, providing greater flexibility in resource allocation.
Configuration
In most cases, assets are hardware devices at host level, this means they will need to be configured on a per hypervisor basis.
To configure an asset for a particular hypervisor, navigate to Compute Resources -> Hypervisors -> [Selected Hypervisor] -> Assets
.
To create an asset, click the Create Asset
button.
Give the asset a name. In this case we will be adding a GPU so we will need to select Device
. Then click Create
.
Once created the asset will show in the list.
Click the little edit/note icon at the end to configure it.
Fill in all the details and add the correct device XML. In this case we used the GPU
example and added the correct bus. Click Update
.
If you are adding GPUs, we would expect all your IOMMU grouping to be completed beforehand and know your device IDs. A simple search for GPU passthrough with libvirt
will yield plenty of results.
Using an Asset
With assets being at hypervisor level, this will obviously disable the ability to migrate a server while an asset is attached. Just keep this in mind.
To add an asset to a server, Select the server (it obviously must me on the hypervisor you added the asset for) and click on the Other
tab.
Click the Add
button in the Hypervisor Assets
section to reveal the list of available assets.
Select the asset and click assign.
The GPU has now been added to the server. A reboot will be required.
In a lot of cases, live inserting a device (especially a GPU) could crash the server. Live functionality will be added at a later date as it requires more testing.
Automation
Assets can be automatically attached to a server at the point of it being created. This is done within a package or directly using the API.
Before an asset can be assigned to a package, it must be grouped.
Navigate back to the list of assets (Compute Resources -> Hypervisors -> [Selected Hypervisor] -> Assets
) and click the Groups
tab.
Click the Create Group
button and give it a name. Because we want to group devices, you should select Device
Now we have a group, we need to add the GPU asset we created earlier in to the group. Click the Assets
tab and edit the GPU.
Select the group that was created and click update. The asset is now in the group.
Now you have a group, you can add that group to a package.
Edit a package and scroll to Hypervisor Asset Groups
.
Select the group you created and click assign. It is also possible to assign multiple instances of the same group. Don't forget to click the Update button at the bottom of the page to save the settings.
The group has now been assigned to the package.
Thats it. Each time a server is created with the package, it will search for a hypervisor that contains a free asset in each of the specified group(s).
Please see the API documentation for instructions on how to override the default groups on a package or define your own on the server create method.
Displaying to End Users
It is possible to display the attached hardware to the end user. All settings are configurable when editing an asset.
The following two fields should be filled in correctly.
And the following two toggles should be set like below.
When the asset is added to a server, it should now show like this.
Optional Icons/Logos
You can also add an icon if you like. You can have up to 250 icons but you will need to add them to the control server in a specific location and format.
In our GPU example we can add the Nvidia logo as follows.
Make sure /opt/virtfusion/app/control/public/custom/img/assets
exists.
mkdir -p /opt/virtfusion/app/control/public/custom/img/assets
Inside the assets folder, add a small (250x250(ish)) PNG named img_1.png
.
Once added, you should end up with /opt/virtfusion/app/control/public/custom/img/assets/img_1.png
Edit the asset in VirtFusion and select Image 1
from the dropdown and click Update
.
The end user should now see a logo!
If you need to add more images, you can use the same method and increment the numbering (img_2.png
, img_3.png
, img_4.png
etc...) and selecting the correct Icon/Logo (Image 2
, Image 3
, Image 4
etc...).