Project

General

Profile

Feature #14833

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

Added by Justin Foreman about 3 years ago. Updated 4 months ago.

Status:
Closed
Priority:
Normal
Category:
Compute resources - oVirt
Target version:
-
Team Backlog:
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!

Associated revisions

Revision cdce7a24 (diff)
Added by Ori Rabin 4 months ago

Fixes #14833 - Add cloning of disk for ovirt vm

History

#1 Updated by Dominic Cleal about 3 years ago

  • Category set to Compute resources - oVirt

#2 Updated by The Foreman Bot about 1 year ago

  • Assignee set to Daniel Lobato Garcia
  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/5656 added

#3 Updated by Ori Rabin about 1 year ago

  • Bugzilla link set to 1559006
  • Triaged set to No

#4 Updated by The Foreman Bot 8 months ago

  • Pull request https://github.com/theforeman/foreman/pull/6295 added

#5 Updated by Shimon Shtein 4 months ago

  • Fixed in Releases 1.22.0 added

#6 Updated by Ori Rabin 4 months ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF