Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 75 Next »

Protect a VM

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

This section describes how to protect a VM from changes within the platform. To protect a VM with disaster recovery, see Protect a VM with disaster recovery

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

Privileges: Protect virtual machine

To protect a VM

  1. Select the VM and click the padlock protect VM button on the VM control panel near the Deploy VM button

  2. In the Protect virtual machine dialog, enter the reason for protecting the VM.

 Protect a VM from the padlock button on the VM control panel

The platform will display a padlock symbol in the top left corner of the VM icon and change the status of the VM to MAINTENANCE. The administrator can customize this status in the UI labels. 

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

To release a protected VM, click the open padlock unprotect VM button

Restrict virtual appliances and VMs

Unable to render {include} The included page could not be found.

Unable to render {include} The included page could not be found.

Relocate a deployed VM to another host

Unable to render {include} The included page could not be found.


What happens when the user clicks deploy?

Unable to render {include} The included page could not be found.

Deploy errors

Unable to render {include} The included page could not be found.

 

States of VApps and VMs

Unable to render {include} The included page could not be found.

Manage workflow tasks


Unable to render {include} The included page could not be found.
 

Retrieve a VM using the API

Unable to render {include} The included page could not be found.

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 power state of the VM.

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

Here are some examples of virtualmachinestate objects and notes about changing VM states

  • Hard power off

    {"state": "OFF"}

    When you perform a power off via API, the response will include a link where you can monitor the progress of this operation. For an example of a hard power off, see https://wiki.abiquo.com/api/latest/VirtualMachinesResource.html#change-the-state-of-a-virtual-machine

  • Graceful shutdown

    {"state": "OFF", "gracefulShutdown": true}

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

    curl -X PUT 'https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/state' \
      -k --verbose \
      -H 'Accept: application/vnd.abiquo.acceptedrequest+json; version=5.0' \
      -H 'Content-Type: application/vnd.abiquo.virtualmachinestate+json; version=5.0' \
      -d '{"state": "OFF", "gracefulShutdown": true}' \
      -u user:password | jq .

    {
      "taskId": "d62be542-f34c-4fed-b9f8-6443f2db4cc1",
      "userId": "10",
      "type": "SHUTDOWN",
      "ownerId": "19454",
      "state": "FINISHED_SUCCESSFULLY",
      "creationTimestamp": 1596040226,
      "timestamp": 1596040226,
      "jobs": {
        "links": [],
        "collection": [
          {
            "id": "d62be542-f34c-4fed-b9f8-6443f2db4cc1.2cd94a0c-179d-4506-a71d-fabaf29a4d43",
            "parentTaskId": "d62be542-f34c-4fed-b9f8-6443f2db4cc1",
            "type": "SHUTDOWN",
            "description": "Shutdown task's shutdown on virtual machine with id 19454",
            "state": "DONE",
            "rollbackState": "UNKNOWN",
            "creationTimestamp": 1596040226,
            "timestamp": 1596040226,
            "links": []
          }
        ]
      },
      "links": [
        {
          "rel": "self",
          "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/tasks/d62be542-f34c-4fed-b9f8-6443f2db4cc1"
        },
        {
          "rel": "parent",
          "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/tasks"
        },
        {
          "rel": "result",
          "type": "application/vnd.abiquo.virtualmachine+json",
          "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454"
        },
        {
          "title": "user",
          "rel": "user",
          "type": "application/vnd.abiquo.user+json",
          "href": "https://nardo40.bcn.abiquo.com:443/api/admin/enterprises/336/users/10"
        },
        {
          "title": "ABQ_2fb11009-8157-4d61-915d-40fa45f440ac",
          "rel": "virtualmachine",
          "type": "application/vnd.abiquo.virtualmachine+json",
          "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454"
        }
      ]
    } 

  • Power on

    {"state": "ON"}

  • Pause

    {"state": "PAUSED"}

  • Azure power off and deallocate

    Azure has two power off states - powered off and deallocated.

    • To power off a VM in Azure via the Abiquo API, use the graceful shutdown

    • To deallocate a VM in Azure via the Abiquo API, use the hard power off

      • The deallocated VM will have a "deallocated" attribute that is set to "true".

To reset a VM using the API, use a POST request to the reset action link. If you are using a test environment, you may wish to add the --insecure option.

cURL:

curl -X POST 'https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/action/reset' \ 
-k --verbose \
-H 'Accept: application/vnd.abiquo.acceptedrequest+json; version=5.0' \
-u user:password | jq . 

Success status code: 202

Request payload:

--none--

Response payload:

{
  "message": "You can keep track of the progress in the link",
  "links": [
    {
      "title": "status",
      "rel": "status",
      "type": "application/vnd.abiquo.task+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/tasks/edec6cf1-8874-451d-a4c0-57f4c24da371"
    }
  ]
} 

Related pages

  • No labels