Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

...

...

...

Table of Contents
minLevel2

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:

  1. Create the datacenter and rack, then add the physical machine

  2. Select Retrieve virtual machines.
    Screenshot: The platform marks the retrieved (or imported) VMs with the 

...

  1. (warning) symbol. 

...

  1.  Imported VMs in the Virtual machines list for physical machineImage Added

  2. 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. 

...

  1.  Create a network to match the VM networkImage Added
  2. Create the IPs for your VMs in

...

  1. Abiquo 

  2. Create a virtual datacenter in the datacenter for your VM. 

  3. If you created a public network, you need to purchase public IPs for your virtual datacenter from the Network / Public tab.

...

  1.  Purchase a public IPImage Added
  2. You will also need a virtual appliance. You can create it now or wait to do it as part of the capture process.

  3. Import the VMs from the physical machine. To do this, go to the datacenter, select the physical machine and click

...

  1. the

...

  1. Retrieve VMs from

...

  1. managed datastores

...

  1. button.

...

  1. Image Added

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.

  1. Select the VM you want to capture and click the

...

  1. Capture VM

...

  1. button.

    Image Modified

  2. 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 + add button.

...

  1. Select or create a virtual appliance for the VM to captureImage Added
  2. Check the General Information, on the Network tab, select the appropriate NICs and IP address, and check the Disks. 

    Image Modified
    VM General information
    Image Modified
    VM Network

  3. 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. The Release VM button is a box with an arrow pointing outwards.

...

  1. The control panel for a captured VM has a Release buttonImage Added

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! 

Note that the Abiquo UI enables you to create a virtual appliance or a network address as part of the capture process but these steps are not included in this tutorial.

First be sure to do the preparatory steps and obtain the information about the VM and the environment that you will require to create the VM object.

Before you begin:

  • In Abiquo, determine the ID of:

    • The enterprise the VM will be captured for

    • The datacenter where it will be captured

    • The physical machine (hypervisor) where it will be captured from

  • In the hypervisor:

    • Check the VM name

    • Check the network details including the VLAN tag 

  • In the virtual machine

    • Check the IP addresses of the NICs

  • In Abiquo, create the following and make a note of the IDs:

    • The virtual datacenter that the VM will be captured into

    • The networks that the VM will belong to

    • The IP addresses for the VM in the networks

    • The virtual appliance that the VM will be captured into

To capture a VM using the API

  1. Retrieve the virtual appliance the VM will be captured into

    1. 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!

  2. Retrieve the virtual machine with resources from the hypervisor in Abiquo

    1. You will modify this virtualmachineflat object to create the request payload for the POST request

  3. Retrieve network interfaces for configuration 

    1. You will need the network link and the IP address, to include them in the virtualmachineflat object

  4. Optionally retrieve a costcode object to add to the VM

  5. Modify the virtualmachineflat object

  6. 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

...

Code Block
curl --verbose -k -u admin:xabiquo -X GET "https://mjsabiquo.bcn.abiquo.com/api/cloud/virtualdatacenters/3/virtualappliances" -H "accept:application/vnd.abiquo.virtualappliances+json;version=4.7" | jq '.'

Expand
titleClick here to show/hide the request example
Code Block
> GET /api/cloud/virtualdatacenters/3/virtualappliances HTTP/1.1
> Host: mjsabiquo.bcn.abiquo.com
> Authorization: Basic YWRtaW46eGFiaXF1bw==
> User-Agent: curl/7.54.0
> accept:application/vnd.abiquo.virtualappliances+json;version=4.7
> 
< HTTP/1.1 200 200
< Date: Mon, 18 Nov 2019 16:38:38 GMT
< Server: Apache
< Set-Cookie: ABQSESSIONID=6906893432497011639; Max-Age=1800; Expires=Mon, 18-Nov-2019 17:08:39 GMT; Path=/; Secure; HttpOnly
< X-Abiquo-TracerContext: f4c925e1-4bc7-4470-91bf-03ee604e568e
< X-Abiquo-Token: 9a5a5c937821bb44506d654af977b90ad97d4968e49bea58d699034a8a783416
< Content-Type: application/vnd.abiquo.virtualappliances+json; version=4.7
< Transfer-Encoding: chunked
< 
{
  "totalSize": 1,
  "links": [
    {
      "rel": "first",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances?limit=25&by=name&asc=true"
    },
    {
      "rel": "last",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances?startwith=0&limit=25&by=name&asc=true"
    }
  ],
  "collection": [
    {
      "id": 3,
      "error": 0,
      "highDisponibility": 0,
      "name": "vmware_vapp_01",
      "publicApp": 0,
      "state": "EMPTY",
      "restricted": false,
      "description": "Vapp",
      "notAllocatedVirtualMachines": 0,
      "onVirtualMachines": 0,
      "offVirtualMachines": 0,
      "pausedVirtualMachines": 0,
      "allocatedVirtualMachines": 0,
      "configuredVirtualMachines": 0,
      "unknownVirtualMachines": 0,
      "lockedVirtualMachines": 0,
      "links": [
        {
          "title": "vmware_vapp_01",
          "rel": "edit",
          "type": "application/vnd.abiquo.virtualappliance+json",
          "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3"
        },
        {
          "title": "vmware_vdc_01",
          "rel": "virtualdatacenter",
          "type": "application/vnd.abiquo.virtualdatacenter+json",
          "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3"
        },
        {
          "title": "Abiquo",
          "rel": "enterprise",
          "type": "application/vnd.abiquo.enterprise+json",
          "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/1"
        },
        {
          "title": "virtual machines",
          "rel": "virtualmachines",
          "type": "application/vnd.abiquo.virtualmachines+json",
          "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines"
        },
        {
          "title": "virtual appliances state",
          "rel": "state",
          "type": "application/vnd.abiquo.virtualappliancestate+json",
          "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/state"
        },
        {
          "title": "undeploy",
          "rel": "undeploy",
          "type": "application/vnd.abiquo.acceptedrequest+json",
          "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/action/undeploy"
        },
        {
          "title": "deploy",
          "rel": "deploy",
          "type": "application/vnd.abiquo.acceptedrequest+json",
          "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/action/deploy"
        },
        {
          "title": "price",
          "rel": "price",
          "type": "text/plain",
          "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/action/price"
        },
        {
          "title": "layers",
          "rel": "layers",
          "type": "application/vnd.abiquo.layers+json",
          "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/layers"
        },
        {
          "title": "spec",
          "rel": "spec",
          "type": "application/vnd.abiquo.virtualappliancespec+json",
          "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/action/spec"
        },
        {
          "title": "tasks",
          "rel": "tasks",
          "type": "application/vnd.abiquo.tasks+json",
          "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/tasks"
        },
        {
          "title": "scalinggroups",
          "rel": "scalinggroups",
          "type": "application/vnd.abiquo.scalinggroups+json",
          "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/scalinggroups"
        },
        {
          "title": "metricsmetadata",
          "rel": "metricsmetadata",
          "type": "application/vnd.abiquo.metricsmetadata+json",
          "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/metrics"
        },
        {
          "title": "collectd",
          "rel": "collectd",
          "type": "application/json",
          "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/metrics/collectd"
        },
        {
          "title": "alarmssearch",
          "rel": "alarmssearch",
          "type": "application/vnd.abiquo.alarms+json",
          "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/alarms"
        }
      ]
    }
  ]
}

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).

Code Block
curl --verbose -k -u admin:xabiquo -X GET "https://mjsabiquo.bcn.abiquo.com/api/admin/datacenters/2/racks/2/machines/3/virtualmachines/174?sync=true"  -H "accept:application/vnd.abiquo.virtualmachineflat+json;version=4.7" | jq '.'

Expand
titleClick here to show/hide the request example
Code Block
> GET /api/admin/datacenters/2/racks/2/machines/3/virtualmachines/174?sync=true HTTP/1.1
> Host: mjsabiquo.bcn.abiquo.com
> Authorization: Basic YWRtaW46eGFiaXF1bw==
> User-Agent: curl/7.54.0
> accept:application/vnd.abiquo.virtualmachineflat+json;version=4.7
> 
< HTTP/1.1 200 200
< Date: Mon, 18 Nov 2019 16:46:18 GMT
< Server: Apache
< Set-Cookie: ABQSESSIONID=2804812929327814519; Max-Age=1800; Expires=Mon, 18-Nov-2019 17:16:19 GMT; Path=/; Secure; HttpOnly
< X-Abiquo-TracerContext: bf65ad7d-86ab-4414-a5aa-bf82c077f11a
< X-Abiquo-Token: 9a5a5c937821bb44506d654af977b90a8d911c6bcdccbb1464b09b41fd89e48b
< Content-Type: application/vnd.abiquo.virtualmachineflat+json; version=4.7
< Transfer-Encoding: chunked
< 
{
  "volumes": {
    "links": [],
    "collection": []
  },
  "disks": {
    "links": [],
    "collection": [
      {
        "label": "",
        "sequence": 0,
        "sizeInMb": 64,
        "diskFormatType": "VMDK_FLAT",
        "path": "ABQ_4e04e585-cf68-4223-b2a7-4feed06a7b9a/ABQ_4e04e585-cf68-4223-b2a7-4feed06a7b9a65d4b10d-b8e2-42d4-93f0-ac470ecc2df2-flat.vmdk",
        "diskFileSize": 67108864,
        "diskControllerType": "IDE",
        "bus": 0,
        "unit": 0,
        "bootable": true,
        "uuid": "65d4b10d-b8e2-42d4-93f0-ac470ecc2df2",
        "links": []
      }
    ]
  },
  "nics": {
    "links": [],
    "collection": [
      {
        "mac": "00:50:56:14:4D:23",
        "sequence": 0,
        "tag": 3,
        "links": []
      },
      {
        "mac": "00:50:56:25:71:EE",
        "sequence": 1,
        "tag": 2,
        "links": []
      }
    ]
  },
  "id": 174,
  "uuid": "4e04e585-cf68-4223-b2a7-4feed06a7b9a",
  "name": "ABQ_4e04e585-cf68-4223-b2a7-4feed06a7b9a",
  "label": "ABQ_4e04e585-cf68-4223-b2a7-4feed06a7b9a",
  "description": "",
  "ram": 48,
  "cpu": 1,
  "vdrpPort": 5910,
  "vdrpIP": "10.60.2.43",
  "vdrpEnabled": true,
  "idState": 4,
  "state": "ON",
  "highDisponibility": 0,
  "idType": 0,
  "type": "NOT_MANAGED",
  "password": "WatpDKTK",
  "monitored": false,
  "monitoringLevel": "DEFAULT",
  "variables": {},
  "creationTimestamp": 1573129740000,
  "lastSynchronize": 1574090616000,
  "fqdn": "box.localdomain",
  "generateGuestInitialPassword": false,
  "internalProviderId": "vm-43761-at-10.60.11.242",
  "protected": false,
  "links": [
    {
      "title": "VMX_04",
      "rel": "machine",
      "type": "application/vnd.abiquo.machine+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/2/racks/2/machines/3"
    },
    {
      "title": "BCDC",
      "rel": "location",
      "type": "application/vnd.abiquo.datacenter+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/2"
    },
    {
      "title": "VMware vCenter",
      "rel": "hypervisortype",
      "type": "application/vnd.abiquo.hypervisortype+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/config/hypervisortypes/VMX_04"
    },
    {
      "title": "ABQ_4e04e585-cf68-4223-b2a7-4feed06a7b9a",
      "rel": "edit",
      "type": "application/vnd.abiquo.virtualmachine+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/2/racks/2/machines/3/virtualmachines/174"
    }
  ],
  "backuppolicies": [],
  "natrules": []
}

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.

Code Block
curl --verbose -k -u admin:xabiquo -X GET "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/1/limits/2/externalnetworks/7/ips/16"  -H "accept:application/vnd.abiquo.externalip+json;version=4.7" | jq '.' 

Expand
Code Block
> GET /api/admin/enterprises/1/limits/2/externalnetworks/7/ips/16 HTTP/1.1
> Host: mjsabiquo.bcn.abiquo.com
> Authorization: Basic YWRtaW46eGFiaXF1bw==
> User-Agent: curl/7.54.0
> accept:application/vnd.abiquo.externalip+json;version=4.7
> 
< HTTP/1.1 200 200
< Date: Mon, 18 Nov 2019 16:50:27 GMT
< Server: Apache
< Set-Cookie: ABQSESSIONID=377940815957123584; Max-Age=1800; Expires=Mon, 18-Nov-2019 17:20:28 GMT; Path=/; Secure; HttpOnly
< X-Abiquo-TracerContext: cb421aee-9a3c-42f9-9e2e-542c78baa82e
< X-Abiquo-Token: 9a5a5c937821bb44506d654af977b90a70900b698c0994f9571f704bb17e9bf5
< Content-Type: application/vnd.abiquo.externalip+json; version=4.7
< Transfer-Encoding: chunked
< 
{
  "available": true,
  "id": 16,
  "ip": "192.168.55.1",
  "networkName": "Abiquo_external_002",
  "ipv6": false,
  "quarantine": false,
  "links": [
    {
      "title": "Abiquo_external_002",
      "rel": "externalnetwork",
      "type": "application/vnd.abiquo.vlan+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/1/limits/2/externalnetworks/7"
    },
    {
      "title": "ips",
      "rel": "ips",
      "type": "application/vnd.abiquo.externalips+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/1/limits/2/externalnetworks/7/ips"
    },
    {
      "title": "192.168.55.1",
      "rel": "self",
      "type": "application/vnd.abiquo.externalip+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/1/limits/2/externalnetworks/7/ips/16"
    }
  ]
}

Retrieve IPs from the public network that have been purchased and are available to the virtual datacenter. Select and retrieve the appropriate public IP. To start with, first we used the "has" parameter to identify the required IP address.

...

Code Block
curl --verbose -k -u admin:xabiquo -X GET "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/publicips/purchased/30"  -H "accept:application/vnd.abiquo.publicip+json;version=4.7" | jq '.'

Expand
Code Block
> GET /api/cloud/virtualdatacenters/3/publicips/purchased/30 HTTP/1.1
> Host: mjsabiquo.bcn.abiquo.com
> Authorization: Basic YWRtaW46eGFiaXF1bw==
> User-Agent: curl/7.54.0
> accept:application/vnd.abiquo.publicip+json;version=4.7
> 
< HTTP/1.1 200 200
< Date: Mon, 18 Nov 2019 17:04:37 GMT
< Server: Apache
< Set-Cookie: ABQSESSIONID=2838884776872119279; Max-Age=1800; Expires=Mon, 18-Nov-2019 17:34:38 GMT; Path=/; Secure; HttpOnly
< X-Abiquo-TracerContext: a3b2c04f-b9a3-4e9c-a54e-1a1085c938e7
< X-Abiquo-Token: 9a5a5c937821bb44506d654af977b90a0965d6b9c04f6200f8fcde6f04f43cec
< Content-Type: application/vnd.abiquo.publicip+json; version=4.7
< Transfer-Encoding: chunked
< 
{
  "available": true,
  "id": 30,
  "ip": "192.168.56.3",
  "mac": "00:50:56:26:D5:3D",
  "name": "00505626D53D_host",
  "networkName": "Capture_public_003",
  "ipv6": false,
  "quarantine": false,
  "links": [
    {
      "title": "Capture_public_003",
      "rel": "publicnetwork",
      "type": "application/vnd.abiquo.vlan+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/2/network/8"
    },
    {
      "title": "purchased ips",
      "rel": "purchased",
      "type": "application/vnd.abiquo.publicips+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/publicips/purchased"
    },
    {
      "title": "release ip",
      "rel": "release",
      "type": "application/vnd.abiquo.publicip+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/publicips/topurchase/30"
    },
    {
      "title": "192.168.56.3",
      "rel": "self",
      "type": "application/vnd.abiquo.publicip+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/publicips/purchased/30"
    },
    {
      "title": "vmware_vdc_01",
      "rel": "virtualdatacenter",
      "type": "application/vnd.abiquo.virtualdatacenter+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3"
    }
  ]
}

3.4. Create virtualmachineflat data transfer object

Change the virtual machine links as follows.

...

Expand

For example, from the public IP address, obtain the link with a "rel" value of "publicnetwork".

Code Block
     {
      "title": "Capture_public_003",
      "rel": "publicnetwork",
      "type": "application/vnd.abiquo.vlan+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/2/network/8"
    }

Change the "rel" value to "vlan".

Code Block
    {
      "title": "Capture_public_003",
      "rel": "vlan",
      "type": "application/vnd.abiquo.vlan+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/2/network/8"
    }

For this network, also note the IP value

Code Block
      "ip":"192.168.56.3"

And for example, for the external IP address, obtain the link with a "rel" value of "externalnetwork".

Code Block
        {
            "title": "Abiquo_external_002",
            "rel": "externalnetwork",
            "type": "application/vnd.abiquo.vlan+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/1/limits/2/externalnetworks/7"
        }

Again, change the value of the "rel" attribute to "vlan".

Code Block
        {
            "title": "Abiquo_external_002",
            "rel": "vlan",
            "type": "application/vnd.abiquo.vlan+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/1/limits/2/externalnetworks/7"
        }

And note the value of the IP

Code Block
      "ip":"192.168.55.1"

Add the links to the nics / collection / links section for each NIC and the IP to the main section of each NIC after the tag value (don't forget the comma).

...

Expand
Code Block
{
    "volumes": {
        "links": [],
        "collection": []
    },
    "disks": {
        "links": [],
        "collection": [
            {
                "label": "",
                "sequence": 0,
                "sizeInMb": 64,
                "diskFormatType": "VMDK_FLAT",
                "path": "ABQ_4e04e585-cf68-4223-b2a7-4feed06a7b9a/ABQ_4e04e585-cf68-4223-b2a7-4feed06a7b9a65d4b10d-b8e2-42d4-93f0-ac470ecc2df2-flat.vmdk",
                "diskFileSize": 67108864,
                "diskControllerType": "IDE",
                "bus": 0,
                "unit": 0,
                "bootable": true,
                "uuid": "65d4b10d-b8e2-42d4-93f0-ac470ecc2df2",
                "links": []
            }
        ]
    },
    "nics": {
        "links": [],
        "collection": [
            {
                "mac": "00:50:56:14:4D:23",
                "sequence": 0,
                "tag": 3,
                "links": [
					{
      					"title": "Capture_public_003",
      					"rel": "vlan",
      					"type": "application/vnd.abiquo.vlan+json",
      					"href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/2/network/8"
    				}
				],
				"ip": "192.168.56.3"
            },
            {
                "mac": "00:50:56:25:71:EE",
                "sequence": 1,
                "tag": 2,
                "links": [        
					{
    					"title": "Abiquo_external_002",
            			"rel": "vlan",
            			"type": "application/vnd.abiquo.vlan+json",
				        "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/1/limits/2/externalnetworks/7"
        			}
				],
				"ip": "192.168.55.1"
            }
        ]
    },
    "id": 174,
    "uuid": "4e04e585-cf68-4223-b2a7-4feed06a7b9a",
    "name": "ABQ_4e04e585-cf68-4223-b2a7-4feed06a7b9a",
    "label": "ABQ_4e04e585-cf68-4223-b2a7-4feed06a7b9a",
    "description": "",
    "ram": 48,
    "cpu": 1,
    "vdrpPort": 5910,
    "vdrpIP": "10.60.2.43",
    "vdrpEnabled": true,
    "idState": 4,
    "state": "ON",
    "highDisponibility": 0,
    "idType": 0,
    "type": "NOT_MANAGED",
    "password": "WatpDKTK",
    "monitored": false,
    "monitoringLevel": "DEFAULT",
    "variables": {},
    "creationTimestamp": 1573129740000,
    "lastSynchronize": 1574090616000,
    "fqdn": "box.localdomain",
    "generateGuestInitialPassword": false,
    "internalProviderId": "vm-43761-at-10.60.11.242",
    "protected": false,
    "links": [
        {
            "title": "VMX_04",
            "rel": "machine",
            "type": "application/vnd.abiquo.machine+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/2/racks/2/machines/3"
        },
        {
            "title": "BCDC",
            "rel": "location",
            "type": "application/vnd.abiquo.datacenter+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/2"
        },
        {
            "title": "VMware vCenter",
            "rel": "hypervisortype",
            "type": "application/vnd.abiquo.hypervisortype+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/config/hypervisortypes/VMX_04"
        },
        {
            "title": "ABQ_4e04e585-cf68-4223-b2a7-4feed06a7b9a",
            "rel": "virtualmachine",
            "type": "application/vnd.abiquo.virtualmachine+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/2/racks/2/machines/3/virtualmachines/174"
        },
        {
            "title": "ABQ_4e04e585-cf68-4223-b2a7-4feed06a7b9a",
            "rel": "imported",
            "type": "application/vnd.abiquo.virtualmachine+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/2/racks/2/machines/3/virtualmachines/174"
        }
    ],
    "backuppolicies": [],
    "natrules": []
}

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.

...

Expand
Code Block
{
  "volumes": {
    "links": [],
    "collection": []
  },
  "disks": {
    "links": [],
    "collection": [
      {
        "id": 41,
        "label": "",
        "sequence": 0,
        "sizeInMb": 64,
        "diskFormatType": "VMDK_FLAT",
        "path": "ABQ_4e04e585-cf68-4223-b2a7-4feed06a7b9a/ABQ_4e04e585-cf68-4223-b2a7-4feed06a7b9a65d4b10d-b8e2-42d4-93f0-ac470ecc2df2-flat.vmdk",
        "diskFileSize": 67108864,
        "diskControllerType": "IDE",
        "bus": 0,
        "unit": 0,
        "bootable": true,
        "uuid": "65d4b10d-b8e2-42d4-93f0-ac470ecc2df2",
        "links": [
          {
            "title": "vmware_vdc_01",
            "rel": "virtualdatacenter",
            "type": "application/vnd.abiquo.virtualdatacenter+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3"
          },
          {
            "diskControllerType": "IDE",
            "diskLabel": "",
            "rel": "disk0",
            "type": "application/vnd.abiquo.harddisk+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/disks/41"
          },
          {
            "title": "disk",
            "rel": "disk",
            "type": "application/vnd.abiquo.disk+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/1/datacenterrepositories/2/virtualmachinetemplates/215/disks/268"
          },
          {
            "title": "ABQ_4e04e585-cf68-4223-b2a7-4feed06a7b9a",
            "rel": "virtualmachine",
            "type": "application/vnd.abiquo.virtualmachine+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174"
          },
          {
            "title": "Default Tier",
            "rel": "datastoretier",
            "type": "application/vnd.abiquo.datastoretier+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/2/datastoretiers/2"
          }
        ]
      }
    ]
  },
  "nics": {
    "links": [],
    "collection": [
      {
        "id": 16,
        "ip": "192.168.55.1",
        "mac": "00:50:56:25:71:EE",
        "sequence": 1,
        "tag": 2,
        "links": [
          {
            "title": "00:50:56:25:71:EE",
            "rel": "self",
            "type": "application/vnd.abiquo.nic+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174/network/nics/16"
          },
          {
            "title": "192.168.55.1",
            "rel": "edit",
            "type": "application/vnd.abiquo.externalip+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/1/limits/2/externalnetworks/7/ips/16"
          },
          {
            "title": "Abiquo_external_002",
            "rel": "externalnetwork",
            "type": "application/vnd.abiquo.vlan+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/1/limits/2/externalnetworks/7"
          }
        ]
      },
      {
        "id": 30,
        "ip": "192.168.56.3",
        "mac": "00:50:56:14:4D:23",
        "sequence": 0,
        "tag": 3,
        "links": [
          {
            "title": "00:50:56:14:4D:23",
            "rel": "self",
            "type": "application/vnd.abiquo.nic+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174/network/nics/30"
          },
          {
            "title": "192.168.56.3",
            "rel": "edit",
            "type": "application/vnd.abiquo.publicip+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/publicips/purchased/30"
          },
          {
            "title": "Capture_public_003",
            "rel": "publicnetwork",
            "type": "application/vnd.abiquo.vlan+json",
            "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/2/network/8"
          }
        ]
      }
    ]
  },
  "id": 174,
  "uuid": "4e04e585-cf68-4223-b2a7-4feed06a7b9a",
  "name": "ABQ_4e04e585-cf68-4223-b2a7-4feed06a7b9a",
  "label": "ABQ_4e04e585-cf68-4223-b2a7-4feed06a7b9a",
  "description": "",
  "ram": 48,
  "cpu": 1,
  "vdrpPort": 5910,
  "vdrpIP": "10.60.2.43",
  "vdrpEnabled": true,
  "idState": 4,
  "state": "ON",
  "highDisponibility": 0,
  "idType": 0,
  "type": "CAPTURED",
  "password": "WatpDKTK",
  "monitored": false,
  "monitoringLevel": "DEFAULT",
  "variables": {},
  "creationTimestamp": 1573129740000,
  "lastSynchronize": 1574099702000,
  "fqdn": "box.localdomain",
  "generateGuestInitialPassword": false,
  "internalProviderId": "vm-43761-at-10.60.11.242",
  "protected": false,
  "links": [
    {
      "title": "VMX_04",
      "rel": "machine",
      "type": "application/vnd.abiquo.machine+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/2/racks/2/machines/3"
    },
    {
      "title": "BCDC",
      "rel": "location",
      "type": "application/vnd.abiquo.datacenter+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/2"
    },
    {
      "title": "Abiquo",
      "rel": "enterprise",
      "type": "application/vnd.abiquo.enterprise+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/1"
    },
    {
      "title": "ABQ_4e04e585-cf68-4223-b2a7-4feed06a7b9a",
      "rel": "edit",
      "type": "application/vnd.abiquo.virtualmachine+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174"
    },
    {
      "title": "send mail",
      "rel": "sendmail",
      "type": "application/vnd.abiquo.mail+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/2/racks/2/machines/3/virtualmachines/174/action/sendmail"
    },
    {
      "title": "Cloud Administrator",
      "rel": "user",
      "type": "application/vnd.abiquo.user+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/1/users/1"
    },
    {
      "title": "vmware_vdc_01",
      "rel": "virtualdatacenter",
      "type": "application/vnd.abiquo.virtualdatacenter+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3"
    },
    {
      "title": "vmware_vapp_01",
      "rel": "virtualappliance",
      "type": "application/vnd.abiquo.virtualappliance+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3"
    },
    {
      "title": "metadata",
      "rel": "metadata",
      "type": "application/vnd.abiquo.metadata+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174/metadata"
    },
    {
      "title": "vlan network configurations",
      "rel": "configurations",
      "type": "application/vnd.abiquo.virtualmachinenetworkconfigurations+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174/network/configurations"
    },
    {
      "title": "nics",
      "rel": "nics",
      "type": "application/vnd.abiquo.nics+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174/network/nics"
    },
    {
      "title": "disks",
      "rel": "harddisks",
      "type": "application/vnd.abiquo.harddisks+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174/storage/disks"
    },
    {
      "title": "ON",
      "rel": "state",
      "type": "application/vnd.abiquo.virtualmachinestate+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174/state"
    },
    {
      "title": "virtual machine undeploy",
      "rel": "undeploy",
      "type": "application/vnd.abiquo.acceptedrequest+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174/action/undeploy"
    },
    {
      "title": "virtual machine deploy",
      "rel": "deploy",
      "type": "application/vnd.abiquo.acceptedrequest+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174/action/deploy"
    },
    {
      "title": "virtual machine reset",
      "rel": "reset",
      "type": "application/vnd.abiquo.acceptedrequest+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174/action/reset"
    },
    {
      "title": "virtual machine snapshot",
      "rel": "instance",
      "type": "application/vnd.abiquo.acceptedrequest+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174/action/instance"
    },
    {
      "title": "remote access",
      "rel": "rdpaccess",
      "type": "application/vnd.abiquo.virtualmachineconsole+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174/config/rdpaccess"
    },
    {
      "title": "tasks",
      "rel": "tasks",
      "type": "application/vnd.abiquo.tasks+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174/tasks"
    },
    {
      "title": "firewalls",
      "rel": "firewalls",
      "type": "application/vnd.abiquo.links+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174/firewalls"
    },
    {
      "title": "load balancers",
      "rel": "loadbalancers",
      "type": "application/vnd.abiquo.loadbalancers+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174/loadbalancers"
    },
    {
      "title": "request on demand backup",
      "rel": "requestbackup",
      "type": "application/vnd.abiquo.ondemandbackup+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174/backup/action/request"
    },
    {
      "title": "request a restore of a backup",
      "rel": "requestrestore",
      "type": "application/vnd.abiquo.restore+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174/backup/action/restore"
    },
    {
      "title": "move VM to a virtual appliance",
      "rel": "vappmove",
      "type": "application/vnd.abiquo.links+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174/action/vappmove"
    },
    {
      "title": "move VM to another virtual datacenter",
      "rel": "move",
      "type": "application/vnd.abiquo.movevm+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174/action/move"
    },
    {
      "title": "relocate candidates",
      "rel": "relocatecandidates",
      "type": "application/vnd.abiquo.links+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174/action/relocatecandidates"
    },
    {
      "title": "relocate",
      "rel": "relocate",
      "type": "application/vnd.abiquo.acceptedrequest+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174/action/relocate"
    },
    {
      "title": "volumes",
      "rel": "volumes",
      "type": "application/vnd.abiquo.volumes+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174/storage/volumes"
    },
    {
      "title": "protect",
      "rel": "protect",
      "type": "text/plain",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174/action/protect"
    },
    {
      "title": "unprotect",
      "rel": "unprotect",
      "type": "text/plain",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174/action/unprotect"
    },
    {
      "title": "metricsmetadata",
      "rel": "metricsmetadata",
      "type": "application/vnd.abiquo.metricsmetadata+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174/metrics"
    },
    {
      "title": "enablemonitoring",
      "rel": "enablemonitoring",
      "type": "",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174/enablemonitoring"
    },
    {
      "title": "collectd",
      "rel": "collectd",
      "type": "application/json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174/metrics/collectd"
    },
    {
      "title": "alarmssearch",
      "rel": "alarmssearch",
      "type": "application/vnd.abiquo.alarms+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174/alarms"
    },
    {
      "title": "clone",
      "rel": "clone",
      "type": "application/vnd.abiquo.virtualmachinecloneoptions+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/3/virtualappliances/3/virtualmachines/174/action/clone"
    },
    {
      "title": "VMware vCenter",
      "rel": "hypervisortype",
      "type": "application/vnd.abiquo.hypervisortype+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/config/hypervisortypes/VMX_04"
    },
    {
      "title": "ABQ_4e04e585-cf68-4223-b2a7-4feed06a7b9a_image",
      "rel": "virtualmachinetemplate",
      "type": "application/vnd.abiquo.virtualmachinetemplate+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/1/datacenterrepositories/2/virtualmachinetemplates/215"
    },
    {
      "title": "Others",
      "rel": "category",
      "type": "application/vnd.abiquo.category+json",
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/config/categories/1"
    }
  ],
  "backuppolicies": [],
  "natrules": []
}