Project

General

Profile

Actions

Feature #14833

closed

Add oVirt API option to provision VMs to be "Clone/Independent" from their template

Added by Justin Foreman about 8 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Category:
Compute resources - oVirt
Target version:
-
Fixed in Releases:
Found in Releases:

Description

Currently, any time I provision a VM in oVirt (3.6.4) from Foreman (1.11), the VM is marked as "Thin/Dependent" upon its source template. This is caused by a disk-related parameter, but it happens even if the source template contains no disks. It would be excellent if an option could be added to Foreman to allow VMs to be provisioned as "Clone/Independent."

The way to make a VM independent of its template is to add the "disks.clone=true" parameter. I've found working examples on how to do this with REST and with the Python SDK, but am not sure how to change the code in Foreman to do so.

I started by trying to add this to app/models/compute_resources/foreman/model/ovirt.rb to no avail.

vm.add_volume({:clone => true, ...

Examples:
In Python:

  api.vms.add(
    params.VM(
      vmname=VMNAME,
      memory=MEM*GB,
      cluster=...,
      template=...,
      description=...,
      disks=params.Disks(
        clone=True
      )
    )
  )

Specifically:

      disks=params.Disks(
        clone=True
      )

With the REST API (xml):

curl \
--verbose \
--insecure \
--request POST \
--user "${user}:${password}" \
--header "Content-Type: application/xml" \
--header "Accept: application/xml" \
--data " 
<vm>
  <name>myvm</name>
  <cluster>
    <name>mycluster</name>
  </cluster>
  <template>
    <name>mytemplate</name>
  </template>
  <disks>
    <clone>true</clone>
  </disks>
</vm>
" \
"${url}/vms" 

Specifically:

  <disks>
    <clone>true</clone>
  </disks>

Source: http://lists.ovirt.org/pipermail/users/2014-October/028463.html

Rationale:
My VMs don't need to be linked to my templates, as I'm using provisioning, not images, so there's no technical benefit to maintaining the relationship between the VM and its template. I've actually had some issues with disaster recovery, as oVirt has claimed that it couldn't import a VM provisioned in this manner because it couldn't find the linked template.

Any help will be greatly appreciated, and thank you for this amazing tool!

Actions

Also available in: Atom PDF