Abiquo Documentation Cookies Policy

Our Documentation website uses cookies to improve your experience. Please visit our Cookie Policy page for more information about cookies and how we use them.


Abiquo 4.7

Skip to end of metadata
Go to start of metadata

Protect a VM

An administrator can block actions on a VM by other users that do not have the Protect virtual machine privilege.

You can lock or protect a deployed VM when it is powered on, paused, or powered off.

Privilege: Protect virtual machine

To protect a VM

  1. Select the VM and click the Protect VM padlock button near the Deploy VM button
  2. In the Protect virtual machine dialog, enter the reason for protecting the VM.

When a VM is protected, the platform will display a small padlock symbol in the top left corner of the VM icon and change the status of the VM to MAINTENANCE. You can customize this status in the UI labels. The user cannot work with a protected VM in the platform. See Manage Virtual Machines#Protected VM

The name of the administrator who blocked the VM and the reason display in VM details → General.

To release the blocked VM, click the Unprotect padlock button near the deploy button.

Restrict virtual appliances and VMs

Restricted virtual appliances and their contents are effectively not visible and/or operable by users without the appropriate privileges. This feature could be used for cases such as outsourcing virtual appliances or running provider applications in the user’s VDC.

Privileges: Manage restricted VApps and VMs, View restricted VApps and VMs, Restrict VM

Screenshot: the platform displays restricted virtual appliances with the label "Restricted". These VApps and their VMs and scaling groups do not display for a user without the privilege to view them.

Users who can Manage restricted virtual appliances can select the Restricted checkbox when creating or editing a virtual appliance. For other users this checkbox will not display. Users with this privilege can work with VMs in restricted VApps.

To restrict a VM by moving it to a restricted VApp:

  1. Click the VM move button on the VM control panel
  2. To move a VM to a restricted virtual appliance, the user can do one of the following depending on their privileges:
    • select the option to move the VM to a restricted VApp
    • select a restricted VApp from the list
    • create a new restricted VApp.

Relocate a deployed VM to another host

The relocate VM feature enables you to move a deployed VM to another hypervisor on the same rack with the same manager. This feature is available for VMware ESXi and uses the vMotion feature. This feature requires the "Relocate a VM into a compatible host" privilege. The Relocate VM button  is on the VM control panel.

Privilege: Relocate a VM into a compatible host

To relocate a VM:

  1. Go to Virtual datacenters → open Virtual appliance → Virtual machines → select VM
  2. In the VM control panel on the lower right-hand side of the screen, click the Relocate VM button  
  3. The platform will display a dialog with a list of hypervisor host where you can relocate the VM
  4. Click on the Show details link to display the host metrics and the Relocate button
  5. Select the host with the same manager where you wish to relocate the VM, go to the host section and click Relocate. The platform will display the VM status as Relocating
  6. After relocation, the new hypervisor location will display in the control panel, for example, with a new Remote access address. If you click the Relocate button again, you should see a different host list, including the original host.

Screenshot: Select the VM and click relocate

Relocate a VM to move it to a compatible host in the same datacenter using vMotion

 

 Click here to show/hide the walkthrough screenshots

Screenshot: Host selection list

Select a host to relocate a VM using vMotion

Screenshot: Host metrics and Relocate button

Check host metrics when selecting a hypervisor to relocate the VM

Screenshot: After relocation, the new host details are shown, for example, with a new Remote access address

After you relocate a VM the platform displays the new host details on the VM control panel

Screenshot: You can also check the relocation by clicking the Relocate button again, which will show the original host as a new candidate

Check relocation by clicking the relocate button again to display the original host


What happens when the user clicks deploy?

The VM scheduler deploys the VM.

A simplified description of the deploy process is shown in the following diagram.

Deploy process diagram

Deploy errors

When an error occurs during a VM deploy, the platform displays one or more of the following:
  • A yellow warning or red error notification message
  • An error state on the VM icon
    Virtual machine icon with deploy error
  • A VM warning symbol in the lower part of the VM icon. 
    Virtual machine icon with warning symbol

The user and the administrator may be notified of the error. 

The user can click on the error icon to display the events and the user can click on an event in the list to display its tracer message.

The platform displays the full details of an error in the Events view and on the Events panel in the Home view.

Events view displays deploy errors

Here is an example of an event for a failed reconfigure. 

Source: Abiquo / admin /
Date/time: 2014-4-29 13:41:41
Action: VIRTUAL_MACHINE_DEPLOY
Performed by: admin
User: admin
Trace: There are 1 candidate machines but all are oversubscribed by the current workload rules (RAM and CPU oversubscription or no suitable datastore with enough free space). Please check the workload rules or the physical machine resources. Virtual machine requires 1 CPU -- 128 RAM Candidate machines : BCN_KVM_02 ip - 10.60.13.20 .
Severity: ERROR

The VM warning symbol is based on the VM task state. The VM tasks are a collection of jobs. For example, a Deploy task includes jobs to allocate, configure, and power on the VM. If a job fails, then the task will also fail and the platform will display the warning symbol on the VM. 

To acknowledge and delete a warning symbol, click on the symbol to remove it. 

If your user role is an administrator role with the privilege to "Manage Users", then you can also delete warnings for the users of the enterprises that you manage.

 

States of VApps and VMs

It is important that administrators clearly understand the different states that virtual appliances and VMs can have in the Abiquo platform and the differences between them. In order to change the state of VMs, users will require the Perform virtual machine actions privilege.

Privilege: Perform virtual machine actions

API Feature

In the API the valid VM states are: NOT_ALLOCATED, ALLOCATED, CONFIGURED, ON, PAUSED, OFF, LOCKED and UNKNOWN. See VirtualMachineResource An additional state for protecting VMs by locking them against user actions is the MAINTENANCE state.


Virtual Machine States


StateDescription

Not Allocated

Virtual machine icon when the VM is in a NOT ALLOCATED state

The VM does not exist on the cloud node; it is just a template of the VM to be deployed and it only exists in Abiquo. The physical machine and other resources are not allocated in the cloud node and it is not consuming resources. For example, if you add a VM template to a virtual appliance with a VM that is deployed, the VM you just created is not deployed and its state is not allocated. If you undeploy a virtual appliance, then all the VMs in the virtual appliance will be undeployed, and these VMs will be in the not allocated state.

AllocatedThe VM does not exist on the cloud node but a physical machine or provider has been assigned to it. When you deploy a VM, the first step in the deploy process is the resource scheduling or allocation. After resource allocation, the VM is in the allocated state. This state is usually a short step in the deploy process.
ConfiguredThe VM exists on the cloud node. Resources such as network and volumes are allocated to it on the physical machine or in the provider. After the VM is configured in the hypervisor or provider, the VM is in the configured state. This state is usually a short step in the deploy process.

On

Virtual machine icon when the VM is ON

The final step in the deploy process is to power on the VM. A VM in the on state is exists in the cloud node and is running. 

Paused

Virtual machine icon when the VM is PAUSED

The VM exists on the cloud node and the VM is suspended.

Off

Virtual machine icon when the VM is OFF

The VM exists in the cloud node but it is not running. Resources are still allocated in the cloud node.

Locked

Virtual machine icon when the VM is LOCKED

An operation is being performed on the VM. The status bar shows LOCKED but it is covered by the progress notification. VMs awaiting workflow review will be locked with the progress notification "Waiting to be reviewed"

Unknown

Virtual machine icon when the VM is in an UNKNOWN state

The platform does not have information about the current state of the VM but the machine exists on the cloud node.  VMs may be put in the UNKNOWN state if there is an issue with a connection to the hypervisor or provider, To delete a VM in the unknown state, you need the "Delete unknown virtual machine" privilege and also access to the enterprise or the "Administer all enterprises privilege". The platform does not display VMs in the UNKNOWN state and their resources on the dashboard and it does not count them in allocation limits for CPU, RAM, and storage.

Maintenance

The administrator can lock or protect a VM for maintenance when it is in any of the deployed states of on, paused, or off. See Protect a VM

Virtual Appliance States

The virtual appliance states are calculated from the VM states as described below. The state name in the table has the color code for the Virtual appliance in each state.
StateDescription
o EmptyThere are no VMs in the virtual appliance
o DeployedSome or all of the VMs are not in the Undeployed state. All the VMs exist in the hypervisor or provider and none are in the Unknown or Locked state. Resources are allocated in the cloud node.
o UndeployedAll the VMs are in the Undeployed state. None of the VMs exist in the hypervisor or provider, and none are in the Unknown or Locked state. The virtual appliance can be seen as a template. Resources are not allocated in the cloud node.
o Needs synchronization (Deploy all VMs)This state occurs when a virtual appliance that is in the Deployed state is modified, for example, by adding a new VM. This state indicates that the configuration of the virtual appliance in the cloud node is different to the configuration of the virtual appliance in the Abiquo Server (database). To update the cloud node with the changes, click the Deploy all VMs button.
o Locked

One or more of the VMs is in the Locked state and none is in the Unknown state.

Note: Virtual appliances awaiting workflow review will be locked with VM state Waiting to be reviewed

o UnknownSome or all of the virtual machines are in the Unknown state. The virtual appliance state is unknown when the VM states cannot be recovered from the hypervisor or provider. To continue working with this virtual appliance, the system administrator must take action.


Some of these states are shown in the virtual appliances lists in following screenshot:


Deployed State and Powered Off Virtual Machines

The fact that all the VMs in a virtual appliance are powered off does not imply that the virtual appliance is undeployed. A deployed virtual appliance is always consuming resources because the VMs exist in the cloud nodes. An undeployed virtual appliance is not consuming resources.

 

Manage workflow tasks


Display VM workflow tasks

When workflow is enabled, the user's requests to deploy, reconfigure and undeploy VMs will be held with the status waiting to be reviewed. 

To view the list of workflow tasks

  1. Go to Virtual datacenters → Workflow tasks.

To filter workflow tasks, enter text in the filter box at the top of the tasks list.

As a user, you can cancel your own tasks. An administrator can also continue or cancel tasks for their users.

Cancel VM workflow tasks

To cancel workflow tasks:
  1. Go to Virtual datacenters → Workflow tasks. 
  2. If you are an administrator, to refresh the list with all queued tasks for an enterprise, select a cloud tenant from the pull-down list of enterprises.
  3. To cancel a queued task, click the Reject link next to the task.

Screenshot: A user can cancel their own tasks



Start queued VM workflow tasks

Queued tasks are waiting for workflow control. If there is a problem with the workflow connector integration or tool, users with the privilege to Manage workflow tasks can manually continue the tasks.

To manually start a task and override the workflow control:

  1. Go to Virtual datacenters → Workflow tasks. 
  2. If you are an administrator, to refresh the list with all queued tasks for an enterprise, select a cloud tenant from the pull-down list of enterprises.
  3. To start a task, click the Approve link beside the task

Screenshot: A user with the privilege to Manage workflow tasks can start their own tasks



 

 

Retrieve a VM using the API

This section describes how to retrieve a virtual machine with the Abiquo API.
  1. Before you begin, create a virtual machine with the Abiquo UI and power it off. Open the browser console. This example uses Chrome, so click F12.
  2. Select the Network view
  3. Click the red Record button and the Clear button next to it
  4. Click the Start button


  5. Scroll up to the first request, which should be a PUT request to the virtual machine state URL. Click on the request
    1. If you can't see the Method column, right click on a column heading and select Method from the list
  6. Select the link to the virtual machine, which ends in the virtual machine ID number
  7. Use a cURL request like in the example below or REST API tool such as Postman to perform the GET request to this link. For this basic testing, you can use the -k option to avoid security warnings.

curl -X GET https://mjsabiquo.bcn.abiquo.com/api/cloud/virtualdatacenters/25/virtualappliances/33/virtualmachines/156 \
     -H 'Accept:application/vnd.abiquo.virtualmachine+json;version=4.4' \
     -u admin:xabiquo -k --verbose
 Click here to show or hide the response example

Success status code: 200

Response payload:

{
   "id":156,
   "uuid":"e1ce1812-2546-4961-b262-810639bfcc3c",
   "name":"ABQ_e1ce1812-2546-4961-b262-810639bfcc3c",
   "label":"yVM",
   "description":"A virtual machine",
   "cpu":1,
   "ram":48,
   "vdrpEnabled":false,
   "vdrpPort":5905,
   "vdrpIP":"10.60.13.182",
   "idState":4,
   "state":"ON",
   "idType":0,
   "type":"MANAGED",
   "highDisponibility":0,
   "metadata":{
      "monitoring-metrics":[
         {
            "name":"if_rx_errors_total"
         },
         {
            "name":"vcpu_time"
         },
         {
            "name":"if_tx_errors_total"
         },
         {
            "name":"if_tx_errors"
         },
         {
            "name":"used_mem"
         },
         {
            "name":"if_rx_errors"
         },
         {
            "name":"if_tx_drops_total"
         },
         {
            "name":"if_rx_packets"
         },
         {
            "name":"if_tx_drops"
         },
         {
            "name":"disk_rd_requests_total"
         },
         {
            "name":"if_tx_bytes_total"
         },
         {
            "name":"if_tx_packets"
         },
         {
            "name":"if_rx_drops"
         },
         {
            "name":"cpu_usage"
         },
         {
            "name":"disk_rd_bytes"
         },
         {
            "name":"disk_rd_bytes_total"
         },
         {
            "name":"cpu_time"
         },
         {
            "name":"if_rx_bytes"
         },
         {
            "name":"disk_wr_requests"
         },
         {
            "name":"vcpu_number"
         },
         {
            "name":"if_tx_packets_total"
         },
         {
            "name":"disk_wr_requests_total"
         },
         {
            "name":"vcpu_usage"
         },
         {
            "name":"abq-ram_usage"
         },
         {
            "name":"disk_wr_bytes"
         },
         {
            "name":"if_tx_bytes"
         },
         {
            "name":"if_rx_drops_total"
         },
         {
            "name":"disk_wr_bytes_total"
         },
         {
            "name":"disk_rd_requests"
         },
         {
            "name":"abq-cpu_usage"
         },
         {
            "name":"if_rx_bytes_total"
         },
         {
            "name":"if_rx_packets_total"
         }
      ]
   },
   "monitored":true,
   "protected":false,
   "variables":{

   },
   "creationTimestamp":1534425640000,
   "backuppolicies":[

   ],
   "lastSynchronize":1534849198000,
   "generateGuestInitialPassword":false,
   "natrules":[

   ],
   "links":[
      {
         "title":"KVM",
         "rel":"machine",
         "type":"application/vnd.abiquo.machine+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/10/racks/6/machines/9"
      },
      {
         "title":"BCDC",
         "rel":"location",
         "type":"application/vnd.abiquo.datacenter+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/10"
      },
      {
         "title":"ABQ_e1ce1812-2546-4961-b262-810639bfcc3c",
         "rel":"edit",
         "type":"application/vnd.abiquo.virtualmachine+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/25/virtualappliances/33/virtualmachines/156"
      },
      {
         "title":"send mail",
         "rel":"sendmail",
         "type":"application/vnd.abiquo.mail+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/admin/datacenters/10/racks/6/machines/9/virtualmachines/156/action/sendmail"
      },
      {
         "title":"CloudTenant1",
         "rel":"enterprise",
         "type":"application/vnd.abiquo.enterprise+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/2"
      },
      {
         "title":"Cloud Admin",
         "rel":"user",
         "type":"application/vnd.abiquo.user+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/2/users/4"
      },
      {
         "title":"kvm-vdc",
         "rel":"virtualdatacenter",
         "type":"application/vnd.abiquo.virtualdatacenter+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/25"
      },
      {
         "title":"test_mail_server",
         "rel":"virtualappliance",
         "type":"application/vnd.abiquo.virtualappliance+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/25/virtualappliances/33"
      },
      {
         "title":"metadata",
         "rel":"metadata",
         "type":"application/vnd.abiquo.metadata+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/25/virtualappliances/33/virtualmachines/156/metadata"
      },
      {
         "title":"vlan network configurations",
         "rel":"configurations",
         "type":"application/vnd.abiquo.virtualmachinenetworkconfigurations+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/25/virtualappliances/33/virtualmachines/156/network/configurations"
      },
      {
         "title":"192.168.0.0/24",
         "rel":"network_configuration",
         "type":"application/vnd.abiquo.virtualmachinenetworkconfiguration+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/25/virtualappliances/33/virtualmachines/156/network/configurations/33"
      },
      {
         "title":"nics",
         "rel":"nics",
         "type":"application/vnd.abiquo.nics+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/25/virtualappliances/33/virtualmachines/156/network/nics"
      },
      {
         "title":"disks",
         "rel":"harddisks",
         "type":"application/vnd.abiquo.harddisks+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/25/virtualappliances/33/virtualmachines/156/storage/disks"
      },
      {
         "title":"ON",
         "rel":"state",
         "type":"application/vnd.abiquo.virtualmachinestate+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/25/virtualappliances/33/virtualmachines/156/state"
      },
      {
         "title":"virtual machine undeploy",
         "rel":"undeploy",
         "type":"application/vnd.abiquo.acceptedrequest+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/25/virtualappliances/33/virtualmachines/156/action/undeploy"
      },
      {
         "title":"virtual machine deploy",
         "rel":"deploy",
         "type":"application/vnd.abiquo.acceptedrequest+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/25/virtualappliances/33/virtualmachines/156/action/deploy"
      },
      {
         "title":"virtual machine reset",
         "rel":"reset",
         "type":"application/vnd.abiquo.acceptedrequest+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/25/virtualappliances/33/virtualmachines/156/action/reset"
      },
      {
         "title":"virtual machine snapshot",
         "rel":"instance",
         "type":"application/vnd.abiquo.acceptedrequest+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/25/virtualappliances/33/virtualmachines/156/action/instance"
      },
      {
         "title":"remote access",
         "rel":"rdpaccess",
         "type":"application/vnd.abiquo.virtualmachineconsole+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/25/virtualappliances/33/virtualmachines/156/config/rdpaccess"
      },
      {
         "title":"tasks",
         "rel":"tasks",
         "type":"application/vnd.abiquo.tasks+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/25/virtualappliances/33/virtualmachines/156/tasks"
      },
      {
         "title":"firewalls",
         "rel":"firewalls",
         "type":"application/vnd.abiquo.links+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/25/virtualappliances/33/virtualmachines/156/firewalls"
      },
      {
         "title":"load balancers",
         "rel":"loadbalancers",
         "type":"application/vnd.abiquo.loadbalancers+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/25/virtualappliances/33/virtualmachines/156/loadbalancers"
      },
      {
         "title":"request on demand backup",
         "rel":"requestbackup",
         "type":"application/vnd.abiquo.ondemandbackup+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/25/virtualappliances/33/virtualmachines/156/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/25/virtualappliances/33/virtualmachines/156/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/25/virtualappliances/33/virtualmachines/156/action/vappmove"
      },
      {
         "title":"volumes",
         "rel":"volumes",
         "type":"application/vnd.abiquo.volumes+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/25/virtualappliances/33/virtualmachines/156/storage/volumes"
      },
      {
         "diskControllerType":"IDE",
         "diskLabel":"Hard disk 1",
         "length":"64",
         "title":"f162cace-40a0-4cf3-a95d-13088763c214",
         "rel":"disk0",
         "type":"application/vnd.abiquo.harddisk+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/25/disks/138"
      },
      {
         "title":"Default Tier",
         "rel":"datastoretier0",
         "type":"application/vnd.abiquo.datastoretier+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/10/datastoretiers/3"
      },
      {
         "diskController":"",
         "diskControllerType":"IDE",
         "length":"128",
         "title":"c375b5c2-ac37-4079-b5ae-3f843c994184",
         "rel":"disk1",
         "type":"application/vnd.abiquo.harddisk+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/25/disks/140"
      },
      {
         "title":"Default Tier",
         "rel":"datastoretier1",
         "type":"application/vnd.abiquo.datastoretier+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/locations/10/datastoretiers/3"
      },
      {
         "title":"192.168.0.5",
         "rel":"nic0",
         "type":"application/vnd.abiquo.privateip+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/25/privatenetworks/33/ips/139"
      },
      {
         "title":"protect",
         "rel":"protect",
         "type":"text/plain",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/25/virtualappliances/33/virtualmachines/156/action/protect"
      },
      {
         "title":"unprotect",
         "rel":"unprotect",
         "type":"text/plain",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/25/virtualappliances/33/virtualmachines/156/action/unprotect"
      },
      {
         "title":"metricsmetadata",
         "rel":"metricsmetadata",
         "type":"application/vnd.abiquo.metricsmetadata+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/25/virtualappliances/33/virtualmachines/156/metrics"
      },
      {
         "title":"disablemonitoring",
         "rel":"disablemonitoring",
         "type":"",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/25/virtualappliances/33/virtualmachines/156/disablemonitoring"
      },
      {
         "title":"collectd",
         "rel":"collectd",
         "type":"application/json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/25/virtualappliances/33/virtualmachines/156/metrics/collectd"
      },
      {
         "title":"alarmssearch",
         "rel":"alarmssearch",
         "type":"application/vnd.abiquo.alarms+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/25/virtualappliances/33/virtualmachines/156/alarms"
      },
      {
         "title":"clone",
         "rel":"clone",
         "type":"application/vnd.abiquo.virtualmachinecloneoptions+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/25/virtualappliances/33/virtualmachines/156/action/clone"
      },
      {
         "title":"KVM",
         "rel":"hypervisortype",
         "type":"application/vnd.abiquo.hypervisortype+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/config/hypervisortypes/KVM"
      },
      {
         "title":"yVM",
         "rel":"virtualmachinetemplate",
         "type":"application/vnd.abiquo.virtualmachinetemplate+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/admin/enterprises/2/datacenterrepositories/10/virtualmachinetemplates/138"
      },
      {
         "title":"Others",
         "rel":"category",
         "type":"application/vnd.abiquo.category+json",
         "href":"https://mjsabiquo.bcn.abiquo.com:443/api/config/categories/1"
      }
   ]
} 

Manage VM power states using the API

To manage the virtual machine using the API, first you need to retrieve the virtual machine and find the links for different actions. Remember to see VirtualMachinesResource for full details of virtual machine operations using the Abiquo API.

To perform a power action (except for reset) on a VM using the API:
  1. Perform a GET request to obtain the VM object and find the VM state link
  2. Create a virtualmachinestate object
  3. Send a PUT request to the VM state link

The VM state link is a link in the VM object with the "rel" attribute set to state. The "title" attribute contains the current state. You can send a PUT request of a virtualmachine state object to the link (in the "href" attribute) to change the state of the VM.

    {
      "href": "https://mjsabiquo.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2/virtualappliances/2/virtualmachines/6/state",
      "type": "application/vnd.abiquo.virtualmachinestate+json",
      "rel": "state",
      "title": "ON"
    },

Examples of virtualmachinestate objects

  • Hard power off

    {"state": "OFF"}
  • Graceful shutdown

    {"state": "OFF", "gracefulShutdown": true}
  • Power on

    {"state": "ON"}
  • Pause

    {"state": "PAUSED"}

Example of VM hard power off via API

The API will return a link where you can monitor the progress of this operation.

See https://wiki.abiquo.com/api/latest/VirtualMachinesResource.html#change-the-state-of-a-virtual-machine

Example of failed graceful shutdown

To perform a graceful shutdown, your VM will need to have guest extensions installed on it. After an operation completes, you can view the status of the task by going to the link in the accepted request link of the response. In this case, the graceful shutdown was not supported and failed. 

 Click here to show or hide the request example
{
   "links":[
      {
         "rel":"self",
         "href":"https://38testing.bcn.abiquo.com:443/api/cloud/virtualdatacenters/55/virtualappliances/200/virtualmachines/1763/tasks/8812ddf4-a372-40af-81ee-5f5d1e53454c"
      },
      {
         "rel":"parent",
         "href":"https://38testing.bcn.abiquo.com:443/api/cloud/virtualdatacenters/55/virtualappliances/200/virtualmachines/1763/tasks"
      },
      {
         "rel":"acknowledge",
         "href":"https://38testing.bcn.abiquo.com:443/api/cloud/virtualdatacenters/55/virtualappliances/200/virtualmachines/1763/tasks/8812ddf4-a372-40af-81ee-5f5d1e53454c/action/ack"
      },
      {
         "title":"cloudadmin",
         "rel":"user",
         "type":"application/vnd.abiquo.user+json",
         "href":"https://38testing.bcn.abiquo.com:443/api/admin/enterprises/74/users/17"
      },
      {
         "title":"ABQ_5e57c34d-5dcb-482b-be0f-a78931f4abd0",
         "rel":"virtualmachine",
         "type":"application/vnd.abiquo.virtualmachine+json",
         "href":"https://38testing.bcn.abiquo.com:443/api/cloud/virtualdatacenters/55/virtualappliances/200/virtualmachines/1763"
      }
   ],
   "taskId":"8812ddf4-a372-40af-81ee-5f5d1e53454c",
   "userId":"17",
   "type":"SHUTDOWN",
   "ownerId":"1763",
   "state":"FINISHED_UNSUCCESSFULLY",
   "creationTimestamp":1458647896,
   "timestamp":1458647897,
   "jobs":{
      "links":[
      ],
      "collection":[
         {
            "links":[
            ],
            "id":"8812ddf4-a372-40af-81ee-5f5d1e53454c.191e44d9-74fa-453a-b7e0-596237618fcf",
            "parentTaskId":"8812ddf4-a372-40af-81ee-5f5d1e53454c",
            "type":"SHUTDOWN",
            "description":"Shutdown task's shutdown on virtual machine with id 1763",
            "state":"FAILED",
            "rollbackState":"ROLLBACK_DONE",
            "creationTimestamp":1458647896,
            "timestamp":1458647897
         }
      ]
   }
}

Reset a VM using the API

To reset a VM using the API, use a POST request to the reset action link.

 Click here to expand...

cURL:

curl -X POST http://localhost:9000/api/cloud/virtualdatacenters/2210/virtualappliances/1085/virtualmachines/1126/action/reset \ 
	 -H 'Accept:application/vnd.abiquo.acceptedrequest+json; version=4.2' \ 
	 -u user:password --verbose 

Success status code: 202

Request payload:

--none--

Response payload:

{
  "message": "You can keep track of the progress in the link", 
  "links": [
    {
      "href": "http://localhost:9009/api/cloud/virtualdatacenters/2210/virtualappliances/1085/virtualmachines/1126/tasks/1fd663d5-1e66-4443-b94c-f78d13c9e62f", 
      "rel": "status"
    }
  ]
}

Related pages

  • No labels