INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
Allocate a floating IP | def floating_ip_create(kwargs, call=None):
'''
Allocate a floating IP
.. versionadded:: 2016.3.0
'''
if call != 'function':
raise SaltCloudSystemExit(
'The floating_ip_create action must be called with -f or --function'
)
if 'pool' not in kwargs:
log.error('... |
Associate a floating IP address to a server | def floating_ip_associate(name, kwargs, call=None):
'''
Associate a floating IP address to a server
.. versionadded:: 2016.3.0
'''
if call != 'action':
raise SaltCloudSystemExit(
'The floating_ip_associate action must be called with -a of --action.'
)
if 'floating_i... |
Create a single VM from a data dict | def create(vm_):
'''
Create a single VM from a data dict
'''
try:
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'gog... |
List of nodes keeping only a brief listing | def list_nodes(full=False, call=None):
'''
List of nodes, keeping only a brief listing
CLI Example:
.. code-block:: bash
salt-cloud -Q
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes function must be called with -f or --function.'
)
... |
List nodes with all available information | def list_nodes_full(call=None):
'''
List nodes, with all available information
CLI Example:
.. code-block:: bash
salt-cloud -F
'''
response = _query('grid', 'server/list')
ret = {}
for item in response['list']:
name = item['name']
ret[name] = item
ret... |
Available locations | def avail_locations():
'''
Available locations
'''
response = list_common_lookups(kwargs={'lookup': 'ip.datacenter'})
ret = {}
for item in response['list']:
name = item['name']
ret[name] = item
return ret |
Available sizes | def avail_sizes():
'''
Available sizes
'''
response = list_common_lookups(kwargs={'lookup': 'server.ram'})
ret = {}
for item in response['list']:
name = item['name']
ret[name] = item
return ret |
Available images | def avail_images():
'''
Available images
'''
response = _query('grid', 'image/list')
ret = {}
for item in response['list']:
name = item['friendlyName']
ret[name] = item
return ret |
List all password on the account | def list_passwords(kwargs=None, call=None):
'''
List all password on the account
.. versionadded:: 2015.8.0
'''
response = _query('support', 'password/list')
ret = {}
for item in response['list']:
if 'server' in item:
server = item['server']['name']
if serve... |
List all available public IPs. | def list_public_ips(kwargs=None, call=None):
'''
List all available public IPs.
CLI Example:
.. code-block:: bash
salt-cloud -f list_public_ips <provider>
To list unavailable (assigned) IPs, use:
CLI Example:
.. code-block:: bash
salt-cloud -f list_public_ips <provider> ... |
List common lookups for a particular type of item | def list_common_lookups(kwargs=None, call=None):
'''
List common lookups for a particular type of item
.. versionadded:: 2015.8.0
'''
if kwargs is None:
kwargs = {}
args = {}
if 'lookup' in kwargs:
args['lookup'] = kwargs['lookup']
response = _query('common', 'lookup/l... |
Destroy a machine by name | def destroy(name, call=None):
'''
Destroy a machine by name
CLI Example:
.. code-block:: bash
salt-cloud -d vm_name
'''
if call == 'function':
raise SaltCloudSystemExit(
'The destroy action must be called with -d, --destroy, '
'-a or --action.'
... |
Start a machine by name | def show_instance(name, call=None):
'''
Start a machine by name
CLI Example:
.. code-block:: bash
salt-cloud -a show_instance vm_name
.. versionadded:: 2015.8.0
'''
response = _query('grid', 'server/get', args={'name': name})
ret = {}
for item in response['list']:
... |
Make a web call to GoGrid | def _query(action=None,
command=None,
args=None,
method='GET',
header_dict=None,
data=None):
'''
Make a web call to GoGrid
.. versionadded:: 2015.8.0
'''
vm_ = get_configured_provider()
apikey = config.get_cloud_config_value(
'apike... |
split the hive from the key | def _parse_key(key):
'''
split the hive from the key
'''
splt = key.split("\\")
hive = splt.pop(0)
key = '\\'.join(splt)
return hive, key |
r Ensure a registry key or value is present. | def present(name,
vname=None,
vdata=None,
vtype='REG_SZ',
use_32bit_registry=False,
win_owner=None,
win_perms=None,
win_deny_perms=None,
win_inheritance=True,
win_perms_reset=False):
r'''
Ensure a registr... |
r Ensure a registry value is removed. To remove a key use key_absent. | def absent(name, vname=None, use_32bit_registry=False):
r'''
Ensure a registry value is removed. To remove a key use key_absent.
Args:
name (str):
A string value representing the full path of the key to include the
HIVE, Key, and all Subkeys. For example:
``HKEY... |
r.. versionadded:: 2015. 5. 4 | def key_absent(name, use_32bit_registry=False):
r'''
.. versionadded:: 2015.5.4
Ensure a registry key is removed. This will remove the key, subkeys, and all
value entries.
Args:
name (str):
A string representing the full path to the key to be removed to
include the... |
Return salt - call source based on configuration. This will include additional namespaces for another versions of Salt if needed ( e. g. older interpreters etc ). | def _get_salt_call(*dirs, **namespaces):
'''
Return salt-call source, based on configuration.
This will include additional namespaces for another versions of Salt,
if needed (e.g. older interpreters etc).
:dirs: List of directories to include in the system path
:namespaces: Dictionary of namesp... |
Add a dependency to the top list. | def _add_dependency(container, obj):
'''
Add a dependency to the top list.
:param obj:
:param is_file:
:return:
'''
if os.path.basename(obj.__file__).split('.')[0] == '__init__':
container.append(os.path.dirname(obj.__file__))
else:
container.append(obj.__file__.replace(... |
This function is called externally from the alternative Python interpreter from within _get_tops function. | def gte():
'''
This function is called externally from the alternative
Python interpreter from within _get_tops function.
:param extra_mods:
:param so_mods:
:return:
'''
extra = salt.utils.json.loads(sys.argv[1])
tops = get_tops(**extra)
return salt.utils.json.dumps(tops, ensur... |
Get top directories for the dependencies based on external configuration. | def get_ext_tops(config):
'''
Get top directories for the dependencies, based on external configuration.
:return:
'''
config = copy.deepcopy(config)
alternatives = {}
required = ['jinja2', 'yaml', 'tornado', 'msgpack']
tops = []
for ns, cfg in salt.ext.six.iteritems(config or {}):
... |
Get namespaces from the existing configuration. | def _get_ext_namespaces(config):
'''
Get namespaces from the existing configuration.
:param config:
:return:
'''
namespaces = {}
if not config:
return namespaces
for ns in config:
constraint_version = tuple(config[ns].get('py-version', []))
if not constraint_ver... |
Get top directories for the dependencies based on Python interpreter. | def get_tops(extra_mods='', so_mods=''):
'''
Get top directories for the dependencies, based on Python interpreter.
:param extra_mods:
:param so_mods:
:return:
'''
tops = []
for mod in [salt, jinja2, yaml, tornado, msgpack, certifi, singledispatch, concurrent,
singledisp... |
Based on the Salt SSH configuration create a YAML configuration for the supported Python interpreter versions. This is then written into the thin. tgz archive and then verified by salt. client. ssh. ssh_py_shim. get_executable () | def _get_supported_py_config(tops, extended_cfg):
'''
Based on the Salt SSH configuration, create a YAML configuration
for the supported Python interpreter versions. This is then written into the thin.tgz
archive and then verified by salt.client.ssh.ssh_py_shim.get_executable()
Note: Minimum defaul... |
Make sure thintar temporary name is concurrent and secure. | def _get_thintar_prefix(tarname):
'''
Make sure thintar temporary name is concurrent and secure.
:param tarname: name of the chosen tarball
:return: prefixed tarname
'''
tfd, tmp_tarname = tempfile.mkstemp(dir=os.path.dirname(tarname), prefix=".thin-",
su... |
Generate the salt - thin tarball and print the location of the tarball Optional additional mods to include ( e. g. mako ) can be supplied as a comma delimited string. Permits forcing an overwrite of the output file as well. | def gen_thin(cachedir, extra_mods='', overwrite=False, so_mods='',
python2_bin='python2', python3_bin='python3', absonly=True,
compress='gzip', extended_cfg=None):
'''
Generate the salt-thin tarball and print the location of the tarball
Optional additional mods to include (e.g. mak... |
Return the checksum of the current thin tarball | def thin_sum(cachedir, form='sha1'):
'''
Return the checksum of the current thin tarball
'''
thintar = gen_thin(cachedir)
code_checksum_path = os.path.join(cachedir, 'thin', 'code-checksum')
if os.path.isfile(code_checksum_path):
with salt.utils.files.fopen(code_checksum_path, 'r') as fh... |
Generate the salt - min tarball and print the location of the tarball Optional additional mods to include ( e. g. mako ) can be supplied as a comma delimited string. Permits forcing an overwrite of the output file as well. | def gen_min(cachedir, extra_mods='', overwrite=False, so_mods='',
python2_bin='python2', python3_bin='python3'):
'''
Generate the salt-min tarball and print the location of the tarball
Optional additional mods to include (e.g. mako) can be supplied as a comma
delimited string. Permits forci... |
Return the checksum of the current thin tarball | def min_sum(cachedir, form='sha1'):
'''
Return the checksum of the current thin tarball
'''
mintar = gen_min(cachedir)
return salt.utils.hashutils.get_hash(mintar, form) |
Updates the remote repos database. | def refresh_db(full=False, **kwargs):
'''
Updates the remote repos database.
full : False
Set to ``True`` to force a refresh of the pkg DB from all publishers,
regardless of the last refresh time.
CLI Example:
.. code-block:: bash
salt '*' pkg.refresh_db
salt '*'... |
Check if there is an upgrade available for a certain package Accepts full or partial FMRI. Returns all matches found. | def upgrade_available(name, **kwargs):
'''
Check if there is an upgrade available for a certain package
Accepts full or partial FMRI. Returns all matches found.
CLI Example:
.. code-block:: bash
salt '*' pkg.upgrade_available apache-22
'''
version = None
cmd = ['pkg', 'list', ... |
Lists all packages available for update. | def list_upgrades(refresh=True, **kwargs): # pylint: disable=W0613
'''
Lists all packages available for update.
When run in global zone, it reports only upgradable packages for the global
zone.
When run in non-global zone, it can report more upgradable packages than
``pkg update -vn``, becaus... |
Upgrade all packages to the latest possible version. When run in global zone it updates also all non - global zones. In non - global zones upgrade is limited by dependency constrains linked to the version of pkg:// solaris/ entire. | def upgrade(refresh=False, **kwargs):
'''
Upgrade all packages to the latest possible version.
When run in global zone, it updates also all non-global zones.
In non-global zones upgrade is limited by dependency constrains linked to
the version of pkg://solaris/entire.
Returns a dictionary conta... |
List the currently installed packages as a dict:: | def list_pkgs(versions_as_list=False, **kwargs):
'''
List the currently installed packages as a dict::
{'<package_name>': '<version>'}
CLI Example:
.. code-block:: bash
salt '*' pkg.list_pkgs
'''
# not yet implemented or not applicable
if any([salt.utils.data.is_true(kwar... |
Common interface for obtaining the version of installed packages. Accepts full or partial FMRI. If called using pkg_resource full FMRI is required. Partial FMRI is returned if the package is not installed. | def version(*names, **kwargs):
'''
Common interface for obtaining the version of installed packages.
Accepts full or partial FMRI. If called using pkg_resource, full FMRI is required.
Partial FMRI is returned if the package is not installed.
CLI Example:
.. code-block:: bash
salt '*' ... |
Returns FMRI from partial name. Returns empty string ( ) if not found. In case of multiple match the function returns list of all matched packages. | def get_fmri(name, **kwargs):
'''
Returns FMRI from partial name. Returns empty string ('') if not found.
In case of multiple match, the function returns list of all matched packages.
CLI Example:
.. code-block:: bash
salt '*' pkg.get_fmri bash
'''
if name.startswith('pkg://'):
... |
Internal function. Normalizes pkg name to full FMRI before running pkg. install. In case of multiple matches or no match it returns the name without modifications. | def normalize_name(name, **kwargs):
'''
Internal function. Normalizes pkg name to full FMRI before running
pkg.install. In case of multiple matches or no match, it returns the name
without modifications.
CLI Example:
.. code-block:: bash
salt '*' pkg.normalize_name vim
'''
if ... |
Searches the repository for given pkg name. The name can be full or partial FMRI. All matches are printed. Globs are also supported. | def search(name, versions_as_list=False, **kwargs):
'''
Searches the repository for given pkg name.
The name can be full or partial FMRI. All matches are printed. Globs are
also supported.
CLI Example:
.. code-block:: bash
salt '*' pkg.search bash
'''
ret = {}
cmd = ['/bi... |
Install the named package using the IPS pkg command. Accepts full or partial FMRI. | def install(name=None, refresh=False, pkgs=None, version=None, test=False, **kwargs):
'''
Install the named package using the IPS pkg command.
Accepts full or partial FMRI.
Returns a dict containing the new package names and versions::
{'<package>': {'old': '<old-version>',
... |
Remove specified package. Accepts full or partial FMRI. In case of multiple match the command fails and won t modify the OS. | def remove(name=None, pkgs=None, **kwargs):
'''
Remove specified package. Accepts full or partial FMRI.
In case of multiple match, the command fails and won't modify the OS.
name
The name of the package to be deleted.
Multiple Package Options:
pkgs
A list of packages to delet... |
Execute a command and read the output as JSON | def ext_pillar(minion_id, # pylint: disable=W0613
pillar, # pylint: disable=W0613
command):
'''
Execute a command and read the output as JSON
'''
try:
command = command.replace('%s', minion_id)
return salt.utils.json.loads(__salt__['cmd.run'](command))
... |
Add unofficial GitHub repos to the list of formulas that brew tracks updates and installs from. | def _tap(tap, runas=None):
'''
Add unofficial GitHub repos to the list of formulas that brew tracks,
updates, and installs from.
'''
if tap in _list_taps():
return True
cmd = 'tap {0}'.format(tap)
try:
_call_brew(cmd)
except CommandExecutionError:
log.error('Fail... |
Calls the brew command with the user account of brew | def _call_brew(cmd, failhard=True):
'''
Calls the brew command with the user account of brew
'''
user = __salt__['file.get_user'](_homebrew_bin())
runas = user if user != __opts__['user'] else None
cmd = '{} {}'.format(salt.utils.path.which('brew'), cmd)
result = __salt__['cmd.run_all'](cmd,... |
List the packages currently installed in a dict:: | def list_pkgs(versions_as_list=False, **kwargs):
'''
List the packages currently installed in a dict::
{'<package_name>': '<version>'}
CLI Example:
.. code-block:: bash
salt '*' pkg.list_pkgs
'''
versions_as_list = salt.utils.data.is_true(versions_as_list)
# not yet imple... |
Removes packages with brew uninstall. | def remove(name=None, pkgs=None, **kwargs):
'''
Removes packages with ``brew uninstall``.
name
The name of the package to be deleted.
Multiple Package Options:
pkgs
A list of packages to delete. Must be passed as a python list. The
``name`` parameter will be ignored if th... |
Update the homebrew package repository. | def refresh_db(**kwargs):
'''
Update the homebrew package repository.
CLI Example:
.. code-block:: bash
salt '*' pkg.refresh_db
'''
# Remove rtag file to keep multiple refreshes from happening in pkg states
salt.utils.pkg.clear_rtag(__opts__)
cmd = 'update'
if _call_brew(c... |
Get all info brew can provide about a list of packages. | def _info(*pkgs):
'''
Get all info brew can provide about a list of packages.
Does not do any kind of processing, so the format depends entirely on
the output brew gives. This may change if a new version of the format is
requested.
On failure, returns an empty dict and logs failure.
On suc... |
Install the passed package ( s ) with brew install | def install(name=None, pkgs=None, taps=None, options=None, **kwargs):
'''
Install the passed package(s) with ``brew install``
name
The name of the formula to be installed. Note that this parameter is
ignored if "pkgs" is passed.
CLI Example:
.. code-block:: bash
... |
Check whether or not an upgrade is available for all packages | def list_upgrades(refresh=True, **kwargs): # pylint: disable=W0613
'''
Check whether or not an upgrade is available for all packages
CLI Example:
.. code-block:: bash
salt '*' pkg.list_upgrades
'''
if refresh:
refresh_db()
res = _call_brew('outdated --json=v1')
ret =... |
Upgrade outdated unpinned brews. | def upgrade(refresh=True, **kwargs):
'''
Upgrade outdated, unpinned brews.
refresh
Fetch the newest version of Homebrew and all formulae from GitHub before installing.
Returns a dictionary containing the changes:
.. code-block:: python
{'<package>': {'old': '<old-version>',
... |
Ensure that the chronos job with the given name is present and is configured to match the given config values. | def config(name, config):
'''
Ensure that the chronos job with the given name is present and is configured
to match the given config values.
:param name: The job name
:param config: The configuration to apply (dict)
:return: A standard Salt changes dictionary
'''
# setup return structur... |
Ensure range record is present. | def present(name=None, start_addr=None, end_addr=None, data=None, **api_opts):
'''
Ensure range record is present.
infoblox_range.present:
start_addr: '129.97.150.160',
end_addr: '129.97.150.170',
Verbose state example:
.. code-block:: yaml
infoblox_range.present:
... |
Ensure the range is removed | def absent(name=None, start_addr=None, end_addr=None, data=None, **api_opts):
'''
Ensure the range is removed
Supplying the end of the range is optional.
State example:
.. code-block:: yaml
infoblox_range.absent:
- name: 'vlan10'
infoblox_range.absent:
- ... |
Send this command to the server and return a tuple of the output and the stderr. | def sendline(self, cmd):
'''
Send this command to the server and
return a tuple of the output and the stderr.
The format for parameters is:
cmd (string): The command to send to the sever.
'''
self.conn.sendline(cmd, self.linesep)
# saw_prompt = False
... |
Shell out and call the specified esxcli commmand parse the result and return something sane. | def esxcli(host, user, pwd, cmd, protocol=None, port=None, esxi_host=None, credstore=None):
'''
Shell out and call the specified esxcli commmand, parse the result
and return something sane.
:param host: ESXi or vCenter host to connect to
:param user: User to connect as, usually root
:param pwd:... |
Internal method to authenticate with a vCenter server or ESX/ ESXi host and return the service instance object. | def _get_service_instance(host, username, password, protocol,
port, mechanism, principal, domain):
'''
Internal method to authenticate with a vCenter server or ESX/ESXi host
and return the service instance object.
'''
log.trace('Retrieving new service instance')
token =... |
Get a reference to a VMware customization spec for the purposes of customizing a clone | def get_customizationspec_ref(si, customization_spec_name):
'''
Get a reference to a VMware customization spec for the purposes of customizing a clone
si
ServiceInstance for the vSphere or ESXi server (see get_service_instance)
customization_spec_name
Name of the customization spec
... |
Authenticate with a vCenter server or ESX/ ESXi host and return the service instance object. | def get_service_instance(host, username=None, password=None, protocol=None,
port=None, mechanism='userpass', principal=None,
domain=None):
'''
Authenticate with a vCenter server or ESX/ESXi host and return the service instance object.
host
The locat... |
Returns a stub that points to a different path created from an existing connection. | def get_new_service_instance_stub(service_instance, path, ns=None,
version=None):
'''
Returns a stub that points to a different path,
created from an existing connection.
service_instance
The Service Instance.
path
Path of the new stub.
ns
... |
Retrieves the service instance from a managed object. | def get_service_instance_from_managed_object(mo_ref, name='<unnamed>'):
'''
Retrieves the service instance from a managed object.
me_ref
Reference to a managed object (of type vim.ManagedEntity).
name
Name of managed object. This field is optional.
'''
if not name:
name... |
Function that disconnects from the vCenter server or ESXi host | def disconnect(service_instance):
'''
Function that disconnects from the vCenter server or ESXi host
service_instance
The Service Instance from which to obtain managed object references.
'''
log.trace('Disconnecting')
try:
Disconnect(service_instance)
except vim.fault.NoPerm... |
Function that returns True if the connection is made to a vCenter Server and False if the connection is made to an ESXi host | def is_connection_to_a_vcenter(service_instance):
'''
Function that returns True if the connection is made to a vCenter Server and
False if the connection is made to an ESXi host
service_instance
The Service Instance from which to obtain managed object references.
'''
try:
api_t... |
Returns information of the vCenter or ESXi host | def get_service_info(service_instance):
'''
Returns information of the vCenter or ESXi host
service_instance
The Service Instance from which to obtain managed object references.
'''
try:
return service_instance.content.about
except vim.fault.NoPermission as exc:
log.exce... |
Return a reference to a Distributed Virtual Switch object. | def _get_dvs(service_instance, dvs_name):
'''
Return a reference to a Distributed Virtual Switch object.
:param service_instance: PyVmomi service instance
:param dvs_name: Name of DVS to return
:return: A PyVmomi DVS object
'''
switches = list_dvs(service_instance)
if dvs_name in switch... |
Return a portgroup object corresponding to the portgroup name on the dvs | def _get_dvs_portgroup(dvs, portgroup_name):
'''
Return a portgroup object corresponding to the portgroup name on the dvs
:param dvs: DVS object
:param portgroup_name: Name of portgroup to return
:return: Portgroup object
'''
for portgroup in dvs.portgroup:
if portgroup.name == port... |
Return a portgroup object corresponding to the portgroup name on the dvs | def _get_dvs_uplink_portgroup(dvs, portgroup_name):
'''
Return a portgroup object corresponding to the portgroup name on the dvs
:param dvs: DVS object
:param portgroup_name: Name of portgroup to return
:return: Portgroup object
'''
for portgroup in dvs.portgroup:
if portgroup.name ... |
Get the gssapi token for Kerberos connection | def get_gssapi_token(principal, host, domain):
'''
Get the gssapi token for Kerberos connection
principal
The service principal
host
Host url where we would like to authenticate
domain
Kerberos user domain
'''
if not HAS_GSSAPI:
raise ImportError('The gssapi li... |
Return hardware info for standard minion grains if the service_instance is a HostAgent type | def get_hardware_grains(service_instance):
'''
Return hardware info for standard minion grains if the service_instance is a HostAgent type
service_instance
The service instance object to get hardware info for
.. versionadded:: 2016.11.0
'''
hw_grain_data = {}
if get_inventory(servi... |
Returns the root folder of a vCenter. | def get_root_folder(service_instance):
'''
Returns the root folder of a vCenter.
service_instance
The Service Instance Object for which to obtain the root folder.
'''
try:
log.trace('Retrieving root folder')
return service_instance.RetrieveContent().rootFolder
except vim... |
Returns the content of the specified type of object for a Service Instance. | def get_content(service_instance, obj_type, property_list=None,
container_ref=None, traversal_spec=None,
local_properties=False):
'''
Returns the content of the specified type of object for a Service Instance.
For more information, please see:
http://pubs.vmware.com/vsph... |
Returns the first managed object reference having the specified property value. | def get_mor_by_property(service_instance, object_type, property_value, property_name='name', container_ref=None):
'''
Returns the first managed object reference having the specified property value.
service_instance
The Service Instance from which to obtain managed object references.
object_typ... |
Returns a list containing properties and managed object references for the managed object. | def get_mors_with_properties(service_instance, object_type, property_list=None,
container_ref=None, traversal_spec=None,
local_properties=False):
'''
Returns a list containing properties and managed object references for the managed object.
service_... |
Returns specific properties of a managed object retrieved in an optimally. | def get_properties_of_managed_object(mo_ref, properties):
'''
Returns specific properties of a managed object, retrieved in an
optimally.
mo_ref
The managed object reference.
properties
List of properties of the managed object to retrieve.
'''
service_instance = get_service... |
Return the network adapter type. | def get_network_adapter_type(adapter_type):
'''
Return the network adapter type.
adpater_type
The adapter type from which to obtain the network adapter type.
'''
if adapter_type == 'vmxnet':
return vim.vm.device.VirtualVmxnet()
elif adapter_type == 'vmxnet2':
return vim.... |
Returns the network adapter type. | def get_network_adapter_object_type(adapter_object):
'''
Returns the network adapter type.
adapter_object
The adapter object from which to obtain the network adapter type.
'''
if isinstance(adapter_object, vim.vm.device.VirtualVmxnet2):
return 'vmxnet2'
if isinstance(adapter_obj... |
Returns distributed virtual switches ( DVSs ) in a datacenter. | def get_dvss(dc_ref, dvs_names=None, get_all_dvss=False):
'''
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. De... |
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_object(dc_ref)
traversal_spec = vmodl.query... |
Creates a distributed virtual switches ( DVS ) in a datacenter. Returns the reference to the newly created distributed virtual switch. | def create_dvs(dc_ref, dvs_name, dvs_create_spec=None):
'''
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_... |
Updates a distributed virtual switch with the config_spec. | def update_dvs(dvs_ref, dvs_config_spec):
'''
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.
'''
dvs_name = get_managed_object_name(dvs_ref... |
Sets whether NIOC is enabled on a DVS. | def set_dvs_network_resource_management_enabled(dvs_ref, enabled):
'''
Sets whether NIOC is enabled on a DVS.
dvs_ref
The DVS reference.
enabled
Flag specifying whether NIOC is enabled.
'''
dvs_name = get_managed_object_name(dvs_ref)
log.trace('Setting network resource mana... |
Returns distributed virtual porgroups ( dvportgroups ). The parent object can be either a datacenter or a dvs. | def get_dvportgroups(parent_ref, portgroup_names=None,
get_all_portgroups=False):
'''
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.
... |
Returns the uplink distributed virtual portgroup of a distributed virtual switch ( dvs ) | def get_uplink_dvportgroup(dvs_ref):
'''
Returns the uplink distributed virtual portgroup of a distributed virtual
switch (dvs)
dvs_ref
The dvs reference
'''
dvs_name = get_managed_object_name(dvs_ref)
log.trace('Retrieving uplink portgroup of dvs \'%s\'', dvs_name)
traversal_sp... |
Creates a distributed virtual portgroup on a distributed virtual switch ( dvs ) | def create_dvportgroup(dvs_ref, spec):
'''
Creates a distributed virtual portgroup on a distributed virtual switch
(dvs)
dvs_ref
The dvs reference
spec
Portgroup spec (vim.DVPortgroupConfigSpec)
'''
dvs_name = get_managed_object_name(dvs_ref)
log.trace('Adding portgroup... |
Updates a distributed virtual portgroup | def update_dvportgroup(portgroup_ref, spec):
'''
Updates a distributed virtual portgroup
portgroup_ref
The portgroup reference
spec
Portgroup spec (vim.DVPortgroupConfigSpec)
'''
pg_name = get_managed_object_name(portgroup_ref)
log.trace('Updating portgrouo %s', pg_name)
... |
Returns networks of standard switches. The parent object can be a datacenter. | def get_networks(parent_ref, network_names=None, get_all_networks=False):
'''
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 i... |
Returns a simple list of objects from a given service instance. | def list_objects(service_instance, vim_object, properties=None):
'''
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.
proper... |
Returns 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.
'''
log.debug('Retrieving license manager')
try:
lic_manager = service_instance.content.licenseManager
except v... |
Returns the license assignment manager. | def get_license_assignment_manager(service_instance):
'''
Returns the license assignment manager.
service_instance
The Service Instance Object from which to obrain the license manager.
'''
log.debug('Retrieving license assignment manager')
try:
lic_assignment_manager = \
... |
Returns the licenses on a specific instance. | def get_licenses(service_instance, license_manager=None):
'''
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... |
Adds a license. | def add_license(service_instance, key, description, license_manager=None):
'''
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 Manag... |
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. | def get_assigned_licenses(service_instance, entity_ref=None, entity_name=None,
license_assignment_manager=None):
'''
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 nam... |
Assigns a license to an entity. | def assign_license(service_instance, license_key, license_name,
entity_ref=None, entity_name=None,
license_assignment_manager=None):
'''
Assigns a license to an entity.
service_instance
The Service Instance Object from which to obrain the licenses.
license... |
Returns all datacenters in a vCenter. | def get_datacenters(service_instance, datacenter_names=None,
get_all_datacenters=False):
'''
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. Defa... |
Returns a vim. Datacenter managed object. | def get_datacenter(service_instance, datacenter_name):
'''
Returns a vim.Datacenter managed object.
service_instance
The Service Instance Object from which to obtain datacenter.
datacenter_name
The datacenter name
'''
items = get_datacenters(service_instance,
... |
Creates a datacenter. | def create_datacenter(service_instance, datacenter_name):
'''
Creates a datacenter.
.. versionadded:: 2017.7.0
service_instance
The Service Instance Object
datacenter_name
The datacenter name
'''
root_folder = get_root_folder(service_instance)
log.trace('Creating datac... |
Returns a cluster in a datacenter. | def get_cluster(dc_ref, cluster):
'''
Returns a cluster in a datacenter.
dc_ref
The datacenter reference
cluster
The cluster to be retrieved
'''
dc_name = get_managed_object_name(dc_ref)
log.trace('Retrieving cluster \'%s\' from datacenter \'%s\'',
cluster, dc... |
Creates a cluster in a datacenter. | def create_cluster(dc_ref, cluster_name, cluster_spec):
'''
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.
'''
dc_name = ge... |
Updates a cluster in a datacenter. | def update_cluster(cluster_ref, cluster_spec):
'''
Updates a cluster in a datacenter.
cluster_ref
The cluster reference.
cluster_spec
The cluster spec (vim.ClusterConfigSpecEx).
Defaults to None.
'''
cluster_name = get_managed_object_name(cluster_ref)
log.trace('Upd... |
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 | def list_datastores_full(service_instance):
'''
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 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.