vmjuggler.VCenter¶
-
class
vmjuggler.
VCenter
(address, username, password)¶ VCenter object
Parameters: - address (str) – VCenter address or IP.
- username (str) – User name.
- password (str) – User password.
-
connect
(exit_on_fault=True)¶ Connect to VCenter.
Currently doesn’t use certificate, as it not used in the most installations or self-signed used.
Parameters: exit_on_fault (bool) – Perform exit on connection fault if True, otherwise returns None. Returns: VMWare ServiceInstance object or None in case of connection fault.
-
create_vm
()¶ Create new VM.
Returns:
-
disconnect
()¶ Close connection with VCenter.
-
get_all
(name=None, root=None, get_all=False, raw=False)¶ Get the object by name or list of all objects.
Parameters: - name (str) – Object name or list of names.
- root (str) – The folder to start looking from.
- get_all (bool) – The ‘name’ ignored and all objects of specified types are returned if set to True.
- raw (bool) – The raw objects will be returned if set otherwise ‘vmjuggler.BaseVCObject’ type.
Returns: List of objects.
-
get_datastore
(name=None, root=None, get_all=False, raw=False)¶ Get the Datastore by name or list of all Datastores.
Parameters: - name (str) – Datastore name or list of names.
- root (str) – The folder to start looking from.
- get_all (bool) – The ‘name’ ignored and all objects of specified types are returned if set to True.
- raw (bool) – The raw objects will be returned if set otherwise ‘vmjuggler.Datastore’ type.
Returns: List of objects.
-
get_dc
(name=None, root=None, get_all=False, raw=False)¶ Get the Datacenter by name or list of all DCs.
Parameters: - name (str) – DC name or list of names.
- root (str) – The folder to start looking from.
- get_all (bool) – The ‘name’ ignored and all objects of specified types are returned if set to True.
- raw (bool) – The raw objects will be returned if set otherwise ‘vmjuggler.DataCenter’ type.
Returns: List of objects.
-
get_folder
(name=None, root=None, get_all=False, raw=False)¶ Get the Folder by name or list of all Folders.
Parameters: - name (str) – Folder name or list of names.
- root (str) – The folder to start looking from.
- get_all (bool) – The ‘name’ ignored and all objects of specified types are returned if set to True.
- raw (bool) – The raw objects will be returned if set otherwise ‘vmjuggler.Folder’ type.
Returns: List of objects.
-
get_host
(name=None, root=None, get_all=False, raw=False)¶ Get the Host by name or list of all Hosts.
Parameters: - name (str) – DC name or list of names.
- root (str) – The folder to start looking from.
- get_all (bool) – The ‘name’ ignored and all objects of specified types are returned if set to True.
- raw (bool) – The raw objects will be returned if set otherwise ‘vmjuggler.Host’ type.
Returns: List of objects.
-
get_network
(name=None, root=None, get_all=False, raw=False)¶ Get the Network by name or list of all Networks.
Parameters: - name (str) – Network name or list of names.
- root (str) – The folder to start looking from.
- get_all (bool) – The ‘name’ ignored and all objects of specified types are returned if set to True.
- raw (bool) – The raw objects will be returned if set otherwise ‘vmjuggler.Network’ type.
Returns: List of objects.
-
get_vapp
(name=None, root=None, get_all=False, raw=False)¶ Get the VApp by name or list of all VApps.
Parameters: - name (str) – VApp name or list of names.
- root (str) – The folder to start looking from.
- get_all (bool) – The ‘name’ ignored and all objects of specified types are returned if set to True.
- raw (bool) – The raw objects will be returned if set otherwise ‘vmjuggler.VApp’ type.
Returns: List of objects.
-
get_vm
(name=None, root=None, get_all=False, raw=False)¶ Get the VM by name or list of all VMs.
Parameters: - name (str) – VM name or list of names.
- root (str) – The folder to start looking from.
- get_all (bool) – The ‘name’ ignored and all objects of specified types are returned if set to True.
- raw (bool) – The raw objects will be returned if set otherwise ‘vmjuggler.VirtualMachine’ type.
Returns: List of objects.
-
raw_global
¶ Return raw_global parameter.
Returns: Boolean or None.
-
return_single
¶ Return return_single parameter.
Returns:
-
set_raw_global
(value)¶ Set raw_global parameter.
The raw_globals defines type of objects to be returned by get_* methods.
True - always return raw VMWare Managed object.
False - always return extended vmjuggler.* object.
None - return type defined independently by ‘raw’ parameter of the get_* methods.
Parameters: value (bool) – True/False/None. Returns: set value.
-
set_return_single
(value)¶ Set return_single parameter
If set, output of get_* methods changes as follow:
If returning list of objects has the only one element it will be returned as single object, not as a list.
If returning list is empty, the None will be returned.
The feature is implemented by using decorator
@Decor.single_object
.Parameters: value (bool) – Returns: set value.