salt.cloud.clouds.opennebula

OpenNebula Cloud Module

The OpenNebula cloud module is used to control access to an OpenNebula cloud.

New in version 2014.7.0.

depends:

lxml

depends:

OpenNebula installation running version 4.14 or later.

Use of this module requires the xml_rpc, user, and password parameters to be set.

Set up the cloud configuration at /etc/salt/cloud.providers or /etc/salt/cloud.providers.d/opennebula.conf:

my-opennebula-config:
  xml_rpc: http://localhost:2633/RPC2
  user: oneadmin
  password: JHGhgsayu32jsa
  driver: opennebula

This driver supports accessing new VM instances via DNS entry instead of IP address. To enable this feature, in the provider or profile file add fqdn_base with a value matching the base of your fully-qualified domain name. Example:

my-opennebula-config:
  [...]
  fqdn_base: <my.basedomain.com>
  [...]

The driver will prepend the hostname to the fqdn_base and do a DNS lookup to find the IP of the new VM.

salt-cloud -f image_allocate opennebula datastore_name=default \
    data='NAME="My New Image" DESCRIPTION="Description of the image." \
    PATH=/home/one_user/images/image_name.img'
salt-cloud -f secgroup_allocate opennebula \
    data="Name = test RULE = [PROTOCOL = TCP, RULE_TYPE = inbound, \
    RANGE = 1000:2000]"
salt.cloud.clouds.opennebula.avail_images(call=None)

Return available OpenNebula images.

CLI Example:

salt-cloud --list-images opennebula
salt-cloud --function avail_images opennebula
salt-cloud -f avail_images opennebula
salt.cloud.clouds.opennebula.avail_locations(call=None)

Return available OpenNebula locations.

CLI Example:

salt-cloud --list-locations opennebula
salt-cloud --function avail_locations opennebula
salt-cloud -f avail_locations opennebula
salt.cloud.clouds.opennebula.avail_sizes(call=None)

Because sizes are built into templates with OpenNebula, there will be no sizes to return here.

salt.cloud.clouds.opennebula.create(vm_)

Create a single VM from a data dict.

vm_

The dictionary use to create a VM.

Optional vm_ dict options for overwriting template:

region_id

Optional - OpenNebula Zone ID

memory

Optional - In MB

cpu

Optional - Percent of host CPU to allocate

vcpu

Optional - Amount of vCPUs to allocate

CLI Example:

 salt-cloud -p my-opennebula-profile vm_name

salt-cloud -p my-opennebula-profile vm_name memory=16384 cpu=2.5 vcpu=16
salt.cloud.clouds.opennebula.destroy(name, call=None)

Destroy a node. Will check termination protection and warn if enabled.

name

The name of the vm to be destroyed.

CLI Example:

salt-cloud --destroy vm_name
salt-cloud -d vm_name
salt-cloud --action destroy vm_name
salt-cloud -a destroy vm_name
salt.cloud.clouds.opennebula.get_cluster_id(kwargs=None, call=None)

Returns a cluster's ID from the given cluster name.

New in version 2016.3.0.

CLI Example:

salt-cloud -f get_cluster_id opennebula name=my-cluster-name
salt.cloud.clouds.opennebula.get_configured_provider()

Return the first configured instance.

salt.cloud.clouds.opennebula.get_datastore_id(kwargs=None, call=None)

Returns a data store's ID from the given data store name.

New in version 2016.3.0.

CLI Example:

salt-cloud -f get_datastore_id opennebula name=my-datastore-name
salt.cloud.clouds.opennebula.get_dependencies()

Warn if dependencies aren't met.

salt.cloud.clouds.opennebula.get_host_id(kwargs=None, call=None)

Returns a host's ID from the given host name.

New in version 2016.3.0.

CLI Example:

salt-cloud -f get_host_id opennebula name=my-host-name
salt.cloud.clouds.opennebula.get_image(vm_)

Return the image object to use.

vm_

The VM dictionary for which to obtain an image.

salt.cloud.clouds.opennebula.get_image_id(kwargs=None, call=None)

Returns an image's ID from the given image name.

New in version 2016.3.0.

CLI Example:

salt-cloud -f get_image_id opennebula name=my-image-name
salt.cloud.clouds.opennebula.get_location(vm_)

Return the VM's location.

vm_

The VM dictionary for which to obtain a location.

salt.cloud.clouds.opennebula.get_one_version(kwargs=None, call=None)

Returns the OpenNebula version.

New in version 2016.3.5.

CLI Example:

salt-cloud -f get_one_version one_provider_name
salt.cloud.clouds.opennebula.get_secgroup_id(kwargs=None, call=None)

Returns a security group's ID from the given security group name.

New in version 2016.3.0.

CLI Example:

salt-cloud -f get_secgroup_id opennebula name=my-secgroup-name
salt.cloud.clouds.opennebula.get_template(vm_)

Return the template id for a VM.

New in version 2016.11.0.

vm_

The VM dictionary for which to obtain a template.

salt.cloud.clouds.opennebula.get_template_id(kwargs=None, call=None)

Returns a template's ID from the given template name.

New in version 2016.3.0.

CLI Example:

salt-cloud -f get_template_id opennebula name=my-template-name
salt.cloud.clouds.opennebula.get_template_image(kwargs=None, call=None)

Returns a template's image from the given template name.

New in version 2018.3.0.

salt-cloud -f get_template_image opennebula name=my-template-name
salt.cloud.clouds.opennebula.get_vm_id(kwargs=None, call=None)

Returns a virtual machine's ID from the given virtual machine's name.

New in version 2016.3.0.

CLI Example:

salt-cloud -f get_vm_id opennebula name=my-vm
salt.cloud.clouds.opennebula.get_vn_id(kwargs=None, call=None)

Returns a virtual network's ID from the given virtual network's name.

New in version 2016.3.0.

CLI Example:

salt-cloud -f get_vn_id opennebula name=my-vn-name
salt.cloud.clouds.opennebula.image_allocate(call=None, kwargs=None)

Allocates a new image in OpenNebula.

New in version 2016.3.0.

path

The path to a file containing the template of the image to allocate. Syntax within the file can be the usual attribute=value or XML. Can be used instead of data.

data

The data containing the template of the image to allocate. Syntax can be the usual attribute=value or XML. Can be used instead of path.

datastore_id

The ID of the data-store to be used for the new image. Can be used instead of datastore_name.

datastore_name

The name of the data-store to be used for the new image. Can be used instead of datastore_id.

CLI Example:

salt-cloud -f image_allocate opennebula path=/path/to/image_file.txt datastore_id=1
salt-cloud -f image_allocate opennebula datastore_name=default \
    data='NAME="Ubuntu 14.04" PATH="/home/one_user/images/ubuntu_desktop.img" \
    DESCRIPTION="Ubuntu 14.04 for development."'
salt.cloud.clouds.opennebula.image_clone(call=None, kwargs=None)

Clones an existing image.

New in version 2016.3.0.

name

The name of the new image.

image_id

The ID of the image to be cloned. Can be used instead of image_name.

image_name

The name of the image to be cloned. Can be used instead of image_id.

CLI Example:

salt-cloud -f image_clone opennebula name=my-new-image image_id=10
salt-cloud -f image_clone opennebula name=my-new-image image_name=my-image-to-clone
salt.cloud.clouds.opennebula.image_delete(call=None, kwargs=None)

Deletes the given image from OpenNebula. Either a name or an image_id must be supplied.

New in version 2016.3.0.

name

The name of the image to delete. Can be used instead of image_id.

image_id

The ID of the image to delete. Can be used instead of name.

CLI Example:

salt-cloud -f image_delete opennebula name=my-image
salt-cloud --function image_delete opennebula image_id=100
salt.cloud.clouds.opennebula.image_info(call=None, kwargs=None)

Retrieves information for a given image. Either a name or an image_id must be supplied.

New in version 2016.3.0.

name

The name of the image for which to gather information. Can be used instead of image_id.

image_id

The ID of the image for which to gather information. Can be used instead of name.

CLI Example:

salt-cloud -f image_info opennebula name=my-image
salt-cloud --function image_info opennebula image_id=5
salt.cloud.clouds.opennebula.image_persistent(call=None, kwargs=None)

Sets the Image as persistent or not persistent.

New in version 2016.3.0.

name

The name of the image to set. Can be used instead of image_id.

image_id

The ID of the image to set. Can be used instead of name.

persist

A boolean value to set the image as persistent or not. Set to true for persistent, false for non-persistent.

CLI Example:

salt-cloud -f image_persistent opennebula name=my-image persist=True
salt-cloud --function image_persistent opennebula image_id=5 persist=False
salt.cloud.clouds.opennebula.image_snapshot_delete(call=None, kwargs=None)

Deletes a snapshot from the image.

New in version 2016.3.0.

image_id

The ID of the image from which to delete the snapshot. Can be used instead of image_name.

image_name

The name of the image from which to delete the snapshot. Can be used instead of image_id.

snapshot_id

The ID of the snapshot to delete.

CLI Example:

salt-cloud -f image_snapshot_delete vm_id=106 snapshot_id=45
salt-cloud -f image_snapshot_delete vm_name=my-vm snapshot_id=111
salt.cloud.clouds.opennebula.image_snapshot_flatten(call=None, kwargs=None)

Flattens the snapshot of an image and discards others.

New in version 2016.3.0.

image_id

The ID of the image. Can be used instead of image_name.

image_name

The name of the image. Can be used instead of image_id.

snapshot_id

The ID of the snapshot to flatten.

CLI Example:

salt-cloud -f image_snapshot_flatten vm_id=106 snapshot_id=45
salt-cloud -f image_snapshot_flatten vm_name=my-vm snapshot_id=45
salt.cloud.clouds.opennebula.image_snapshot_revert(call=None, kwargs=None)

Reverts an image state to a previous snapshot.

New in version 2016.3.0.

image_id

The ID of the image to revert. Can be used instead of image_name.

image_name

The name of the image to revert. Can be used instead of image_id.

snapshot_id

The ID of the snapshot to which the image will be reverted.

CLI Example:

salt-cloud -f image_snapshot_revert vm_id=106 snapshot_id=45
salt-cloud -f image_snapshot_revert vm_name=my-vm snapshot_id=120
salt.cloud.clouds.opennebula.image_update(call=None, kwargs=None)

Replaces the image template contents.

New in version 2016.3.0.

image_id

The ID of the image to update. Can be used instead of image_name.

image_name

The name of the image to update. Can be used instead of image_id.

path

The path to a file containing the template of the image. Syntax within the file can be the usual attribute=value or XML. Can be used instead of data.

data

Contains the template of the image. Syntax can be the usual attribute=value or XML. Can be used instead of path.

update_type

There are two ways to update an image: replace the whole template or merge the new template with the existing one.

CLI Example:

salt-cloud -f image_update opennebula image_id=0 file=/path/to/image_update_file.txt update_type=replace
salt-cloud -f image_update opennebula image_name="Ubuntu 14.04" update_type=merge \
    data='NAME="Ubuntu Dev" PATH="/home/one_user/images/ubuntu_desktop.img" \
    DESCRIPTION = "Ubuntu 14.04 for development."'
salt.cloud.clouds.opennebula.list_clusters(call=None)

Returns a list of clusters in OpenNebula.

New in version 2016.3.0.

CLI Example:

salt-cloud -f list_clusters opennebula
salt.cloud.clouds.opennebula.list_datastores(call=None)

Returns a list of data stores on OpenNebula.

New in version 2016.3.0.

CLI Example:

salt-cloud -f list_datastores opennebula
salt.cloud.clouds.opennebula.list_hosts(call=None)

Returns a list of hosts on OpenNebula.

New in version 2016.3.0.

CLI Example:

salt-cloud -f list_hosts opennebula
salt.cloud.clouds.opennebula.list_nodes(call=None)

Return a list of VMs on OpenNebula.

CLI Example:

salt-cloud -Q
salt-cloud --query
salt-cloud --function list_nodes opennebula
salt-cloud -f list_nodes opennebula
salt.cloud.clouds.opennebula.list_nodes_full(call=None)

Return a list of the VMs on OpenNebula.

CLI Example:

salt-cloud -F
salt-cloud --full-query
salt-cloud --function list_nodes_full opennebula
salt-cloud -f list_nodes_full opennebula
salt.cloud.clouds.opennebula.list_nodes_select(call=None)

Return a list of the VMs that are on the provider, with select fields.

salt.cloud.clouds.opennebula.list_security_groups(call=None)

Lists all security groups available to the user and the user's groups.

New in version 2016.3.0.

CLI Example:

salt-cloud -f list_security_groups opennebula
salt.cloud.clouds.opennebula.list_templates(call=None)

Lists all templates available to the user and the user's groups.

New in version 2016.3.0.

CLI Example:

salt-cloud -f list_templates opennebula
salt.cloud.clouds.opennebula.list_vns(call=None)

Lists all virtual networks available to the user and the user's groups.

New in version 2016.3.0.

CLI Example:

salt-cloud -f list_vns opennebula
salt.cloud.clouds.opennebula.reboot(name, call=None)

Reboot a VM.

New in version 2016.3.0.

name

The name of the VM to reboot.

CLI Example:

salt-cloud -a reboot my-vm
salt.cloud.clouds.opennebula.secgroup_allocate(call=None, kwargs=None)

Allocates a new security group in OpenNebula.

New in version 2016.3.0.

path

The path to a file containing the template of the security group. Syntax within the file can be the usual attribute=value or XML. Can be used instead of data.

data

The template data of the security group. Syntax can be the usual attribute=value or XML. Can be used instead of path.

CLI Example:

salt-cloud -f secgroup_allocate opennebula path=/path/to/secgroup_file.txt
salt-cloud -f secgroup_allocate opennebula \
    data="NAME = test RULE = [PROTOCOL = TCP, RULE_TYPE = inbound, \
    RANGE = 1000:2000]"
salt.cloud.clouds.opennebula.secgroup_clone(call=None, kwargs=None)

Clones an existing security group.

New in version 2016.3.0.

name

The name of the new template.

secgroup_id

The ID of the security group to be cloned. Can be used instead of secgroup_name.

secgroup_name

The name of the security group to be cloned. Can be used instead of secgroup_id.

CLI Example:

salt-cloud -f secgroup_clone opennebula name=my-cloned-secgroup secgroup_id=0
salt-cloud -f secgroup_clone opennebula name=my-cloned-secgroup secgroup_name=my-secgroup
salt.cloud.clouds.opennebula.secgroup_delete(call=None, kwargs=None)

Deletes the given security group from OpenNebula. Either a name or a secgroup_id must be supplied.

New in version 2016.3.0.

name

The name of the security group to delete. Can be used instead of secgroup_id.

secgroup_id

The ID of the security group to delete. Can be used instead of name.

CLI Example:

salt-cloud -f secgroup_delete opennebula name=my-secgroup
salt-cloud --function secgroup_delete opennebula secgroup_id=100
salt.cloud.clouds.opennebula.secgroup_info(call=None, kwargs=None)

Retrieves information for the given security group. Either a name or a secgroup_id must be supplied.

New in version 2016.3.0.

name

The name of the security group for which to gather information. Can be used instead of secgroup_id.

secgroup_id

The ID of the security group for which to gather information. Can be used instead of name.

CLI Example:

salt-cloud -f secgroup_info opennebula name=my-secgroup
salt-cloud --function secgroup_info opennebula secgroup_id=5
salt.cloud.clouds.opennebula.secgroup_update(call=None, kwargs=None)

Replaces the security group template contents.

New in version 2016.3.0.

secgroup_id

The ID of the security group to update. Can be used instead of secgroup_name.

secgroup_name

The name of the security group to update. Can be used instead of secgroup_id.

path

The path to a file containing the template of the security group. Syntax within the file can be the usual attribute=value or XML. Can be used instead of data.

data

The template data of the security group. Syntax can be the usual attribute=value or XML. Can be used instead of path.

update_type

There are two ways to update a security group: replace the whole template or merge the new template with the existing one.

CLI Example:

salt-cloud --function secgroup_update opennebula secgroup_id=100 \
    path=/path/to/secgroup_update_file.txt \
    update_type=replace
salt-cloud -f secgroup_update opennebula secgroup_name=my-secgroup update_type=merge \
    data="Name = test RULE = [PROTOCOL = TCP, RULE_TYPE = inbound, RANGE = 1000:2000]"
salt.cloud.clouds.opennebula.show_instance(name, call=None)

Show the details from OpenNebula concerning a named VM.

name

The name of the VM for which to display details.

call

Type of call to use with this function such as function.

CLI Example:

salt-cloud --action show_instance vm_name
salt-cloud -a show_instance vm_name
salt.cloud.clouds.opennebula.start(name, call=None)

Start a VM.

New in version 2016.3.0.

name

The name of the VM to start.

CLI Example:

salt-cloud -a start my-vm
salt.cloud.clouds.opennebula.stop(name, call=None)

Stop a VM.

New in version 2016.3.0.

name

The name of the VM to stop.

CLI Example:

salt-cloud -a stop my-vm
salt.cloud.clouds.opennebula.template_allocate(call=None, kwargs=None)

Allocates a new template in OpenNebula.

New in version 2016.3.0.

path

The path to a file containing the elements of the template to be allocated. Syntax within the file can be the usual attribute=value or XML. Can be used instead of data.

data

Contains the elements of the template to be allocated. Syntax can be the usual attribute=value or XML. Can be used instead of path.

CLI Example:

salt-cloud -f template_allocate opennebula path=/path/to/template_file.txt
salt-cloud -f template_allocate opennebula \
    data='CPU="1.0" DISK=[IMAGE="Ubuntu-14.04"] GRAPHICS=[LISTEN="0.0.0.0",TYPE="vnc"] \
    MEMORY="1024" NETWORK="yes" NIC=[NETWORK="192net",NETWORK_UNAME="oneadmin"] \
    OS=[ARCH="x86_64"] SUNSTONE_CAPACITY_SELECT="YES" SUNSTONE_NETWORK_SELECT="YES" \
    VCPU="1"'
salt.cloud.clouds.opennebula.template_clone(call=None, kwargs=None)

Clones an existing virtual machine template.

New in version 2016.3.0.

name

The name of the new template.

template_id

The ID of the template to be cloned. Can be used instead of template_name.

template_name

The name of the template to be cloned. Can be used instead of template_id.

clone_images

Optional, defaults to False. Indicates if the images attached to the template should be cloned as well.

CLI Example:

salt-cloud -f template_clone opennebula name=my-new-template template_id=0
salt-cloud -f template_clone opennebula name=my-new-template template_name=my-template
salt.cloud.clouds.opennebula.template_delete(call=None, kwargs=None)

Deletes the given template from OpenNebula. Either a name or a template_id must be supplied.

New in version 2016.3.0.

name

The name of the template to delete. Can be used instead of template_id.

template_id

The ID of the template to delete. Can be used instead of name.

CLI Example:

salt-cloud -f template_delete opennebula name=my-template
salt-cloud --function template_delete opennebula template_id=5
salt.cloud.clouds.opennebula.template_instantiate(call=None, kwargs=None)

Instantiates a new virtual machine from a template.

New in version 2016.3.0.

Note

template_instantiate creates a VM on OpenNebula from a template, but it does not install Salt on the new VM. Use the create function for that functionality: salt-cloud -p opennebula-profile vm-name.

vm_name

Name for the new VM instance.

template_id

The ID of the template from which the VM will be created. Can be used instead of template_name.

template_name

The name of the template from which the VM will be created. Can be used instead of template_id.

CLI Example:

salt-cloud -f template_instantiate opennebula vm_name=my-new-vm template_id=0
salt.cloud.clouds.opennebula.template_update(call=None, kwargs=None)

Replaces the template contents.

New in version 2016.3.0.

template_id

The ID of the template to update. Can be used instead of template_name.

template_name

The name of the template to update. Can be used instead of template_id.

path

The path to a file containing the elements of the template to be updated. Syntax within the file can be the usual attribute=value or XML. Can be used instead of data.

data

Contains the elements of the template to be updated. Syntax can be the usual attribute=value or XML. Can be used instead of path.

update_type

There are two ways to update a template: replace the whole template or merge the new template with the existing one.

CLI Example:

salt-cloud --function template_update opennebula template_id=1 update_type=replace \
    path=/path/to/template_update_file.txt
salt-cloud -f template_update opennebula template_name=my-template update_type=merge \
    data='CPU="1.0" DISK=[IMAGE="Ubuntu-14.04"] GRAPHICS=[LISTEN="0.0.0.0",TYPE="vnc"] \
    MEMORY="1024" NETWORK="yes" NIC=[NETWORK="192net",NETWORK_UNAME="oneadmin"] \
    OS=[ARCH="x86_64"] SUNSTONE_CAPACITY_SELECT="YES" SUNSTONE_NETWORK_SELECT="YES" \
    VCPU="1"'
salt.cloud.clouds.opennebula.vm_action(name, kwargs=None, call=None)

Submits an action to be performed on a given virtual machine.

New in version 2016.3.0.

name

The name of the VM to action.

action
The action to be performed on the VM. Available options include:
  • boot

  • delete

  • delete-recreate

  • hold

  • poweroff

  • poweroff-hard

  • reboot

  • reboot-hard

  • release

  • resched

  • resume

  • shutdown

  • shutdown-hard

  • stop

  • suspend

  • undeploy

  • undeploy-hard

  • unresched

CLI Example:

salt-cloud -a vm_action my-vm action='release'
salt.cloud.clouds.opennebula.vm_allocate(call=None, kwargs=None)

Allocates a new virtual machine in OpenNebula.

New in version 2016.3.0.

path

The path to a file defining the template of the VM to allocate. Syntax within the file can be the usual attribute=value or XML. Can be used instead of data.

data

Contains the template definitions of the VM to allocate. Syntax can be the usual attribute=value or XML. Can be used instead of path.

hold

If this parameter is set to True, the VM will be created in the HOLD state. If not set, the VM is created in the PENDING state. Default is False.

CLI Example:

salt-cloud -f vm_allocate path=/path/to/vm_template.txt
salt-cloud --function vm_allocate path=/path/to/vm_template.txt hold=True
salt.cloud.clouds.opennebula.vm_attach(name, kwargs=None, call=None)

Attaches a new disk to the given virtual machine.

New in version 2016.3.0.

name

The name of the VM for which to attach the new disk.

path

The path to a file containing a single disk vector attribute. Syntax within the file can be the usual attribute=value or XML. Can be used instead of data.

data

Contains the data needed to attach a single disk vector attribute. Syntax can be the usual attribute=value or XML. Can be used instead of path.

CLI Example:

salt-cloud -a vm_attach my-vm path=/path/to/disk_file.txt
salt-cloud -a vm_attach my-vm data="DISK=[DISK_ID=1]"
salt.cloud.clouds.opennebula.vm_attach_nic(name, kwargs=None, call=None)

Attaches a new network interface to the given virtual machine.

New in version 2016.3.0.

name

The name of the VM for which to attach the new network interface.

path

The path to a file containing a single NIC vector attribute. Syntax within the file can be the usual attribute=value or XML. Can be used instead of data.

data

Contains the single NIC vector attribute to attach to the VM. Syntax can be the usual attribute=value or XML. Can be used instead of path.

CLI Example:

salt-cloud -a vm_attach_nic my-vm path=/path/to/nic_file.txt
salt-cloud -a vm_attach_nic my-vm data="NIC=[NETWORK_ID=1]"
salt.cloud.clouds.opennebula.vm_deploy(name, kwargs=None, call=None)

Initiates the instance of the given VM on the target host.

New in version 2016.3.0.

name

The name of the VM to deploy.

host_id

The ID of the target host where the VM will be deployed. Can be used instead of host_name.

host_name

The name of the target host where the VM will be deployed. Can be used instead of host_id.

capacity_maintained

True to enforce the Host capacity is not over-committed. This parameter is only acknowledged for users in the oneadmin group. Host capacity will be always enforced for regular users.

datastore_id

The ID of the target system data-store where the VM will be deployed. Optional and can be used instead of datastore_name. If neither datastore_id nor datastore_name are set, OpenNebula will choose the data-store.

datastore_name

The name of the target system data-store where the VM will be deployed. Optional, and can be used instead of datastore_id. If neither datastore_id nor datastore_name are set, OpenNebula will choose the data-store.

CLI Example:

salt-cloud -a vm_deploy my-vm host_id=0
salt-cloud -a vm_deploy my-vm host_id=1 capacity_maintained=False
salt-cloud -a vm_deploy my-vm host_name=host01 datastore_id=1
salt-cloud -a vm_deploy my-vm host_name=host01 datastore_name=default
salt.cloud.clouds.opennebula.vm_detach(name, kwargs=None, call=None)

Detaches a disk from a virtual machine.

New in version 2016.3.0.

name

The name of the VM from which to detach the disk.

disk_id

The ID of the disk to detach.

CLI Example:

salt-cloud -a vm_detach my-vm disk_id=1
salt.cloud.clouds.opennebula.vm_detach_nic(name, kwargs=None, call=None)

Detaches a disk from a virtual machine.

New in version 2016.3.0.

name

The name of the VM from which to detach the network interface.

nic_id

The ID of the nic to detach.

CLI Example:

salt-cloud -a vm_detach_nic my-vm nic_id=1
salt.cloud.clouds.opennebula.vm_disk_save(name, kwargs=None, call=None)

Sets the disk to be saved in the given image.

New in version 2016.3.0.

name

The name of the VM containing the disk to save.

disk_id

The ID of the disk to save.

image_name

The name of the new image where the disk will be saved.

image_type

The type for the new image. If not set, then the default ONED Configuration will be used. Other valid types include: OS, CDROM, DATABLOCK, KERNEL, RAMDISK, and CONTEXT.

snapshot_id

The ID of the snapshot to export. If not set, the current image state will be used.

CLI Example:

salt-cloud -a vm_disk_save my-vm disk_id=1 image_name=my-new-image
salt-cloud -a vm_disk_save my-vm disk_id=1 image_name=my-new-image image_type=CONTEXT snapshot_id=10
salt.cloud.clouds.opennebula.vm_disk_snapshot_create(name, kwargs=None, call=None)

Takes a new snapshot of the disk image.

New in version 2016.3.0.

name

The name of the VM of which to take the snapshot.

disk_id

The ID of the disk to save.

description

The description for the snapshot.

CLI Example:

salt-cloud -a vm_disk_snapshot_create my-vm disk_id=0 description="My Snapshot Description"
salt.cloud.clouds.opennebula.vm_disk_snapshot_delete(name, kwargs=None, call=None)

Deletes a disk snapshot based on the given VM and the disk_id.

New in version 2016.3.0.

name

The name of the VM containing the snapshot to delete.

disk_id

The ID of the disk to save.

snapshot_id

The ID of the snapshot to be deleted.

CLI Example:

salt-cloud -a vm_disk_snapshot_delete my-vm disk_id=0 snapshot_id=6
salt.cloud.clouds.opennebula.vm_disk_snapshot_revert(name, kwargs=None, call=None)

Reverts a disk state to a previously taken snapshot.

New in version 2016.3.0.

name

The name of the VM containing the snapshot.

disk_id

The ID of the disk to revert its state.

snapshot_id

The ID of the snapshot to which the snapshot should be reverted.

CLI Example:

salt-cloud -a vm_disk_snapshot_revert my-vm disk_id=0 snapshot_id=6
salt.cloud.clouds.opennebula.vm_info(name, call=None)

Retrieves information for a given virtual machine. A VM name must be supplied.

New in version 2016.3.0.

name

The name of the VM for which to gather information.

CLI Example:

salt-cloud -a vm_info my-vm
salt.cloud.clouds.opennebula.vm_migrate(name, kwargs=None, call=None)

Migrates the specified virtual machine to the specified target host.

New in version 2016.3.0.

name

The name of the VM to migrate.

host_id

The ID of the host to which the VM will be migrated. Can be used instead of host_name.

host_name

The name of the host to which the VM will be migrated. Can be used instead of host_id.

live_migration

If set to True, a live-migration will be performed. Default is False.

capacity_maintained

True to enforce the Host capacity is not over-committed. This parameter is only acknowledged for users in the oneadmin group. Host capacity will be always enforced for regular users.

datastore_id

The target system data-store ID where the VM will be migrated. Can be used instead of datastore_name.

datastore_name

The name of the data-store target system where the VM will be migrated. Can be used instead of datastore_id.

CLI Example:

salt-cloud -a vm_migrate my-vm host_id=0 datastore_id=1
salt-cloud -a vm_migrate my-vm host_id=0 datastore_id=1 live_migration=True
salt-cloud -a vm_migrate my-vm host_name=host01 datastore_name=default
salt.cloud.clouds.opennebula.vm_monitoring(name, call=None)

Returns the monitoring records for a given virtual machine. A VM name must be supplied.

The monitoring information returned is a list of VM elements. Each VM element contains the complete dictionary of the VM with the updated information returned by the poll action.

New in version 2016.3.0.

name

The name of the VM for which to gather monitoring records.

CLI Example:

salt-cloud -a vm_monitoring my-vm
salt.cloud.clouds.opennebula.vm_resize(name, kwargs=None, call=None)

Changes the capacity of the virtual machine.

New in version 2016.3.0.

name

The name of the VM to resize.

path

The path to a file containing new capacity elements CPU, VCPU, MEMORY. If one of them is not present, or its value is 0, the VM will not be re-sized. Syntax within the file can be the usual attribute=value or XML. Can be used instead of data.

data

Contains the new capacity elements CPU, VCPU, and MEMORY. If one of them is not present, or its value is 0, the VM will not be re-sized. Can be used instead of path.

capacity_maintained

True to enforce the Host capacity is not over-committed. This parameter is only acknowledged for users in the oneadmin group. Host capacity will be always enforced for regular users.

CLI Example:

salt-cloud -a vm_resize my-vm path=/path/to/capacity_template.txt
salt-cloud -a vm_resize my-vm path=/path/to/capacity_template.txt capacity_maintained=False
salt-cloud -a vm_resize my-vm data="CPU=1 VCPU=1 MEMORY=1024"
salt.cloud.clouds.opennebula.vm_snapshot_create(vm_name, kwargs=None, call=None)

Creates a new virtual machine snapshot from the provided VM.

New in version 2016.3.0.

vm_name

The name of the VM from which to create the snapshot.

snapshot_name

The name of the snapshot to be created.

CLI Example:

salt-cloud -a vm_snapshot_create my-vm snapshot_name=my-new-snapshot
salt.cloud.clouds.opennebula.vm_snapshot_delete(vm_name, kwargs=None, call=None)

Deletes a virtual machine snapshot from the provided VM.

New in version 2016.3.0.

vm_name

The name of the VM from which to delete the snapshot.

snapshot_id

The ID of the snapshot to be deleted.

CLI Example:

salt-cloud -a vm_snapshot_delete my-vm snapshot_id=8
salt.cloud.clouds.opennebula.vm_snapshot_revert(vm_name, kwargs=None, call=None)

Reverts a virtual machine to a snapshot

New in version 2016.3.0.

vm_name

The name of the VM to revert.

snapshot_id

The snapshot ID.

CLI Example:

salt-cloud -a vm_snapshot_revert my-vm snapshot_id=42
salt.cloud.clouds.opennebula.vm_update(name, kwargs=None, call=None)

Replaces the user template contents.

New in version 2016.3.0.

name

The name of the VM to update.

path

The path to a file containing new user template contents. Syntax within the file can be the usual attribute=value or XML. Can be used instead of data.

data

Contains the new user template contents. Syntax can be the usual attribute=value or XML. Can be used instead of path.

update_type

There are two ways to update a VM: replace the whole template or merge the new template with the existing one.

CLI Example:

salt-cloud -a vm_update my-vm path=/path/to/user_template_file.txt update_type='replace'
salt.cloud.clouds.opennebula.vn_add_ar(call=None, kwargs=None)

Adds address ranges to a given virtual network.

New in version 2016.3.0.

vn_id

The ID of the virtual network to add the address range. Can be used instead of vn_name.

vn_name

The name of the virtual network to add the address range. Can be used instead of vn_id.

path

The path to a file containing the template of the address range to add. Syntax within the file can be the usual attribute=value or XML. Can be used instead of data.

data

Contains the template of the address range to add. Syntax can be the usual attribute=value or XML. Can be used instead of path.

CLI Example:

salt-cloud -f vn_add_ar opennebula vn_id=3 path=/path/to/address_range.txt
salt-cloud -f vn_add_ar opennebula vn_name=my-vn \
    data="AR=[TYPE=IP4, IP=192.168.0.5, SIZE=10]"
salt.cloud.clouds.opennebula.vn_allocate(call=None, kwargs=None)

Allocates a new virtual network in OpenNebula.

New in version 2016.3.0.

path

The path to a file containing the template of the virtual network to allocate. Syntax within the file can be the usual attribute=value or XML. Can be used instead of data.

data

Contains the template of the virtual network to allocate. Syntax can be the usual attribute=value or XML. Can be used instead of path.

cluster_id

The ID of the cluster for which to add the new virtual network. Can be used instead of cluster_name. If neither cluster_id nor cluster_name are provided, the virtual network won’t be added to any cluster.

cluster_name

The name of the cluster for which to add the new virtual network. Can be used instead of cluster_id. If neither cluster_name nor cluster_id are provided, the virtual network won't be added to any cluster.

CLI Example:

salt-cloud -f vn_allocate opennebula path=/path/to/vn_file.txt
salt.cloud.clouds.opennebula.vn_delete(call=None, kwargs=None)

Deletes the given virtual network from OpenNebula. Either a name or a vn_id must be supplied.

New in version 2016.3.0.

name

The name of the virtual network to delete. Can be used instead of vn_id.

vn_id

The ID of the virtual network to delete. Can be used instead of name.

CLI Example:

salt-cloud -f vn_delete opennebula name=my-virtual-network
salt-cloud --function vn_delete opennebula vn_id=3
salt.cloud.clouds.opennebula.vn_free_ar(call=None, kwargs=None)

Frees a reserved address range from a virtual network.

New in version 2016.3.0.

vn_id

The ID of the virtual network from which to free an address range. Can be used instead of vn_name.

vn_name

The name of the virtual network from which to free an address range. Can be used instead of vn_id.

ar_id

The ID of the address range to free.

CLI Example:

salt-cloud -f vn_free_ar opennebula vn_id=3 ar_id=1
salt-cloud -f vn_free_ar opennebula vn_name=my-vn ar_id=1
salt.cloud.clouds.opennebula.vn_hold(call=None, kwargs=None)

Holds a virtual network lease as used.

New in version 2016.3.0.

vn_id

The ID of the virtual network from which to hold the lease. Can be used instead of vn_name.

vn_name

The name of the virtual network from which to hold the lease. Can be used instead of vn_id.

path

The path to a file defining the template of the lease to hold. Syntax within the file can be the usual attribute=value or XML. Can be used instead of data.

data

Contains the template of the lease to hold. Syntax can be the usual attribute=value or XML. Can be used instead of path.

CLI Example:

salt-cloud -f vn_hold opennebula vn_id=3 path=/path/to/vn_hold_file.txt
salt-cloud -f vn_hold opennebula vn_name=my-vn data="LEASES=[IP=192.168.0.5]"
salt.cloud.clouds.opennebula.vn_info(call=None, kwargs=None)

Retrieves information for the virtual network.

New in version 2016.3.0.

name

The name of the virtual network for which to gather information. Can be used instead of vn_id.

vn_id

The ID of the virtual network for which to gather information. Can be used instead of name.

CLI Example:

salt-cloud -f vn_info opennebula vn_id=3
salt-cloud --function vn_info opennebula name=public
salt.cloud.clouds.opennebula.vn_release(call=None, kwargs=None)

Releases a virtual network lease that was previously on hold.

New in version 2016.3.0.

vn_id

The ID of the virtual network from which to release the lease. Can be used instead of vn_name.

vn_name

The name of the virtual network from which to release the lease. Can be used instead of vn_id.

path

The path to a file defining the template of the lease to release. Syntax within the file can be the usual attribute=value or XML. Can be used instead of data.

data

Contains the template defining the lease to release. Syntax can be the usual attribute=value or XML. Can be used instead of path.

CLI Example:

salt-cloud -f vn_release opennebula vn_id=3 path=/path/to/vn_release_file.txt
salt-cloud =f vn_release opennebula vn_name=my-vn data="LEASES=[IP=192.168.0.5]"
salt.cloud.clouds.opennebula.vn_reserve(call=None, kwargs=None)

Reserve network addresses.

New in version 2016.3.0.

vn_id

The ID of the virtual network from which to reserve addresses. Can be used instead of vn_name.

vn_name

The name of the virtual network from which to reserve addresses. Can be used instead of vn_id.

path

The path to a file defining the template of the address reservation. Syntax within the file can be the usual attribute=value or XML. Can be used instead of data.

data

Contains the template defining the address reservation. Syntax can be the usual attribute=value or XML. Data provided must be wrapped in double quotes. Can be used instead of path.

CLI Example:

salt-cloud -f vn_reserve opennebula vn_id=3 path=/path/to/vn_reserve_file.txt
salt-cloud -f vn_reserve opennebula vn_name=my-vn data="SIZE=10 AR_ID=8 NETWORK_ID=1"