utils.miq_soap module

SOAP wrapper for CFME.

Enables to operate Infrastructure objects. It has better VM provisioning code. OOP encapsulated.

class utils.miq_soap.BelongsToCluster(id)[source]

Bases: utils.miq_soap.BelongsToProvider

cluster[source]
class utils.miq_soap.BelongsToProvider(id)[source]

Bases: utils.miq_soap.MiqInfraObject

provider[source]
class utils.miq_soap.HasManyDatastores(id)[source]

Bases: utils.miq_soap.MiqInfraObject

datastores[source]
class utils.miq_soap.HasManyEMSs(id)[source]

Bases: utils.miq_soap.MiqInfraObject

emss[source]
class utils.miq_soap.HasManyHosts(id)[source]

Bases: utils.miq_soap.MiqInfraObject

hosts[source]
class utils.miq_soap.HasManyResourcePools(id)[source]

Bases: utils.miq_soap.MiqInfraObject

resource_pools[source]
class utils.miq_soap.HasManyVMs(id)[source]

Bases: utils.miq_soap.MiqInfraObject

vms[source]
class utils.miq_soap.MiqCluster(id)[source]

Bases: utils.miq_soap.HasManyDatastores, utils.miq_soap.HasManyHosts, utils.miq_soap.HasManyVMs, utils.miq_soap.HasManyResourcePools, utils.miq_soap.BelongsToProvider

GETTER_FUNC = 'FindClusterById'
TAG_PREFIX = 'Cluster'
classmethod all()[source]
default_resource_pool[source]
class utils.miq_soap.MiqDatastore(id)[source]

Bases: utils.miq_soap.HasManyHosts, utils.miq_soap.HasManyEMSs

GETTER_FUNC = 'FindDatastoreById'
TAG_PREFIX = 'Datastore'
classmethod all()[source]
class utils.miq_soap.MiqEms(id)[source]

Bases: utils.miq_soap.HasManyDatastores, utils.miq_soap.HasManyHosts, utils.miq_soap.HasManyVMs, utils.miq_soap.HasManyResourcePools

GETTER_FUNC = 'FindEmsByGuid'
TAG_PREFIX = 'Ems'
classmethod all()[source]
clusters[source]
direct_connection[source]

Returns an API from mgmt_system.py targeted at this provider

This attribute is lazily evaluated and cached.

classmethod find_by_name(name)[source]
host_name[source]
ip_address[source]
port[source]
class utils.miq_soap.MiqHost(id)[source]

Bases: utils.miq_soap.HasManyDatastores, utils.miq_soap.HasManyVMs, utils.miq_soap.HasManyResourcePools, utils.miq_soap.BelongsToCluster

GETTER_FUNC = 'FindHostByGuid'
TAG_PREFIX = 'Host'
classmethod all()[source]
class utils.miq_soap.MiqInfraObject(id)[source]

Bases: object

Base class for all infrastructure objects.

Parameters:id – GUID or ID of the object, it depends on what does the particular SOAP function wants.
GETTER_FUNC = None
TAG_PREFIX = None
add_tag(tag)[source]

Add tag to the object

Parameters:tag – Tuple with tag specification.
exists[source]
id[source]
name[source]
object[source]

Accesses SOAP object

Accesses network.

tags[source]

Return tags as an array of MiqTag objects.

ws_attributes[source]

Processes object.ws_attributes into builtin types

class utils.miq_soap.MiqResourcePool(id)[source]

Bases: utils.miq_soap.HasManyHosts, utils.miq_soap.HasManyEMSs

GETTER_FUNC = 'FindResourcePoolById'
TAG_PREFIX = 'ResourcePool'
classmethod all()[source]
store_type[source]
class utils.miq_soap.MiqTag(category, category_dn, tag_name, tag_dname, tag_path, dn)[source]

Bases: object

class utils.miq_soap.MiqVM(id)[source]

Bases: utils.miq_soap.HasManyDatastores, utils.miq_soap.BelongsToCluster

GETTER_FUNC = 'FindVmByGuid'
TAG_PREFIX = 'Vm'
delete()[source]

Delete the VM from VMDB. To completely delete, use direct_connection.

description[source]
host[source]
is_powered_off[source]
is_powered_on[source]
is_suspended[source]
power_off()[source]
power_on()[source]
classmethod provision_from_template(template_name, vm_name, wait_min=None, cpus=1, memory=1024, vlan=None, first_name='Shadowman', last_name='RedHat', email='shadowm@n.redhat.com')[source]

Provision VM from template.

Works independently on the management system, tags appropriate VMDB objects to provision without problems.

Parameters:
  • template_name – Name of the template to use.
  • vm_name – VM Name.
  • wait_min – How many minutes of wait for the provisioning to finish.
  • cpus – How many CPUs should the VM have.
  • memory – How much memory (in MB) should the VM have.
  • vlan – Where to connect the VM. Obligatory for RHEV
  • first_name – Name of the requestee
  • last_name – Surname of the requestee
  • email – Email of the requestee

Returns: MiqVM object with freshly provisioned VM.

suspend()[source]
vendor[source]
wait_powered_off(wait_time=120)[source]
wait_powered_on(wait_time=120)[source]
wait_suspended(wait_time=160)[source]
utils.miq_soap.get_client()[source]
utils.miq_soap.is_datastore_banned(datastore_name)[source]

Checks whether the datastore is in the list of datastores not allowed to use

Parameters:datastore_name – Name of the datastore

Returns: bool

utils.miq_soap.set_client(client)[source]