Versions Compared

Key

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

...

  1. Upload or download a template

  2. Use it to create a VM 

  3. Update the template.  Abiquo supports changes to:

    1. file content

    2. size

    3. format

    4. capacity

    5. controller

    Update the disk using the Appliance manager API.

  4. When the user next deploys the VM, the platform will copy the updated disk

...

Note

The default value for the diskControllerType is "IDE" and the default value for the diskController is NULL.

If your template uses a different controller, such as "SCSI" and "lsilogic", you must add these values in the diskReplace.json entity, as shown above. If you do not add them, the platform will overwrite your template with its default values.

You should note that the AM API does not support all of the values that are supported by the Abiquo API.


...


5.

...

Obtain the URLs to replace the file

...

Obtain the URLs to build the request to replace the disk.

Warning

If your file name or folder name contains spaces, do the steps below in “Steps for folder names with spaces” and “Steps for file names with spaces” to obtain the folder path, file name and URL

The URL to post to contains the enterprise ID and the template folder in the following format.

...

The template folder is the folder path on the NFS Repository, without the file name.

So from our example that with the following “href” and “path”:

...

Code Block
/am/erepos/1/templates/1/bundle/e05785d2-b49a-4034-9bb9-3440e1693589-4ba3b6e1-6f06-47d9-8703-9e9
For the URL for the POST request, if your file or folder name contains spaces or other encoded characters, encode them twice.
For example, for a disk or folder with "abc abc" in the name, the URL will have abc%20abc to represent this.
For the URL, you must encode this section again, to give abc%2520abc. The server will then correctly read this as abc%20abc.
Warning
Tip

The template path does not contain the ID of the datacenter repository. It contains the folder name from /opt/vm_repository.
So in our example, the datacenter repository ID is 1 and the path is "1/bundle.." but they are not related

Info

If the original disk file is not available, you can create a placeholder file in the folder using the touch command, in the format touch {currentPath}. For example:
touch 1/bundle/e05785d2-b49a-4034-9bb9-3440e1693589-4ba3b6e1-6f06-47d9-8703-9e9/4ba3b6e1-6f06-47d9-8703-9e9eae1c2a9b-snapshot-yVM2b8c91aa4-14b1-44a6-b27b-aa12c7ca3433-flat.vmdk

Tip

The template path does not contain the ID of the datacenter repository. It contains the folder name from /opt/vm_repository.
So in our example, the datacenter repository ID is 1 and the path is "1/bundle.." but they are not related

You will use this information to build the request to replace the disk.

cURL

-aa12c7ca3433-flat.vmdk

Steps for folder names with spaces

The URL to post to contains the enterprise ID and the template folder in the following format.

Code Block
/am/erepos/{enterpriseId}/templates/{templateFolder}

The template folder is the folder path on the NFS Repository, without the file name.

So for an example with the following “href” and “path”:

Code Block
"href": "{base_api_url}/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/72/disks/74"
"path": "1/bundle/abc%20def/olddisk-flat.vmdk"    

The “folder path” is as follows:

Code Block
1/bundle/abc%20def

And the format of the URL to post to will be:

Code Block
/am/erepos/1/templates/1/bundle/abc%2520abc

Steps for file names with spaces

If the file name contains spaces, in the cURL command, enclose the File option in quotation marks and shell escape the spaces.

For example, if the file name is new disk.vmdk, then in the cURL command, you should use -F "diskFile=@new\ disk.vmdk"

6. Replace the disk

In the following cURL, the base_url is the URL of the Abiquo API server, without the /api path. For example, https://abiquo.example.com.

...

Code Block
{
  "title": "8611a4ed-adbd-49aa-a22e-81fd4b60e833-newdisk",
  "rel": "diskfile",
  "href": "http://abiquo.example.com:8009/am/files/1/bundle/e05785d2-b49a-4034-9bb9-3440e1693589-4ba3b6e1-6f06-47d9-8703-9e9/8611a4ed-adbd-49aa-a22e-81fd4b60e833-newdisk.vmdk"
}
{
  "sequence": 0,
  "path": "1/bundle/e05785d2-b49a-4034-9bb9-3440e1693589-4ba3b6e1-6f06-47d9-8703-9e9/8611a4ed-adbd-49aa-a22e-81fd4b60e833-newdisk.vmdk"
}

We hope that you will enjoy working with your refreshed VM template!The new disk is now ready to use in the VM template.