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]"
Return available OpenNebula images.
CLI Example:
salt-cloud --list-images opennebula salt-cloud --function avail_images opennebula salt-cloud -f avail_images opennebula
Return available OpenNebula locations.
CLI Example:
salt-cloud --list-locations opennebula salt-cloud --function avail_locations opennebula salt-cloud -f avail_locations opennebula
Because sizes are built into templates with OpenNebula, there will be no sizes to return here.
Create a single VM from a data dict.
Optional vm_ dict options for overwriting template:
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
Destroy a node. Will check termination protection and warn if enabled.
CLI Example:
salt-cloud --destroy vm_name salt-cloud -d vm_name salt-cloud --action destroy vm_name salt-cloud -a destroy vm_name
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
Return the first configured instance.
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
Warn if dependencies aren't met.
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
Return the image object to use.
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
Return the VM's location.
Returns the OpenNebula version.
New in version 2016.3.5.
CLI Example:
salt-cloud -f get_one_version one_provider_name
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
Return the template id for a VM.
New in version 2016.11.0.
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
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
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
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
Allocates a new image in OpenNebula.
New in version 2016.3.0.
data
.path
.datastore_name
.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."'
Clones an existing image.
New in version 2016.3.0.
image_name
.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
Deletes the given image from OpenNebula. Either a name or an image_id must be supplied.
New in version 2016.3.0.
image_id
.name
.CLI Example:
salt-cloud -f image_delete opennebula name=my-image salt-cloud --function image_delete opennebula image_id=100
Retrieves information for a given image. Either a name or an image_id must be supplied.
New in version 2016.3.0.
image_id
.name
.CLI Example:
salt-cloud -f image_info opennebula name=my-image salt-cloud --function image_info opennebula image_id=5
Sets the Image as persistent or not persistent.
New in version 2016.3.0.
image_id
.name
.CLI Example:
salt-cloud -f image_persistent opennebula name=my-image persist=True salt-cloud --function image_persistent opennebula image_id=5 persist=False
Deletes a snapshot from the image.
New in version 2016.3.0.
image_name
.image_id
.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
Flattens the snapshot of an image and discards others.
New in version 2016.3.0.
image_name
.image_id
.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
Reverts an image state to a previous snapshot.
New in version 2016.3.0.
image_name
.image_id
.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
Replaces the image template contents.
New in version 2016.3.0.
image_name
.image_id
.data
.path
.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."'
Returns a list of clusters in OpenNebula.
New in version 2016.3.0.
CLI Example:
salt-cloud -f list_clusters opennebula
Returns a list of data stores on OpenNebula.
New in version 2016.3.0.
CLI Example:
salt-cloud -f list_datastores opennebula
Returns a list of hosts on OpenNebula.
New in version 2016.3.0.
CLI Example:
salt-cloud -f list_hosts opennebula
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
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
Return a list of the VMs that are on the provider, with select fields.
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
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
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
Reboot a VM.
New in version 2016.3.0.
CLI Example:
salt-cloud -a reboot my-vm
Allocates a new security group in OpenNebula.
New in version 2016.3.0.
data
.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]"
Clones an existing security group.
New in version 2016.3.0.
secgroup_name
.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
Deletes the given security group from OpenNebula. Either a name or a secgroup_id must be supplied.
New in version 2016.3.0.
secgroup_id
.name
.CLI Example:
salt-cloud -f secgroup_delete opennebula name=my-secgroup salt-cloud --function secgroup_delete opennebula secgroup_id=100
Retrieves information for the given security group. Either a name or a secgroup_id must be supplied.
New in version 2016.3.0.
secgroup_id
.name
.CLI Example:
salt-cloud -f secgroup_info opennebula name=my-secgroup salt-cloud --function secgroup_info opennebula secgroup_id=5
Replaces the security group template contents.
New in version 2016.3.0.
secgroup_name
.secgroup_id
.data
.path
.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]"
Show the details from OpenNebula concerning a named VM.
function
.CLI Example:
salt-cloud --action show_instance vm_name salt-cloud -a show_instance vm_name
Start a VM.
New in version 2016.3.0.
CLI Example:
salt-cloud -a start my-vm
Stop a VM.
New in version 2016.3.0.
CLI Example:
salt-cloud -a stop my-vm
Allocates a new template in OpenNebula.
New in version 2016.3.0.
data
.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"'
Clones an existing virtual machine template.
New in version 2016.3.0.
template_name
.template_id
.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
Deletes the given template from OpenNebula. Either a name or a template_id must be supplied.
New in version 2016.3.0.
template_id
.name
.CLI Example:
salt-cloud -f template_delete opennebula name=my-template salt-cloud --function template_delete opennebula template_id=5
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
.
template_name
.template_id
.CLI Example:
salt-cloud -f template_instantiate opennebula vm_name=my-new-vm template_id=0
Replaces the template contents.
New in version 2016.3.0.
template_name
.template_id
.data
.path
.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"'
Submits an action to be performed on a given virtual machine.
New in version 2016.3.0.
CLI Example:
salt-cloud -a vm_action my-vm action='release'
Allocates a new virtual machine in OpenNebula.
New in version 2016.3.0.
data
.path
.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
Attaches a new disk to the given virtual machine.
New in version 2016.3.0.
data
.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]"
Attaches a new network interface to the given virtual machine.
New in version 2016.3.0.
data
.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]"
Initiates the instance of the given VM on the target host.
New in version 2016.3.0.
host_name
.host_id
.oneadmin
group. Host capacity will be always enforced for regular users.datastore_name
. If neither datastore_id
nor datastore_name
are set, OpenNebula will choose the data-store.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
Detaches a disk from a virtual machine.
New in version 2016.3.0.
CLI Example:
salt-cloud -a vm_detach my-vm disk_id=1
Detaches a disk from a virtual machine.
New in version 2016.3.0.
CLI Example:
salt-cloud -a vm_detach_nic my-vm nic_id=1
Sets the disk to be saved in the given image.
New in version 2016.3.0.
ONED
Configuration will be used. Other valid types include: OS, CDROM, DATABLOCK, KERNEL, RAMDISK, and CONTEXT.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
Takes a new snapshot of the disk image.
New in version 2016.3.0.
CLI Example:
salt-cloud -a vm_disk_snapshot_create my-vm disk_id=0 description="My Snapshot Description"
Deletes a disk snapshot based on the given VM and the disk_id.
New in version 2016.3.0.
CLI Example:
salt-cloud -a vm_disk_snapshot_delete my-vm disk_id=0 snapshot_id=6
Reverts a disk state to a previously taken snapshot.
New in version 2016.3.0.
CLI Example:
salt-cloud -a vm_disk_snapshot_revert my-vm disk_id=0 snapshot_id=6
Retrieves information for a given virtual machine. A VM name must be supplied.
New in version 2016.3.0.
CLI Example:
salt-cloud -a vm_info my-vm
Migrates the specified virtual machine to the specified target host.
New in version 2016.3.0.
host_name
.host_id
.True
, a live-migration will be performed. Default is False
.oneadmin
group. Host capacity will be always enforced for regular users.datastore_name
.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
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.
CLI Example:
salt-cloud -a vm_monitoring my-vm
Changes the capacity of the virtual machine.
New in version 2016.3.0.
data
.path
.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"
Creates a new virtual machine snapshot from the provided VM.
New in version 2016.3.0.
CLI Example:
salt-cloud -a vm_snapshot_create my-vm snapshot_name=my-new-snapshot
Deletes a virtual machine snapshot from the provided VM.
New in version 2016.3.0.
CLI Example:
salt-cloud -a vm_snapshot_delete my-vm snapshot_id=8
Reverts a virtual machine to a snapshot
New in version 2016.3.0.
CLI Example:
salt-cloud -a vm_snapshot_revert my-vm snapshot_id=42
Replaces the user template contents.
New in version 2016.3.0.
data
.path
.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'
Adds address ranges to a given virtual network.
New in version 2016.3.0.
vn_name
.vn_id
.data
.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]"
Allocates a new virtual network in OpenNebula.
New in version 2016.3.0.
data
.path
.cluster_name
. If neither cluster_id
nor cluster_name
are provided, the virtual network won’t be added to any cluster.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
Deletes the given virtual network from OpenNebula. Either a name or a vn_id must be supplied.
New in version 2016.3.0.
vn_id
.name
.CLI Example:
salt-cloud -f vn_delete opennebula name=my-virtual-network salt-cloud --function vn_delete opennebula vn_id=3
Frees a reserved address range from a virtual network.
New in version 2016.3.0.
vn_name
.vn_id
.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
Holds a virtual network lease as used.
New in version 2016.3.0.
vn_name
.vn_id
.data
.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]"
Retrieves information for the virtual network.
New in version 2016.3.0.
vn_id
.name
.CLI Example:
salt-cloud -f vn_info opennebula vn_id=3 salt-cloud --function vn_info opennebula name=public
Releases a virtual network lease that was previously on hold.
New in version 2016.3.0.
vn_name
.vn_id
.data
.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]"
Reserve network addresses.
New in version 2016.3.0.
data
.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"
© 2019 SaltStack.
Licensed under the Apache License, Version 2.0.
https://docs.saltstack.com/en/latest/ref/clouds/all/salt.cloud.clouds.opennebula.html