text
stringlengths
81
112k
Returns distributed virtual switches (DVSs) in a datacenter. dc_ref The parent datacenter reference. dvs_names The names of the DVSs to return. Default is None. get_all_dvss Return all DVSs in the datacenter. Default is False. def get_dvss(dc_ref, dvs_names=None, get_all_dvss=Fal...
Retrieves the network folder of a datacenter def get_network_folder(dc_ref): ''' Retrieves the network folder of a datacenter ''' dc_name = get_managed_object_name(dc_ref) log.trace('Retrieving network folder in datacenter \'%s\'', dc_name) service_instance = get_service_instance_from_managed_o...
Creates a distributed virtual switches (DVS) in a datacenter. Returns the reference to the newly created distributed virtual switch. dc_ref The parent datacenter reference. dvs_name The name of the DVS to create. dvs_create_spec The DVS spec (vim.DVSCreateSpec) to use when cre...
Updates a distributed virtual switch with the config_spec. dvs_ref The DVS reference. dvs_config_spec The updated config spec (vim.VMwareDVSConfigSpec) to be applied to the DVS. def update_dvs(dvs_ref, dvs_config_spec): ''' Updates a distributed virtual switch with the config_...
Sets whether NIOC is enabled on a DVS. dvs_ref The DVS reference. enabled Flag specifying whether NIOC is enabled. def set_dvs_network_resource_management_enabled(dvs_ref, enabled): ''' Sets whether NIOC is enabled on a DVS. dvs_ref The DVS reference. enabled ...
Returns distributed virtual porgroups (dvportgroups). The parent object can be either a datacenter or a dvs. parent_ref The parent object reference. Can be either a datacenter or a dvs. portgroup_names The names of the dvss to return. Default is None. get_all_portgroups Return...
Returns the uplink distributed virtual portgroup of a distributed virtual switch (dvs) dvs_ref The dvs reference def get_uplink_dvportgroup(dvs_ref): ''' Returns the uplink distributed virtual portgroup of a distributed virtual switch (dvs) dvs_ref The dvs reference ''' ...
Creates a distributed virtual portgroup on a distributed virtual switch (dvs) dvs_ref The dvs reference spec Portgroup spec (vim.DVPortgroupConfigSpec) def create_dvportgroup(dvs_ref, spec): ''' Creates a distributed virtual portgroup on a distributed virtual switch (dvs) ...
Updates a distributed virtual portgroup portgroup_ref The portgroup reference spec Portgroup spec (vim.DVPortgroupConfigSpec) def update_dvportgroup(portgroup_ref, spec): ''' Updates a distributed virtual portgroup portgroup_ref The portgroup reference spec P...
Returns networks of standard switches. The parent object can be a datacenter. parent_ref The parent object reference. A datacenter object. network_names The name of the standard switch networks. Default is None. get_all_networks Boolean indicates whether to return all networks...
Returns a simple list of objects from a given service instance. service_instance The Service Instance for which to obtain a list of objects. object_type The type of content for which to obtain information. properties An optional list of object properties used to return reference r...
Returns the license manager. service_instance The Service Instance Object from which to obrain the license manager. def get_license_manager(service_instance): ''' Returns the license manager. service_instance The Service Instance Object from which to obrain the license manager. ''...
Returns the license assignment manager. service_instance The Service Instance Object from which to obrain the license manager. def get_license_assignment_manager(service_instance): ''' Returns the license assignment manager. service_instance The Service Instance Object from which to o...
Returns the licenses on a specific instance. service_instance The Service Instance Object from which to obrain the licenses. license_manager The License Manager object of the service instance. If not provided it will be retrieved. def get_licenses(service_instance, license_manager=Non...
Adds a license. service_instance The Service Instance Object. key The key of the license to add. description The description of the license to add. license_manager The License Manager object of the service instance. If not provided it will be retrieved. def a...
Returns the licenses assigned to an entity. If entity ref is not provided, then entity_name is assumed to be the vcenter. This is later checked if the entity name is provided. service_instance The Service Instance Object from which to obtain the licenses. entity_ref VMware entity to ge...
Assigns a license to an entity. service_instance The Service Instance Object from which to obrain the licenses. license_key The key of the license to add. license_name The description of the license to add. entity_ref VMware entity to assign the license to. If...
Returns all datacenters in a vCenter. service_instance The Service Instance Object from which to obtain cluster. datacenter_names List of datacenter names to filter by. Default value is None. get_all_datacenters Flag specifying whether to retrieve all datacenters. Default ...
Returns a vim.Datacenter managed object. service_instance The Service Instance Object from which to obtain datacenter. datacenter_name The datacenter name def get_datacenter(service_instance, datacenter_name): ''' Returns a vim.Datacenter managed object. service_instance ...
Creates a datacenter. .. versionadded:: 2017.7.0 service_instance The Service Instance Object datacenter_name The datacenter name def create_datacenter(service_instance, datacenter_name): ''' Creates a datacenter. .. versionadded:: 2017.7.0 service_instance The ...
Returns a cluster in a datacenter. dc_ref The datacenter reference cluster The cluster to be retrieved def get_cluster(dc_ref, cluster): ''' Returns a cluster in a datacenter. dc_ref The datacenter reference cluster The cluster to be retrieved ''' dc_...
Creates a cluster in a datacenter. dc_ref The parent datacenter reference. cluster_name The cluster name. cluster_spec The cluster spec (vim.ClusterConfigSpecEx). Defaults to None. def create_cluster(dc_ref, cluster_name, cluster_spec): ''' Creates a cluster in a ...
Updates a cluster in a datacenter. cluster_ref The cluster reference. cluster_spec The cluster spec (vim.ClusterConfigSpecEx). Defaults to None. def update_cluster(cluster_ref, cluster_spec): ''' Updates a cluster in a datacenter. cluster_ref The cluster reference...
Returns a list of datastores associated with a given service instance. The list contains basic information about the datastore: name, type, url, capacity, free, used, usage, hosts service_instance The Service Instance Object from which to obtain datastores. def list_datastores_full(service_ins...
Returns a dictionary with the basic information for the given datastore: name, type, url, capacity, free, used, usage, hosts service_instance The Service Instance Object from which to obtain datastores. datastore Name of the datastore. def list_datastore_full(service_instance, datasto...
Get reference to an object of specified object type and name si ServiceInstance for the vSphere or ESXi server (see get_service_instance) obj_type Type of the object (vim.StoragePod, vim.Datastore, etc) obj_name Name of the object def get_mor_by_name(si, obj_type, obj_name): ...
Get reference to an object of specified object type and id si ServiceInstance for the vSphere or ESXi server (see get_service_instance) obj_type Type of the object (vim.StoragePod, vim.Datastore, etc) obj_moid ID of the object def get_mor_by_moid(si, obj_type, obj_moid): ''' ...
Get the files with a given browser specification from the datastore. service_instance The Service Instance Object from which to obtain datastores. directory The name of the directory where we would like to search datastores Name of the datastores container_object The ...
Returns a list of vim.Datastore objects representing the datastores visible from a VMware object, filtered by their names, or the backing disk cannonical name or scsi_addresses service_instance The Service Instance Object from which to obtain datastores. reference The VMware object fro...
Renames a datastore datastore_ref vim.Datastore reference to the datastore object to be changed new_datastore_name New datastore name def rename_datastore(datastore_ref, new_datastore_name): ''' Renames a datastore datastore_ref vim.Datastore reference to the datastore ob...
Returns partition informations for a device path, of type vim.HostDiskPartitionInfo def _get_partition_info(storage_system, device_path): ''' Returns partition informations for a device path, of type vim.HostDiskPartitionInfo ''' try: partition_infos = \ storage_system.R...
Computes the new disk partition info when adding a new vmfs partition that uses up the remainder of the disk; returns a tuple (new_partition_number, vim.HostDiskPartitionSpec def _get_new_computed_partition_spec(storage_system, device_path, ...
Creates a VMFS datastore from a disk_id host_ref vim.HostSystem object referencing a host to create the datastore on datastore_name Name of the datastore disk_ref vim.HostScsiDislk on which the datastore is created vmfs_major_version VMFS major version to use def cre...
Returns a host's datastore system host_ref Reference to the ESXi host hostname Name of the host. This argument is optional. def get_host_datastore_system(host_ref, hostname=None): ''' Returns a host's datastore system host_ref Reference to the ESXi host hostname ...
Creates a VMFS datastore from a disk_id service_instance The Service Instance Object containing the datastore datastore_ref The reference to the datastore to remove def remove_datastore(service_instance, datastore_ref): ''' Creates a VMFS datastore from a disk_id service_instance...
Returns a list of vim.HostSystem objects representing ESXi hosts in a vcenter filtered by their names and/or datacenter, cluster membership. service_instance The Service Instance Object from which to obtain the hosts. datacenter_name The datacenter name. Default is None. host_names ...
Returns a map between the scsi addresses and the keys of all luns on an ESXi host. map[<scsi_address>] = <lun key> service_instance The Service Instance Object from which to obtain the hosts host_ref The vim.HostSystem object representing the host that contains the requeste...
Returns a list of all vim.HostScsiDisk objects in a disk host_ref The vim.HostSystem object representing the host that contains the requested disks. storage_system The host's storage system. Default is None. hostname Name of the host. This argument is optional. def get_al...
Returns a map of all vim.ScsiLun objects on a ESXi host keyed by their scsi address host_ref The vim.HostSystem object representing the host that contains the requested disks. storage_system The host's storage system. Default is None. hostname Name of the host. This ar...
Returns a list of vim.HostScsiDisk objects representing disks in a ESXi host, filtered by their cannonical names and scsi_addresses host_ref The vim.HostSystem object representing the host that contains the requested disks. disk_ids The list of canonical names of the disks to be re...
Returns all partitions on a disk host_ref The reference of the ESXi host containing the disk disk_id The canonical name of the disk whose partitions are to be removed storage_system The ESXi host's storage system. Default is None. def get_disk_partition_info(host_ref, disk_id, st...
Erases all partitions on a disk in a vcenter filtered by their names and/or datacenter, cluster membership service_instance The Service Instance Object from which to obtain all information host_ref The reference of the ESXi host containing the disk disk_id The canonical name ...
Returns a list of vim.VsanHostDiskMapping objects representing disks in a ESXi host, filtered by their cannonical names. host_ref The vim.HostSystem object representing the host that contains the requested disks. cache_disk_ids The list of cannonical names of the cache disks to be ...
Checks that the disks in a disk group are as expected and raises CheckError exceptions if the check fails def _check_disks_in_diskgroup(disk_group, cache_disk_id, capacity_disk_ids): ''' Checks that the disks in a disk group are as expected and raises CheckError exceptions if the check fails ''' ...
Returns a vim.HostScsiDisk if the host cache is configured on the specified host, other wise returns None host_ref The vim.HostSystem object representing the host that contains the requested disks. host_cache_manager The vim.HostCacheConfigurationManager object representing the cac...
Configures the host cahe of the specified host host_ref The vim.HostSystem object representing the host that contains the requested disks. datastore_ref The vim.Datastore opject representing the datastore the host cache will be configured on. swap_size_MiB The size...
Retrieves resource pool objects service_instance The service instance object to query the vCenter resource_pool_names Resource pool names datacenter_name Name of the datacenter where the resource pool is available get_all_resource_pools Boolean return Res...
Waits for a task to be completed. task The task to wait for. instance_name The name of the ESXi host, vCenter Server, or Virtual Machine that the task is being run on. task_type The type of task being performed. Useful information for debugging purposes. sleep_seconds...
Get virtual machine properties based on the traversal specs and properties list, returns Virtual Machine object with properties. service_instance Service instance object to access vCenter name Name of the virtual machine. datacenter Datacenter name vm_properties L...
Returns a Folder Object service_instance Service instance object datacenter Name of the datacenter placement Placement dictionary base_vm_name Existing virtual machine name (for cloning) def get_folder(service_instance, datacenter, placement, base_vm_name=None): ...
To create a virtual machine a resource pool needs to be supplied, we would like to use the strictest as possible. datacenter Name of the datacenter placement Dictionary with the placement info, cluster, host resource pool name return Resource pool, cluster and host object if any a...
Converts the given size to KB based on the unit, returns a long integer. unit Unit of the size eg. GB; Note: to VMware a GB is the same as GiB = 1024MiB size Number which represents the size def convert_to_kb(unit, size): ''' Converts the given size to KB based on the unit, returns a l...
Powers on/off a virtual machine specified by it's name. virtual_machine vim.VirtualMachine object to power on/off virtual machine action Operation option to power on/off the machine def power_cycle_vm(virtual_machine, action='on'): ''' Powers on/off a virtual machine specified by it's...
Creates virtual machine from config spec vm_name Virtual machine name to be created vm_config_spec Virtual Machine Config Spec object folder_object vm Folder managed object reference resourcepool_object Resource pool object where the machine will be created host_...
Registers a virtual machine to the inventory with the given vmx file, on success it returns the vim.VirtualMachine managed object reference datacenter Datacenter object of the virtual machine, vim.Datacenter object name Name of the virtual machine vmx_path: Full path to the vm...
Updates the virtual machine configuration with the given object vm_ref Virtual machine managed object reference vm_config_spec Virtual machine config spec object to update def update_vm(vm_ref, vm_config_spec): ''' Updates the virtual machine configuration with the given object v...
Destroys the virtual machine vm_ref Managed object reference of a virtual machine object def unregister_vm(vm_ref): ''' Destroys the virtual machine vm_ref Managed object reference of a virtual machine object ''' vm_name = get_managed_object_name(vm_ref) log.trace('Destroy...
Returns True if the given user cert (password is the cert contents) was issued by the CA and if cert's Common Name is equal to username. Returns False otherwise. ``username``: we need it to run the auth function from CLI/API; it should be in master config auth/acl ``password``: conte...
Returns a dict with the differences between dict1 and dict2 Notes: Keys that only exist in dict2 are not included in the diff if ignore_missing_keys is True, otherwise they are Simple compares are done on lists def _get_diffs(cls, dict1, dict2, ignore_missing_keys): ...
Returns a dictionaries with the 'new' values in a diff dict. type Which values to return, 'new' or 'old' def _get_values(cls, diff_dict, type='new'): ''' Returns a dictionaries with the 'new' values in a diff dict. type Which values to return, 'new' or 'old' ...
Returns a list of string message with the differences in a diff dict. Each inner difference is tabulated two space deeper def _get_changes(cls, diff_dict): ''' Returns a list of string message with the differences in a diff dict. Each inner difference is tabulated two space deeper ...
Returns all keys that have been added. If the keys are in child dictionaries they will be represented with . notation def added(self): ''' Returns all keys that have been added. If the keys are in child dictionaries they will be represented with . notation ''' ...
Returns all keys that have been removed. If the keys are in child dictionaries they will be represented with . notation def removed(self): ''' Returns all keys that have been removed. If the keys are in child dictionaries they will be represented with . notation ...
Returns all keys that have been changed. If the keys are in child dictionaries they will be represented with . notation def changed(self): ''' Returns all keys that have been changed. If the keys are in child dictionaries they will be represented with . notation ...
Returns all keys that have been unchanged. If the keys are in child dictionaries they will be represented with . notation def unchanged(self): ''' Returns all keys that have been unchanged. If the keys are in child dictionaries they will be represented with . notation ...
A helper function to get the object for the local machine Returns: object: Returns the computer object for the local machine def _get_computer_object(): ''' A helper function to get the object for the local machine Returns: object: Returns the computer object for the local machine ...
A helper function to get a specified group object Args: name (str): The name of the object Returns: object: The specified group object def _get_group_object(name): ''' A helper function to get a specified group object Args: name (str): The name of the object Return...
A helper function that gets a list of group objects for all groups on the machine Returns: iter: A list of objects for all groups on the machine def _get_all_groups(): ''' A helper function that gets a list of group objects for all groups on the machine Returns: iter: A list o...
Add the specified group Args: name (str): The name of the group to add Returns: bool: ``True`` if successful, otherwise ``False`` CLI Example: .. code-block:: bash salt '*' group.add foo def add(name, **kwargs): ''' Add the specified group Args: ...
Remove the named group Args: name (str): The name of the group to remove Returns: bool: ``True`` if successful, otherwise ``False`` CLI Example: .. code-block:: bash salt '*' group.delete foo def delete(name, **kwargs): ''' Remove the named group A...
Return information about a group Args: name (str): The name of the group for which to get information Returns: dict: A dictionary of information about the group CLI Example: .. code-block:: bash salt '*' group.info foo def info(name): ''' Return informa...
Return info on all groups Args: refresh (bool): Refresh the info for all groups in ``__context__``. If False only the groups in ``__context__`` will be returned. If True the ``__context__`` will be refreshed with current data and returned. Default is False ...
Add a user to a group Args: name (str): The name of the group to modify username (str): The name of the user to add to the group Returns: bool: ``True`` if successful, otherwise ``False`` CLI Example: .. code-block:: bash salt '*' group.addu...
Ensure a group contains only the members in the list Args: name (str): The name of the group to modify members_list (str): A single user or a comma separated list of users. The group will contain only the users specified in this list. Returns: bool...
Return a list of groups Args: refresh (bool): Refresh the info for all groups in ``__context__``. If False only the groups in ``__context__`` will be returned. If True, the ``__context__`` will be refreshed with current data and returned. Default is False ...
Return a function with identical signature as ``original_function``'s which will call the ``wrapped_function``. def identical_signature_wrapper(original_function, wrapped_function): ''' Return a function with identical signature as ``original_function``'s which will call the ``wrapped_function``. '...
Evaulates Open vSwitch command`s retcode value. Args: retcode: Value of retcode field from response, should be 0, 1 or 2. stdout: Value of stdout filed from response. splitstring: String used to split the stdout default new line. Returns: List or False. def _stdout_list_split(...
Converts from the JSON output provided by ovs-vsctl into a usable Python object tree. In particular, sets and maps are converted from lists to actual sets or maps. Args: obj: Object that shall be recursively converted. Returns: Converted version of object. def _convert_json(obj): ...
Lists all existing real and fake bridges. Returns: List of bridges (or empty list), False on failure. .. versionadded:: 2016.3.0 CLI Example: .. code-block:: bash salt '*' openvswitch.bridge_list def bridge_list(): ''' Lists all existing real and fake bridges. Returns: ...
Tests whether bridge exists as a real or fake bridge. Returns: True if Bridge exists, else False. .. versionadded:: 2016.3.0 CLI Example: .. code-block:: bash salt '*' openvswitch.bridge_exists br0 def bridge_exists(br): ''' Tests whether bridge exists as a real or fake br...
Creates a new bridge. Args: br: A string - bridge name may_exist: Bool, if False - attempting to create a bridge that exists returns False. parent: String, the name of the parent bridge (if the bridge shall be created as a fake bridge). If specified, vlan must also be ...
Deletes bridge and all of its ports. Args: br: A string - bridge name if_exists: Bool, if False - attempting to delete a bridge that does not exist returns False. Returns: True on success, else False. .. versionadded:: 2016.3.0 CLI Example: .. code-block:: bash ...
Returns the parent bridge of a bridge. Args: br: A string - bridge name Returns: Name of the parent bridge. This is the same as the bridge name if the bridge is not a fake bridge. If the bridge does not exist, False is returned. CLI Example: .. code-block:: bash ...
Returns the VLAN ID of a bridge. Args: br: A string - bridge name Returns: VLAN ID of the bridge. The VLAN ID is 0 if the bridge is not a fake bridge. If the bridge does not exist, False is returned. CLI Example: .. code-block:: bash salt '*' openvswitch.bridge_to_p...
Creates on bridge a new port named port. Returns: True on success, else False. Args: br: A string - bridge name port: A string - port name may_exist: Bool, if False - attempting to create a port that exists returns False. internal: A boolean to create an internal interf...
Deletes port. Args: br: A string - bridge name (If bridge is None, port is removed from whatever bridge contains it) port: A string - port name. if_exists: Bool, if False - attempting to delete a por that does not exist returns False. (Default True) Returns: True on success,...
Lists all of the ports within bridge. Args: br: A string - bridge name. Returns: List of bridges (or empty list), False on failure. .. versionadded:: 2016.3.0 CLI Example: .. code-block:: bash salt '*' openvswitch.port_list br0 def port_list(br): ''' Lists all o...
Lists tags of the port. Args: port: A string - port name. Returns: List of tags (or empty list), False on failure. .. versionadded:: 2016.3.0 CLI Example: .. code-block:: bash salt '*' openvswitch.port_get_tag tap0 def port_get_tag(port): ''' Lists tags of the p...
Isolate VM traffic using VLANs. Args: br: A string - bridge name. port: A string - port name. id: An integer in the valid range 0 to 4095 (inclusive), name of VLAN. internal: A boolean to create an internal interface if one does not exist. Returns: True on success, else...
Generic Routing Encapsulation - creates GRE tunnel between endpoints. Args: br: A string - bridge name. port: A string - port name. id: An integer - unsigned 32-bit number, tunnel's key. remote: A string - remote endpoint's IP address. Returns: True on success, else Fal...
Virtual eXtensible Local Area Network - creates VXLAN tunnel between endpoints. Args: br: A string - bridge name. port: A string - port name. id: An integer - unsigned 64-bit number, tunnel's key. remote: A string - remote endpoint's IP address. dst_port: An integer - port t...
Gets a column's value for a specific record. Args: table: A string - name of the database table. record: A string - identifier of the record. column: A string - name of the column. if_exists: A boolean - if True, it is not an error if the record does not exist. Retu...
Sets a column's value for a specific record. Args: table: A string - name of the database table. record: A string - identifier of the record. column: A string - name of the column. value: A string - the value to be set if_exists: A boolean - if True, it is not an error if th...
.. versionadded:: 2019.2.0 Ensure a virtual network exists. :param name: Name of the virtual network. :param resource_group: The resource group assigned to the virtual network. :param address_prefixes: A list of CIDR blocks which can be used by subnets within the virtual netw...
.. versionadded:: 2019.2.0 Ensure a virtual network does not exist in the resource group. :param name: Name of the virtual network. :param resource_group: The resource group assigned to the virtual network. :param connection_auth: A dict with subscription and authentication p...
.. versionadded:: 2019.2.0 Ensure a subnet exists. :param name: Name of the subnet. :param address_prefix: A CIDR block used by the subnet within the virtual network. :param virtual_network: Name of the existing virtual network to contain the subnet. :param resource_grou...
.. versionadded:: 2019.2.0 Ensure a virtual network does not exist in the virtual network. :param name: Name of the subnet. :param virtual_network: Name of the existing virtual network containing the subnet. :param resource_group: The resource group assigned to the virtual ne...
.. versionadded:: 2019.2.0 Ensure a network security group exists. :param name: Name of the network security group. :param resource_group: The resource group assigned to the network security group. :param tags: A dictionary of strings can be passed as tag metadata to the netw...
.. versionadded:: 2019.2.0 Ensure a network security group does not exist in the resource group. :param name: Name of the network security group. :param resource_group: The resource group assigned to the network security group. :param connection_auth: A dict with subscription...
.. versionadded:: 2019.2.0 Ensure a security rule exists. :param name: Name of the security rule. :param access: 'allow' or 'deny' :param direction: 'inbound' or 'outbound' :param priority: Integer between 100 and 4096 used for ordering rule application. :pa...