Moving your VMware VMs to whitesky.cloud BV
In this tutorial, we will highlight the different steps needed for migrating VMWare virtual machines to the whitesky.cloud BV portal:
- Preparing the VM with the necessary drivers needed for running on the whitesky.cloud BV portal.
- Exporting it from VMWare.
- Uploading it to a MinIO S3 appliance running on the whitesky.cloud BV portal.
- Importing it into the whitesky.cloud BV portal using the cloud API/CLI.
This tutorial uses VMWare as an example, but using a similar methodology virtual machines coming from any virtualization (HyperV, Openstack, ...) or cloud platform (AWS, Azure, GCP, ...) can be moved into the whitesky.cloud BV.
Acknowledgements
- This tutorial has been made on 64-bit virtual machines
Prepare VM
"Virt-IO drivers are paravirtualized device drivers for KVM virtual machines."
It is more efficient to install Virt-IO drivers on the virtual machines while they are still running on the VMWare hypervisor.
Most virtual machines do not have these drivers installed by default. Having the Virt-IO drivers installed is needed to run VM on the KVM hypervisor used by the whitesky.cloud BV portal.
Windows virtual machines
To make life simple for you we created a PowerShell script that automatically uninstalls the VMWare tools from your machine.
Open a PowerShell window in your Windows VM and paste the following lines to run the script that will remove the VMware tools from your machine.
PS C:\Users\Administrator> Invoke-RestMethod -Uri https://raw.githubusercontent.com/gig-tech/utils/master/windows/scripts/VMware-tools/remove-tools.ps1 -Method Get -OutFile remove-tools.ps1
PS C:\Users\Administrator> .\remove-tools.ps1
If you faced the error of running the script is disabled on this system
, open the PowerShell as an Administrator, then type this command Set-ExecutionPolicy RemoteSigned
and choose Yes.
Windows PowerShell execution policies let you determine the conditions under which Windows PowerShell loads configuration files and runs scripts.
Restricted
- No Script either local, remote or downloaded can be executed on the system.AllSigned
- All scripts that run require to be digitally signed.RemoteSigned
- All remote scripts (UNC) or downloaded need to be signed.Unrestricted
- No signature for any type of script is required.
After removing the VMware tools from your VM, you will need to download and install:
- Windows Driver Kit (WDK) which contains the (devcon.exe) file that is required to prepare your VM to be imported to the whitesky.cloud BV portal.
- Virt-IO Drivers
Linux virtual machines
Preparing Linux VMs is not needed as they come with the Virt-IO drivers as part of the Linux kernel. If your Linux VM would be running a special Linux kernel without the Virt-IO drivers, you would need to install them first before exporting them to OVA. How to do this is beyond the scope of this tutorial as it will be very specific for every Linux distribution.
Windows & Linux
Now shut down the virtual machine to make it ready to be exported to OVA (Open Virtual Appliance).
Convert images
Once all necessary drivers are installed, our VM will be ready for export and can be converted to the platform-independent format OVA.
All VMs should be powered off before converting.
One way to convert VMs to an OVA virtual appliance is to use the GUI VMware tools vSphere Client. Another way is to use the command-based OVF tool utility. For user guide and downloads see OVF Tool Documentation. OVF tool converts .vmx
files of the VM as an argument into the OVA format:
For this tutorial, we are using a single ESXi server. The VMWare software allows us to export the VM via the web browser:
After the download is completed, we go to work with ovftool to create the .ova
file:
> cd Downloads
> ls
disk-1.vmdk disk-2.vmdk win.ova win16.mf win16.nvram win16.ovf
> touch win16.nvram
> ovftool win16.ovf win.ova
Opening OVF source: win16.ovf
The manifest validates
Warning:
- Line -1: Unsupported value 'tools.guest.desktop.autolock' for attribute 'key' on element 'ExtraConfig'.
- Line -1: Unsupported value 'pciBridge0.present' for attribute 'key' on element 'ExtraConfig'.
- Line -1: Unsupported value 'svga.present' for attribute 'key' on element 'ExtraConfig'.
...
- Line -1: Unsupported value 'vmware.tools.requiredversion' for attribute 'key' on element 'ExtraConfig'.
- Line -1: Unsupported value 'migrate.hostLog' for attribute 'key' on element 'ExtraConfig'.
Opening OVA target: win.ova
Writing OVA package: win.ova
Transfer Completed
Warning:
- No manifest entry found for: 'win16.ovf'.
- File is missing from the manifest: 'win16.ovf'.
- No manifest entry found for: 'win16.nvram'.
- Wrong file size specified in OVF descriptor for 'disk-1.vmdk' (specified: 0, actual 9485831168).
- Wrong file size specified in OVF descriptor for 'disk-2.vmdk' (specified: 0, actual 73216).
- No manifest entry found for: 'win16.nvram'.
Completed successfully
> ls
disk-1.vmdk disk-2.vmdk win.ova win16.mf win16.nvram win16.ovf
Alright, now that we have the virtual machine in OVA format, we can go to the next step.
Upload images
We can import images to our whitesky.cloud BV from a whitesky.cloud BV CLI or S3.
-
The advantage of S3 is that, under the hood, it downloads large files in chunks and also provides resumable downloads in case of network interruptions.
-
You can also use the whitesky.cloud BV CLI, as it offers simple commands that can help you import your VM to whitesky.cloud BV portal in no time.
If you do not have an S3 server at your disposal, check the deploy S3 tutorial to learn more about deploying S3 with MinIO client and you can find a list of MinIO commands in the Objectspaces documentation. You can download the MinIO client from the official MinIO website.
Using S3 Server
Assuming that an alias myMinio
has been set on your mc tool, you can set such an alias via this command:
mc alias set myMinio <S3_SERVER_LINK> <S3_SERVER_ACCESS_KEY> <S3_SERVER_SECRET_KEY>
Start by creating a bucket on the MinIO appliance.
mc mb myMinio/vmware-exports
Bucket created successfully `myMinio/vmware-exports`.
Then we copy the .ova
file to the bucket.
mc cp win.ova myMinio/vmware-exports
Importing the OVA into the whitesky.cloud BV portal
Pre-requisites for this step
- The cloudspace to which you want to import the VM.
- You have a JWT at your disposal that has access to the cloudspace. To get your JWT, open your whitesky.cloud BV portal and click APIs on the left-side menu. You will find COPY JWT that will copy the JWT associated with your account.
Prepare the environment.
- For command line users, add your JWT token as
$JWT
in the environment variables of your terminal. - For APIs users, add your JWT token as an authorization token in your API requests.
Getting Cloudspace ID
Before you can start importing your VM to whitesky.cloud BV portal, you need to know the id of your cloudspace.
You can list the cloudspaces to which your JWT has access using the following API endpoint:
GET https://portal.whitesky.cloud/api/1/api/1/customers/{CUSTOMER_ID}/cloudspaces
If you don't like using APIs, you can go with the following curl command in your terminal:
curl -X GET "https://portal.whitesky.cloud/api/1/customers/<CUSTOMER_ID>/cloudspaces" -H "accept: application/json" -H "Authorization: bearer ${JWT}"
"result": [
{
"cloudspace_id": "lmPtZkLtMzo79jg3Nz",
"status": "DEPLOYED",
"name": "Test_CS_1",
...
},
{
"cloudspace_id": "OIPfhZYtwCQ3OeR2Mg",
"status": "DEPLOYED",
"name": "Test_CS_2",
...
},
]
Now that we know the ID of our cloudspace we can go ahead and trigger the import.
To start the import process using APIs perform the following API endpoint:
POST https://portal.whitesky.cloud/api/1/customers/{CUSTOMER_ID}/cloudspaces/{CLOUDSPACE_ID}/vms/import-s3?link={S3_SERVER_LINK}&key={S3_SERVER_ACCESS_KEY}&secret={S3_SERVER_SECRET_KEY}®ion={S3_REGION}&bucket={BUCKET_NAME}&object_name={OBJECT_NAME}&name={VM_NAME}&description={VM_DESCRIPTION}&vcpus={NUMBER_VCPUS}&memory={MEMORY_AMOUNT}&private_ip={PRIVATE_IP}&strict={STRICT}&boot_type={BOOT_TYPE}&os_type={IMAGE_OS_TYPE}&os_name={IMAGE_OS_NAME}
To start the import process using curl command perform the following command:
curl -X POST "https://portal.whitesky.cloud/api/1/customers/<CUSTOMER_ID>/cloudspaces/<CLOUDSPACE_ID>/vms/import-s3?link=<S3_SERVER_LINK>&key=<S3_SERVER_ACCESS_KEY>&secret=<S3_SERVER_SECRET_KEY>®ion=<S3_REGION>&bucket=<BUCKET_NAME>&object_name=<OBJECT_NAME>&name=<VM_NAME>&description=<VM_DESCRIPTION>&vcpus=<NUMBER_VCPUS>&memory=<MEMORY_AMOUNT>&private_ip=<PRIVATE_IP>&strict=<STRICT>&boot_type=<BOOT_TYPE>&os_type=<IMAGE_OS_TYPE>&os_name=<IMAGE_OS_NAME>" -H "accept: application/json" -H "Authorization: bearer ${JWT}"
Before we proceed let's discuss following arguments:
Arguments | Description |
---|---|
<CUSTOMER_ID> |
Passes your whitesky.cloud BV customer ID. |
<CLOUDSPACE_ID> |
Passes your whitesky.cloud BV cloudspace ID, which we retrieved from the "getting cloudspace ID step". |
<S3_SERVER_LINK> |
Passes the link to the MinIO appliance on which we previously uploaded my OVA image. (including https:// at the beginning of the link) |
<S3_SERVER_ACCESS_KEY> |
Passes the key for authenticating to my MinIO appliance. This key should have at least read rights to the bucket in which the OVA file is uploaded. |
<S3_SERVER_SECRET_KEY> |
Passes the secret for authenticating to the API matching the key passed in the image uploading step. |
<S3_REGION> |
Passes the region of the S3 bucket for a MinIO appliance. (e.g us-east-1) |
<BUCKET_NAME> |
Passes the name of the bucket in which we previously uploaded my OVA image. |
<OBJECT_NAME> |
Passes the name of the file we uploaded to the bucket. |
<VM_NAME> |
Passes the name for the imported virtual machine. |
<VM_DESCRIPTION> |
Passes the description of the VM, if any. |
<NUMBER_VCPUS> |
Passes how many virtual CPU's the imported virtual machine should have. |
<MEMORY_AMOUNT> |
Passes how much memory the imported virtual machine should have in MiB. |
<PRIVATE_IP> |
Passes the private IP of the machine. |
<STRICT> |
Passes whether to import vm as close as possible to original hw or not. (Default value = false) |
<BOOT_TYPE> |
Passes the VM boot type. Available values : bios, uefi. (Default value : bios) |
<IMAGE_OS_TYPE> |
Specifies the image type for the imported machine. Types must be either Windows, Unix, Linux, BSD, Darwin or Other. |
<IMAGE_OS_NAME> |
Specifies the image name for the imported machine. (e.g Ubuntu 20.04, Windows Server 2012, etc..) Check the list of the supported images in the images documentation. |
So now we have to wait until the import process finishes. To make sure that the upload process succeeded, open the whitesky.cloud BV portal and check the VMs in the cloudspace that you've used in your commands. If the import process is completed successfully, you will find your VM between the VMs of your cloudspace.
Additionally, you can check the VM using the following API endpoint:
GET https://portal.whitesky.cloud/api/1/customers/{CUSTOMER_ID}/cloudspaces/{CLOUDSPACE_ID}/vms
On the other hand when using the curl command, perform the following command:
curl -X GET "https://portal.whitesky.cloud/api/1/customers/<CUSTOMER_ID>/cloudspaces/<CLOUDSPACE_ID>/vms" -H "accept: application/json" -H "Authorization: bearer ${JWT}"
"result": [
{
"vm_id": 53585,
"name": "Windows 2019 Standard",
"cloudspace_id": 42876,
"status": "RUNNING",
"image_id": 32,
"vcpus": 1,
"memory": 2048,
...
},
{
"vm_id": 62457,
"name": "Windows Server 2016",
"cloudspace_id": 42876,
"status": "RUNNING",
"image_id": 32,
"vcpus": 1,
"memory": 1024,
...
},
...
]
This will display the list of VMs connected to your cloudspace, where you should find your newly uploaded VM, if the import process was successfully completed.
Using whitesky.cloud BV CLI
If you want to use the whitesky.cloud BV CLI check the export and import VM using CLI tutorial to learn more about how to use your whitesky.cloud BV CLI to export/import your VM from/to whitesky.cloud BV using simple and direct commands.