Table of Contents | ||
---|---|---|
|
This tutorial describes how to capture a remote VM that is connected to a network not managed by Abiquo.
1.
...
Prepare Abiquo to capture virtual machines
To prepare to capture a remote VM, first of all you need a physical machine from which you will capture the VM:
Create the datacenter and rack, then add the physical machine
Select Retrieve virtual machines.
Screenshot: The platform marks the retrieved (or imported) VMs with the symbol.Create the networks that the captured VM will be in.
For example, in the datacenter, create public or external networks with the same specifications as the VM networks.
This means the same VLAN tag, network address, available IPs.Create the IPs for your VMs in Abiquo
Create a virtual datacenter in the datacenter for your VM.
If you created a public network, you need to purchase public IPs for your virtual datacenter from the Network / Public tab.
You will also need a virtual appliance. You can create it now or wait to do it as part of the capture process.
Import the VMs from the physical machine. To do this, go to the datacenter, select the physical machine and click on the "Retrieve VMs from maanged datastores" button.
The platform will now display the VMs running on the hypervisor that are not managed by Abiquo.
...
2. Capture the remote VM via GUI
Now you will capture the VM so that the platform can manage it.
Select the VM you want to capture and click the "Capture VM" button.
The GUI will then ask you for the virtual appliance to store the VM. Select your virtual appliance in the virtual datacenter with the network addresses purchased. If you didn't create a virtual appliance earlier, you can do so now by clicking the + button.
Check the General Information, on the Network tab, select the appropriate NICs and IP address, and check Disks.
Accept the capture and the remote VM will be added to the virtual appliance and managed by Abiquo.
You can check the VM configuration on the details panel or when you edit the VM.
The platform will now display the Release VM button instead of the Capture VM button.
...
3. Capture a VM using the API
You can capture a VM using the API and once you get started, it's not such a daunting task as it might first seem! A good working knowledge of the Abiquo API is required, but as always, if you get stuck, you can always open your browser console and take a look at how the Abiquo UI does it!
...
Retrieve the virtual appliance the VM will be captured into
The POST to capture the VM is made to the virtual machines URL of the virtual appliance.
It's not really necessary to get the whole virtual appliance, but by doing so, you can validate the link and check that you have the right virtual appliance!
Retrieve the virtual machine with resources from the hypervisor in Abiquo
You will modify this virtualmachineflat object to create the request payload for the POST request
Retrieve network interfaces for configuration
You will need the network link and the IP address, to include them in the virtualmachineflat object
Optionally retrieve a costcode object to add to the VM
Modify the virtualmachineflat object
Post the virtualmachineflat object to the virtual machines URL of the virtual appliance
...
3.1.
Retrieve virtual appliance
Using the virtual datacenter ID, retrieve all virtual appliances. See https://wiki.abiquo.com/api/latest/VirtualAppliancesResource.html#list-virtual-appliances
...
Expand | ||
---|---|---|
| ||
|
...
3.2. Retrieve virtual machine from the hypervisor
Retrieve all the VMs from the hypervisor, using sync=true. Identify the required VM. Obtain a flat representation of the VM that includes the disks and network interface details (MAC address and sequence number).
...
Expand | ||
---|---|---|
| ||
|
...
3.3. Retrieve network details and IP addresses
Retrieve IPs from the external network that are available in the datacenter and then retrieve the appropriate IP for the VM.
...
Expand | ||
---|---|---|
|
...
3.4. Create virtualmachineflat data transfer object
Change the virtual machine links as follows.
...
Expand | ||
---|---|---|
|
...
3.5. Optionally retrieve a cost code to add to the VM
You can optionally add a cost code to the VM as part of the capture process. You can use the "has" parameter to search for the cost code name, then retrieve the required cost code by ID.
...
The platform will account the VM by its template cost code.
...
3.6. Capture the virtual machine
To capture the machine, send the virtualmachineflat data transfer object as part of a post request to the virtual machines URL of the virtual appliance that will hold the captured virtual machine.
...