repository_name
stringclasses
316 values
func_path_in_repository
stringlengths
6
223
func_name
stringlengths
1
134
language
stringclasses
1 value
func_code_string
stringlengths
57
65.5k
func_documentation_string
stringlengths
1
46.3k
split_name
stringclasses
1 value
func_code_url
stringlengths
91
315
called_functions
listlengths
1
156
enclosing_scope
stringlengths
2
1.48M
saltstack/salt
salt/modules/virt.py
setvcpus
python
def setvcpus(vm_, vcpus, config=False, **kwargs): ''' Changes the amount of vcpus allocated to VM. The VM must be shutdown for this to work. If config is True then we ask libvirt to modify the config as well :param vm_: name of the domain :param vcpus: integer representing the number of CPUs t...
Changes the amount of vcpus allocated to VM. The VM must be shutdown for this to work. If config is True then we ask libvirt to modify the config as well :param vm_: name of the domain :param vcpus: integer representing the number of CPUs to be assigned :param config: if True then libvirt will be ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2476-L2519
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
_freemem
python
def _freemem(conn): ''' Internal variant of freemem taking a libvirt connection as parameter ''' mem = conn.getInfo()[1] # Take off just enough to sustain the hypervisor mem -= 256 for dom in _get_domain(conn, iterable=True): if dom.ID() > 0: mem -= dom.info()[2] / 1024 ...
Internal variant of freemem taking a libvirt connection as parameter
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2522-L2532
[ "def _get_domain(conn, *vms, **kwargs):\n '''\n Return a domain object for the named VM or return domain object for all VMs.\n\n :params conn: libvirt connection object\n :param vms: list of domain names to look for\n :param iterable: True to return an array in all cases\n '''\n ret = list()\n ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
freemem
python
def freemem(**kwargs): ''' Return an int representing the amount of memory (in MB) that has not been given to virtual machines on this node :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaul...
Return an int representing the amount of memory (in MB) that has not been given to virtual machines on this node :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019....
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2535-L2559
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
_freecpu
python
def _freecpu(conn): ''' Internal variant of freecpu taking a libvirt connection as parameter ''' cpus = conn.getInfo()[2] for dom in _get_domain(conn, iterable=True): if dom.ID() > 0: cpus -= dom.info()[3] return cpus
Internal variant of freecpu taking a libvirt connection as parameter
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2562-L2570
[ "def _get_domain(conn, *vms, **kwargs):\n '''\n Return a domain object for the named VM or return domain object for all VMs.\n\n :params conn: libvirt connection object\n :param vms: list of domain names to look for\n :param iterable: True to return an array in all cases\n '''\n ret = list()\n ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
freecpu
python
def freecpu(**kwargs): ''' Return an int representing the number of unallocated cpus on this hypervisor :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019.2...
Return an int representing the number of unallocated cpus on this hypervisor :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019.2.0 :param password: password to...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2573-L2597
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
full_info
python
def full_info(**kwargs): ''' Return the node_info, vm_info and freemem :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019.2.0 :param password: password to c...
Return the node_info, vm_info and freemem :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019.2.0 :param password: password to connect with, overriding defaults ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2600-L2626
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
get_xml
python
def get_xml(vm_, **kwargs): ''' Returns the XML for a given vm :param vm_: domain name :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019.2.0 :param pas...
Returns the XML for a given vm :param vm_: domain name :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019.2.0 :param password: password to connect with, overrid...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2629-L2653
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
get_profiles
python
def get_profiles(hypervisor=None, **kwargs): ''' Return the virt profiles for hypervisor. Currently there are profiles for: - nic - disk :param hypervisor: override the default machine type. :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0...
Return the virt profiles for hypervisor. Currently there are profiles for: - nic - disk :param hypervisor: override the default machine type. :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overridin...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2656-L2711
[ "def warn_until(version,\n message,\n category=DeprecationWarning,\n stacklevel=None,\n _version_info_=None,\n _dont_call_warnings=False):\n '''\n Helper function to raise a warning, by default, a ``DeprecationWarning``,\n until the prov...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
pause
python
def pause(vm_, **kwargs): ''' Pause the named vm :param vm_: domain name :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019.2.0 :param password: passwor...
Pause the named vm :param vm_: domain name :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019.2.0 :param password: password to connect with, overriding defaults...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2742-L2767
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
start
python
def start(name, **kwargs): ''' Start a defined domain :param vm_: domain name :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019.2.0 :param password: pa...
Start a defined domain :param vm_: domain name :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019.2.0 :param password: password to connect with, overriding defa...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2798-L2822
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
stop
python
def stop(name, **kwargs): ''' Hard power down the virtual machine, this is equivalent to pulling the power. :param vm_: domain name :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults ...
Hard power down the virtual machine, this is equivalent to pulling the power. :param vm_: domain name :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019.2.0 :pa...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2825-L2849
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
reboot
python
def reboot(name, **kwargs): ''' Reboot a domain via ACPI request :param vm_: domain name :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019.2.0 :param p...
Reboot a domain via ACPI request :param vm_: domain name :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019.2.0 :param password: password to connect with, overr...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2852-L2876
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
reset
python
def reset(vm_, **kwargs): ''' Reset a VM by emulating the reset button on a physical machine :param vm_: domain name :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versiona...
Reset a VM by emulating the reset button on a physical machine :param vm_: domain name :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019.2.0 :param password: p...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2879-L2908
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
ctrl_alt_del
python
def ctrl_alt_del(vm_, **kwargs): ''' Sends CTRL+ALT+DEL to a VM :param vm_: domain name :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019.2.0 :param pa...
Sends CTRL+ALT+DEL to a VM :param vm_: domain name :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019.2.0 :param password: password to connect with, overriding ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2911-L2936
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
create_xml_str
python
def create_xml_str(xml, **kwargs): # pylint: disable=redefined-outer-name ''' Start a transient domain based on the XML passed to the function :param xml: libvirt XML definition of the domain :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param ...
Start a transient domain based on the XML passed to the function :param xml: libvirt XML definition of the domain :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2939-L2963
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
create_xml_path
python
def create_xml_path(path, **kwargs): ''' Start a transient domain based on the XML-file path passed to the function :param path: path to a file containing the libvirt XML definition of the domain :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :par...
Start a transient domain based on the XML-file path passed to the function :param path: path to a file containing the libvirt XML definition of the domain :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2966-L2994
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
define_xml_str
python
def define_xml_str(xml, **kwargs): # pylint: disable=redefined-outer-name ''' Define a persistent domain based on the XML passed to the function :param xml: libvirt XML definition of the domain :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :para...
Define a persistent domain based on the XML passed to the function :param xml: libvirt XML definition of the domain :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 20...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2997-L3021
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
define_xml_path
python
def define_xml_path(path, **kwargs): ''' Define a persistent domain based on the XML-file path passed to the function :param path: path to a file containing the libvirt XML definition of the domain :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :p...
Define a persistent domain based on the XML-file path passed to the function :param path: path to a file containing the libvirt XML definition of the domain :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overridi...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3024-L3053
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
define_vol_xml_str
python
def define_vol_xml_str(xml, **kwargs): # pylint: disable=redefined-outer-name ''' Define a volume based on the XML passed to the function :param xml: libvirt XML definition of the storage volume :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :par...
Define a volume based on the XML passed to the function :param xml: libvirt XML definition of the storage volume :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019....
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3056-L3100
[ "def warn_until(version,\n message,\n category=DeprecationWarning,\n stacklevel=None,\n _version_info_=None,\n _dont_call_warnings=False):\n '''\n Helper function to raise a warning, by default, a ``DeprecationWarning``,\n until the prov...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
define_vol_xml_path
python
def define_vol_xml_path(path, **kwargs): ''' Define a volume based on the XML-file path passed to the function :param path: path to a file containing the libvirt XML definition of the volume :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param us...
Define a volume based on the XML-file path passed to the function :param path: path to a file containing the libvirt XML definition of the volume :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3103-L3132
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
migrate_non_shared
python
def migrate_non_shared(vm_, target, ssh=False): ''' Attempt to execute non-shared storage "all" migration :param vm_: domain name :param target: target libvirt host name :param ssh: True to connect over ssh CLI Example: .. code-block:: bash salt '*' virt.migrate_non_shared <vm na...
Attempt to execute non-shared storage "all" migration :param vm_: domain name :param target: target libvirt host name :param ssh: True to connect over ssh CLI Example: .. code-block:: bash salt '*' virt.migrate_non_shared <vm name> <target hypervisor> A tunnel data migration can be ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3135-L3166
[ "def to_str(s, encoding=None, errors='strict', normalize=False):\n '''\n Given str, bytes, bytearray, or unicode (py2), return str\n '''\n def _normalize(s):\n try:\n return unicodedata.normalize('NFC', s) if normalize else s\n except TypeError:\n return s\n\n if e...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
seed_non_shared_migrate
python
def seed_non_shared_migrate(disks, force=False): ''' Non shared migration requires that the disks be present on the migration destination, pass the disks information via this function, to the migration destination before executing the migration. :param disks: the list of disk data as provided by vi...
Non shared migration requires that the disks be present on the migration destination, pass the disks information via this function, to the migration destination before executing the migration. :param disks: the list of disk data as provided by virt.get_disks :param force: skip checking the compatibilit...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3237-L3274
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def safe_load(stream, Loader=SaltYamlSafeLoader):\n '''\n .. versionadded:: 2018.3.0\n\n Helper function which automagically uses our custom loader.\n '''\n return yaml.load(stream, Loader=Loader)\n", "def _libvirt_creds():\n '''\n ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
set_autostart
python
def set_autostart(vm_, state='on', **kwargs): ''' Set the autostart flag on a VM so that the VM will start with the host system on reboot. :param vm_: domain name :param state: 'on' to auto start the pool, anything else to mark the pool not to be started when the host boots :p...
Set the autostart flag on a VM so that the VM will start with the host system on reboot. :param vm_: domain name :param state: 'on' to auto start the pool, anything else to mark the pool not to be started when the host boots :param connection: libvirt connection URI, overriding defaul...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3277-L3314
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
undefine
python
def undefine(vm_, **kwargs): ''' Remove a defined vm, this does not purge the virtual machine image, and this only works if the vm is powered down :param vm_: domain name :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username...
Remove a defined vm, this does not purge the virtual machine image, and this only works if the vm is powered down :param vm_: domain name :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3317-L3347
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
purge
python
def purge(vm_, dirs=False, removables=None, **kwargs): ''' Recursively destroy and delete a persistent virtual machine, pass True for dir's to also delete the directories containing the virtual machine disk images - USE WITH EXTREME CAUTION! Pass removables=False to avoid deleting cdrom and floppy ...
Recursively destroy and delete a persistent virtual machine, pass True for dir's to also delete the directories containing the virtual machine disk images - USE WITH EXTREME CAUTION! Pass removables=False to avoid deleting cdrom and floppy images. To avoid disruption, the default but dangerous value is...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3350-L3421
[ "def warn_until(version,\n message,\n category=DeprecationWarning,\n stacklevel=None,\n _version_info_=None,\n _dont_call_warnings=False):\n '''\n Helper function to raise a warning, by default, a ``DeprecationWarning``,\n until the prov...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
_is_kvm_hyper
python
def _is_kvm_hyper(): ''' Returns a bool whether or not this node is a KVM hypervisor ''' try: with salt.utils.files.fopen('/proc/modules') as fp_: if 'kvm_' not in salt.utils.stringutils.to_unicode(fp_.read()): return False except IOError: # No /proc/modul...
Returns a bool whether or not this node is a KVM hypervisor
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3437-L3448
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
get_hypervisor
python
def get_hypervisor(): ''' Returns the name of the hypervisor running on this node or ``None``. Detected hypervisors: - kvm - xen - bhyve CLI Example: .. code-block:: bash salt '*' virt.get_hypervisor .. versionadded:: 2019.2.0 the function and the ``kvm``, ``xen...
Returns the name of the hypervisor running on this node or ``None``. Detected hypervisors: - kvm - xen - bhyve CLI Example: .. code-block:: bash salt '*' virt.get_hypervisor .. versionadded:: 2019.2.0 the function and the ``kvm``, ``xen`` and ``bhyve`` hypervisors suppo...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3511-L3534
null
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
_is_bhyve_hyper
python
def _is_bhyve_hyper(): ''' Returns a bool whether or not this node is a bhyve hypervisor ''' sysctl_cmd = 'sysctl hw.vmm.create' vmm_enabled = False try: stdout = subprocess.Popen(sysctl_cmd, shell=True, stdout=subproces...
Returns a bool whether or not this node is a bhyve hypervisor
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3537-L3550
[ "def to_str(s, encoding=None, errors='strict', normalize=False):\n '''\n Given str, bytes, bytearray, or unicode (py2), return str\n '''\n def _normalize(s):\n try:\n return unicodedata.normalize('NFC', s) if normalize else s\n except TypeError:\n return s\n\n if e...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
vm_cputime
python
def vm_cputime(vm_=None, **kwargs): ''' Return cputime used by the vms on this hyper in a list of dicts: :param vm_: domain name :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults ...
Return cputime used by the vms on this hyper in a list of dicts: :param vm_: domain name :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019.2.0 :param passw...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3568-L3628
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
vm_netstats
python
def vm_netstats(vm_=None, **kwargs): ''' Return combined network counters used by the vms on this hyper in a list of dicts: :param vm_: domain name :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overr...
Return combined network counters used by the vms on this hyper in a list of dicts: :param vm_: domain name :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019.2....
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3631-L3709
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
vm_diskstats
python
def vm_diskstats(vm_=None, **kwargs): ''' Return disk usage counters used by the vms on this hyper in a list of dicts: :param vm_: domain name :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding...
Return disk usage counters used by the vms on this hyper in a list of dicts: :param vm_: domain name :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019.2.0 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3712-L3788
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
_parse_snapshot_description
python
def _parse_snapshot_description(vm_snapshot, unix_time=False): ''' Parse XML doc and return a dict with the status values. :param xmldoc: :return: ''' ret = dict() tree = ElementTree.fromstring(vm_snapshot.getXMLDesc()) for node in tree: if node.tag == 'name': ret['n...
Parse XML doc and return a dict with the status values. :param xmldoc: :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3791-L3811
null
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
list_snapshots
python
def list_snapshots(domain=None, **kwargs): ''' List available snapshots for certain vm or for all. :param domain: domain name :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .....
List available snapshots for certain vm or for all. :param domain: domain name :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019.2.0 :param password: password ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3814-L3844
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
snapshot
python
def snapshot(domain, name=None, suffix=None, **kwargs): ''' Create a snapshot of a VM. :param domain: domain name :param name: Name of the snapshot. If the name is omitted, then will be used original domain name with ISO 8601 time as a suffix. :param suffix: Add suffix for the new...
Create a snapshot of a VM. :param domain: domain name :param name: Name of the snapshot. If the name is omitted, then will be used original domain name with ISO 8601 time as a suffix. :param suffix: Add suffix for the new name. Useful in states, where such snapshots can...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3847-L3894
[ "def to_str(s, encoding=None, errors='strict', normalize=False):\n '''\n Given str, bytes, bytearray, or unicode (py2), return str\n '''\n def _normalize(s):\n try:\n return unicodedata.normalize('NFC', s) if normalize else s\n except TypeError:\n return s\n\n if e...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
delete_snapshots
python
def delete_snapshots(name, *names, **kwargs): ''' Delete one or more snapshots of the given VM. :param name: domain name :param names: names of the snapshots to remove :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to...
Delete one or more snapshots of the given VM. :param name: domain name :param names: names of the snapshots to remove :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadde...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3897-L3934
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
revert_snapshot
python
def revert_snapshot(name, vm_snapshot=None, cleanup=False, **kwargs): ''' Revert snapshot to the previous from current (if available) or to the specific. :param name: domain name :param vm_snapshot: name of the snapshot to revert :param cleanup: Remove all newer than reverted snapshots. Values: Tru...
Revert snapshot to the previous from current (if available) or to the specific. :param name: domain name :param vm_snapshot: name of the snapshot to revert :param cleanup: Remove all newer than reverted snapshots. Values: True or False (default False). :param connection: libvirt connection URI, overrid...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3937-L4016
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
_caps_add_machine
python
def _caps_add_machine(machines, node): ''' Parse the <machine> element of the host capabilities and add it to the machines list. ''' maxcpus = node.get('maxCpus') canonical = node.get('canonical') name = node.text alternate_name = "" if canonical: alternate_name = name ...
Parse the <machine> element of the host capabilities and add it to the machines list.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4019-L4040
null
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
_parse_caps_guest
python
def _parse_caps_guest(guest): ''' Parse the <guest> element of the connection capabilities XML ''' arch_node = guest.find('arch') result = { 'os_type': guest.find('os_type').text, 'arch': { 'name': arch_node.get('name'), 'machines': {}, 'domains': ...
Parse the <guest> element of the connection capabilities XML
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4043-L4087
[ "def _caps_add_machine(machines, node):\n '''\n Parse the <machine> element of the host capabilities and add it\n to the machines list.\n '''\n maxcpus = node.get('maxCpus')\n canonical = node.get('canonical')\n name = node.text\n\n alternate_name = \"\"\n if canonical:\n alternate...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
_parse_caps_cell
python
def _parse_caps_cell(cell): ''' Parse the <cell> nodes of the connection capabilities XML output. ''' result = { 'id': int(cell.get('id')) } mem_node = cell.find('memory') if mem_node is not None: unit = mem_node.get('unit', 'KiB') memory = mem_node.text resu...
Parse the <cell> nodes of the connection capabilities XML output.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4090-L4134
null
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
_parse_caps_bank
python
def _parse_caps_bank(bank): ''' Parse the <bank> element of the connection capabilities XML. ''' result = { 'id': int(bank.get('id')), 'level': int(bank.get('level')), 'type': bank.get('type'), 'size': "{} {}".format(bank.get('size'), bank.get('unit')), 'cpus': ba...
Parse the <bank> element of the connection capabilities XML.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4137-L4165
null
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
_parse_caps_host
python
def _parse_caps_host(host): ''' Parse the <host> element of the connection capabilities XML. ''' result = {} for child in host: if child.tag == 'uuid': result['uuid'] = child.text elif child.tag == 'cpu': cpu = { 'arch': child.find('arch').te...
Parse the <host> element of the connection capabilities XML.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4168-L4226
null
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
capabilities
python
def capabilities(**kwargs): ''' Return the hypervisor connection capabilities. :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: password to connect with, overriding defaults .. versionadded:: 2019.2.0...
Return the hypervisor connection capabilities. :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: password to connect with, overriding defaults .. versionadded:: 2019.2.0 CLI Example: .. code-block:: ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4229-L4252
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
_parse_caps_cpu
python
def _parse_caps_cpu(node): ''' Parse the <cpu> element of the domain capabilities ''' result = {} for mode in node.findall('mode'): if not mode.get('supported') == 'yes': continue name = mode.get('name') if name == 'host-passthrough': result[name] = T...
Parse the <cpu> element of the domain capabilities
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4262-L4309
null
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
_parse_caps_devices_features
python
def _parse_caps_devices_features(node): ''' Parse the devices or features list of the domain capatilities ''' result = {} for child in node: if child.get('supported') == 'yes': enums = [_parse_caps_enum(node) for node in child.findall('enum')] result[child.tag] = {ite...
Parse the devices or features list of the domain capatilities
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4312-L4321
null
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
_parse_caps_loader
python
def _parse_caps_loader(node): ''' Parse the <loader> element of the domain capabilities. ''' enums = [_parse_caps_enum(enum) for enum in node.findall('enum')] result = {item[0]: item[1] for item in enums if item[0]} values = [child.text for child in node.findall('value')] if values: ...
Parse the <loader> element of the domain capabilities.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4324-L4336
null
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
_parse_domain_caps
python
def _parse_domain_caps(caps): ''' Parse the XML document of domain capabilities into a structure. Return the domain capabilities given an emulator, architecture, machine or virtualization type. .. versionadded:: 2019.2.0 :param emulator: return the capabilities for the given emulator binary :p...
Parse the XML document of domain capabilities into a structure. Return the domain capabilities given an emulator, architecture, machine or virtualization type. .. versionadded:: 2019.2.0 :param emulator: return the capabilities for the given emulator binary :param arch: return the capabilities for the...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4339-L4402
null
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
domain_capabilities
python
def domain_capabilities(emulator=None, arch=None, machine=None, domain=None, **kwargs): ''' Return the domain capabilities given an emulator, architecture, machine or virtualization type. .. versionadded:: 2019.2.0 :param emulator: return the capabilities for the given emulator binary :param arch:...
Return the domain capabilities given an emulator, architecture, machine or virtualization type. .. versionadded:: 2019.2.0 :param emulator: return the capabilities for the given emulator binary :param arch: return the capabilities for the given CPU architecture :param machine: return the capabilities ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4405-L4439
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
all_capabilities
python
def all_capabilities(**kwargs): ''' Return the host and domain capabilities in a single call. .. versionadded:: Neon :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: password to connect with, overridi...
Return the host and domain capabilities in a single call. .. versionadded:: Neon :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: password to connect with, overriding defaults CLI Example: .. code-b...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4442-L4478
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
cpu_baseline
python
def cpu_baseline(full=False, migratable=False, out='libvirt', **kwargs): ''' Return the optimal 'custom' CPU baseline config for VM's on this minion .. versionadded:: 2016.3.0 :param full: Return all CPU features rather than the ones on top of the closest CPU model :param migratable: Exclude CPU f...
Return the optimal 'custom' CPU baseline config for VM's on this minion .. versionadded:: 2016.3.0 :param full: Return all CPU features rather than the ones on top of the closest CPU model :param migratable: Exclude CPU features that are unmigratable (libvirt 2.13+) :param out: 'libvirt' (default) for...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4481-L4562
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
network_define
python
def network_define(name, bridge, forward, **kwargs): ''' Create libvirt network. :param name: Network name :param bridge: Bridge name :param forward: Forward mode(bridge, router, nat) :param vport: Virtualport type :param tag: Vlan tag :param autostart: Network autostart (default True) ...
Create libvirt network. :param name: Network name :param bridge: Bridge name :param forward: Forward mode(bridge, router, nat) :param vport: Virtualport type :param tag: Vlan tag :param autostart: Network autostart (default True) :param start: Network start (default True) :param connect...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4565-L4628
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
list_networks
python
def list_networks(**kwargs): ''' List all virtual networks. :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: password to connect with, overriding defaults .. versionadded:: 2019.2.0 CLI Example: ...
List all virtual networks. :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: password to connect with, overriding defaults .. versionadded:: 2019.2.0 CLI Example: .. code-block:: bash salt '*...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4631-L4651
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
network_info
python
def network_info(name=None, **kwargs): ''' Return informations on a virtual network provided its name. :param name: virtual network name :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: password to con...
Return informations on a virtual network provided its name. :param name: virtual network name :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: password to connect with, overriding defaults If no name is p...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4654-L4703
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
network_start
python
def network_start(name, **kwargs): ''' Start a defined virtual network. :param name: virtual network name :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: password to connect with, overriding defaults ...
Start a defined virtual network. :param name: virtual network name :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: password to connect with, overriding defaults .. versionadded:: 2019.2.0 CLI Exampl...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4706-L4728
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
network_stop
python
def network_stop(name, **kwargs): ''' Stop a defined virtual network. :param name: virtual network name :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: password to connect with, overriding defaults ...
Stop a defined virtual network. :param name: virtual network name :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: password to connect with, overriding defaults .. versionadded:: 2019.2.0 CLI Example...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4731-L4753
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
network_undefine
python
def network_undefine(name, **kwargs): ''' Remove a defined virtual network. This does not stop the virtual network. :param name: virtual network name :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: pa...
Remove a defined virtual network. This does not stop the virtual network. :param name: virtual network name :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: password to connect with, overriding defaults ....
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4756-L4778
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
network_set_autostart
python
def network_set_autostart(name, state='on', **kwargs): ''' Set the autostart flag on a virtual network so that the network will start with the host system on reboot. :param name: virtual network name :param state: 'on' to auto start the network, anything else to mark the virtual n...
Set the autostart flag on a virtual network so that the network will start with the host system on reboot. :param name: virtual network name :param state: 'on' to auto start the network, anything else to mark the virtual network not to be started when the host boots :param connection:...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4781-L4806
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
pool_define
python
def pool_define(name, ptype, target=None, permissions=None, source_devices=None, source_dir=None, source_adapter=None, source_hosts=None, source_auth=None, source_name=None, ...
Create libvirt pool. :param name: Pool name :param ptype: Pool type. See `libvirt documentation <https://libvirt.org/storage.html>`_ for the possible values. :param target: Pool full path target :param permissions: Permissions to set on the target folder. This is mostly used for ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4809-L4979
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
list_pools
python
def list_pools(**kwargs): ''' List all storage pools. :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: password to connect with, overriding defaults .. versionadded:: 2019.2.0 CLI Example: ....
List all storage pools. :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: password to connect with, overriding defaults .. versionadded:: 2019.2.0 CLI Example: .. code-block:: bash salt '*' ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4982-L5002
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
pool_info
python
def pool_info(name=None, **kwargs): ''' Return informations on a storage pool provided its name. :param name: libvirt storage pool name :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: password to conn...
Return informations on a storage pool provided its name. :param name: libvirt storage pool name :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: password to connect with, overriding defaults If no name is...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L5005-L5057
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
pool_start
python
def pool_start(name, **kwargs): ''' Start a defined libvirt storage pool. :param name: libvirt storage pool name :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: password to connect with, overriding de...
Start a defined libvirt storage pool. :param name: libvirt storage pool name :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: password to connect with, overriding defaults .. versionadded:: 2019.2.0 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L5060-L5082
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
pool_build
python
def pool_build(name, **kwargs): ''' Build a defined libvirt storage pool. :param name: libvirt storage pool name :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: password to connect with, overriding de...
Build a defined libvirt storage pool. :param name: libvirt storage pool name :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: password to connect with, overriding defaults .. versionadded:: 2019.2.0 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L5085-L5107
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
pool_stop
python
def pool_stop(name, **kwargs): ''' Stop a defined libvirt storage pool. :param name: libvirt storage pool name :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: password to connect with, overriding defa...
Stop a defined libvirt storage pool. :param name: libvirt storage pool name :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: password to connect with, overriding defaults .. versionadded:: 2019.2.0 C...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L5110-L5132
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
pool_undefine
python
def pool_undefine(name, **kwargs): ''' Remove a defined libvirt storage pool. The pool needs to be stopped before calling. :param name: libvirt storage pool name :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param ...
Remove a defined libvirt storage pool. The pool needs to be stopped before calling. :param name: libvirt storage pool name :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: password to connect with, overriding ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L5135-L5157
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
pool_delete
python
def pool_delete(name, fast=True, **kwargs): ''' Delete the resources of a defined libvirt storage pool. :param name: libvirt storage pool name :param fast: if set to False, zeroes out all the data. Default value is True. :param connection: libvirt connection URI, overriding default...
Delete the resources of a defined libvirt storage pool. :param name: libvirt storage pool name :param fast: if set to False, zeroes out all the data. Default value is True. :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overrid...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L5160-L5187
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
pool_refresh
python
def pool_refresh(name, **kwargs): ''' Refresh a defined libvirt storage pool. :param name: libvirt storage pool name :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: password to connect with, overridin...
Refresh a defined libvirt storage pool. :param name: libvirt storage pool name :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: password to connect with, overriding defaults .. versionadded:: 2019.2.0 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L5190-L5212
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
pool_set_autostart
python
def pool_set_autostart(name, state='on', **kwargs): ''' Set the autostart flag on a libvirt storage pool so that the storage pool will start with the host system on reboot. :param name: libvirt storage pool name :param state: 'on' to auto start the pool, anything else to mark the ...
Set the autostart flag on a libvirt storage pool so that the storage pool will start with the host system on reboot. :param name: libvirt storage pool name :param state: 'on' to auto start the pool, anything else to mark the pool not to be started when the host boots :param connection...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L5215-L5240
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
pool_list_volumes
python
def pool_list_volumes(name, **kwargs): ''' List the volumes contained in a defined libvirt storage pool. :param name: libvirt storage pool name :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: password...
List the volumes contained in a defined libvirt storage pool. :param name: libvirt storage pool name :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: password to connect with, overriding defaults .. versi...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L5243-L5265
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
_get_storage_vol
python
def _get_storage_vol(conn, pool, vol): ''' Helper function getting a storage volume. Will throw a libvirtError if the pool or the volume couldn't be found. ''' pool_obj = conn.storagePoolLookupByName(pool) return pool_obj.storageVolLookupByName(vol)
Helper function getting a storage volume. Will throw a libvirtError if the pool or the volume couldn't be found.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L5268-L5274
null
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
_get_all_volumes_paths
python
def _get_all_volumes_paths(conn): ''' Extract the path and backing stores path of all volumes. :param conn: libvirt connection to use ''' volumes = [vol for l in [obj.listAllVolumes() for obj in conn.listAllStoragePools()] for vol in l] return {vol.path(): [path.text for path in ElementTree.fro...
Extract the path and backing stores path of all volumes. :param conn: libvirt connection to use
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L5290-L5298
null
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
volume_infos
python
def volume_infos(pool=None, volume=None, **kwargs): ''' Provide details on a storage volume. If no volume name is provided, the infos all the volumes contained in the pool are provided. If no pool is provided, the infos of the volumes of all pools are output. :param pool: libvirt storage pool name ...
Provide details on a storage volume. If no volume name is provided, the infos all the volumes contained in the pool are provided. If no pool is provided, the infos of the volumes of all pools are output. :param pool: libvirt storage pool name (default: ``None``) :param volume: name of the volume to get...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L5301-L5367
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/virt.py
volume_delete
python
def volume_delete(pool, volume, **kwargs): ''' Delete a libvirt managed volume. :param pool: libvirt storage pool name :param volume: name of the volume to delete :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :p...
Delete a libvirt managed volume. :param pool: libvirt storage pool name :param volume: name of the volume to delete :param connection: libvirt connection URI, overriding defaults :param username: username to connect with, overriding defaults :param password: password to connect with, overriding def...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L5370-L5393
[ "def __get_conn(**kwargs):\n '''\n Detects what type of dom this node is and attempts to connect to the\n correct hypervisor via libvirt.\n\n :param connection: libvirt connection URI, overriding defaults\n :param username: username to connect with, overriding defaults\n :param password: password ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by libvirt :depends: libvirt Python module Connection ========== The connection to the virtualization host can be either setup in the minion configuration, pillar data or overridden for each individual call. By default, the libvirt connection URL will b...
saltstack/salt
salt/modules/mdata.py
list_
python
def list_(): ''' List available metadata CLI Example: .. code-block:: bash salt '*' mdata.list ''' mdata = _check_mdata_list() if mdata: cmd = '{0}'.format(mdata) return __salt__['cmd.run'](cmd, ignore_retcode=True).splitlines() return {}
List available metadata CLI Example: .. code-block:: bash salt '*' mdata.list
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mdata.py#L81-L95
null
# -*- coding: utf-8 -*- ''' Module for managaging metadata in SmartOS Zones .. versionadded:: 2016.3.0 :maintainer: Jorge Schrauwen <sjorge@blackdot.be> :maturity: new :platform: smartos ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import logging # I...
saltstack/salt
salt/modules/mdata.py
get_
python
def get_(*keyname): ''' Get metadata keyname : string name of key .. note:: If no keynames are specified, we get all (public) properties CLI Example: .. code-block:: bash salt '*' mdata.get salt:role salt '*' mdata.get user-script salt:role ''' mdata...
Get metadata keyname : string name of key .. note:: If no keynames are specified, we get all (public) properties CLI Example: .. code-block:: bash salt '*' mdata.get salt:role salt '*' mdata.get user-script salt:role
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mdata.py#L98-L130
[ "def list_():\n '''\n List available metadata\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' mdata.list\n '''\n mdata = _check_mdata_list()\n if mdata:\n cmd = '{0}'.format(mdata)\n return __salt__['cmd.run'](cmd, ignore_retcode=True).splitlines()\n return {}\n" ...
# -*- coding: utf-8 -*- ''' Module for managaging metadata in SmartOS Zones .. versionadded:: 2016.3.0 :maintainer: Jorge Schrauwen <sjorge@blackdot.be> :maturity: new :platform: smartos ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import logging # I...
saltstack/salt
salt/modules/mdata.py
put_
python
def put_(keyname, val): ''' Put metadata prop : string name of property val : string value to set CLI Example: .. code-block:: bash salt '*' mdata.list ''' mdata = _check_mdata_put() ret = {} if mdata: cmd = 'echo {2} | {0} {1}'.format(mdata, ...
Put metadata prop : string name of property val : string value to set CLI Example: .. code-block:: bash salt '*' mdata.list
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mdata.py#L133-L155
null
# -*- coding: utf-8 -*- ''' Module for managaging metadata in SmartOS Zones .. versionadded:: 2016.3.0 :maintainer: Jorge Schrauwen <sjorge@blackdot.be> :maturity: new :platform: smartos ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import logging # I...
saltstack/salt
salt/modules/mdata.py
delete_
python
def delete_(*keyname): ''' Delete metadata prop : string name of property CLI Example: .. code-block:: bash salt '*' mdata.get salt:role salt '*' mdata.get user-script salt:role ''' mdata = _check_mdata_delete() valid_keynames = list_() ret = {} for k...
Delete metadata prop : string name of property CLI Example: .. code-block:: bash salt '*' mdata.get salt:role salt '*' mdata.get user-script salt:role
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mdata.py#L158-L183
[ "def list_():\n '''\n List available metadata\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' mdata.list\n '''\n mdata = _check_mdata_list()\n if mdata:\n cmd = '{0}'.format(mdata)\n return __salt__['cmd.run'](cmd, ignore_retcode=True).splitlines()\n return {}\n" ...
# -*- coding: utf-8 -*- ''' Module for managaging metadata in SmartOS Zones .. versionadded:: 2016.3.0 :maintainer: Jorge Schrauwen <sjorge@blackdot.be> :maturity: new :platform: smartos ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import logging # I...
saltstack/salt
salt/cloud/clouds/saltify.py
show_instance
python
def show_instance(name, call=None): ''' List the a single node, return dict of grains. ''' local = salt.client.LocalClient() ret = local.cmd(name, 'grains.items') ret.update(_build_required_items(ret)) return ret
List the a single node, return dict of grains.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/saltify.py#L203-L210
[ "def _build_required_items(nodes):\n ret = {}\n for name, grains in nodes.items():\n if grains:\n private_ips = []\n public_ips = []\n ips = grains['ipv4'] + grains['ipv6']\n for adrs in ips:\n ip_ = ipaddress.ip_address(adrs)\n ...
# -*- coding: utf-8 -*- ''' .. _`saltify-module`: Saltify Module ============== The Saltify module is designed to install Salt on a remote machine, virtual or bare metal, using SSH. This module is useful for provisioning machines which are already installed, but not Salted. .. versionchanged:: 2018.3.0 The wake_...
saltstack/salt
salt/cloud/clouds/saltify.py
create
python
def create(vm_): ''' if configuration parameter ``deploy`` is ``True``, Provision a single machine, adding its keys to the salt master else, Test ssh connections to the machine Configuration parameters: - deploy: (see above) - provider: name of entry in ``salt/cloud.provid...
if configuration parameter ``deploy`` is ``True``, Provision a single machine, adding its keys to the salt master else, Test ssh connections to the machine Configuration parameters: - deploy: (see above) - provider: name of entry in ``salt/cloud.providers.d/???`` file - ssh_ho...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/saltify.py#L213-L291
[ "def get_cloud_config_value(name, vm_, opts, default=None, search_global=True):\n '''\n Search and return a setting in a known order:\n\n 1. In the virtual machine's configuration\n 2. In the virtual machine's profile configuration\n 3. In the virtual machine's provider configuration\n ...
# -*- coding: utf-8 -*- ''' .. _`saltify-module`: Saltify Module ============== The Saltify module is designed to install Salt on a remote machine, virtual or bare metal, using SSH. This module is useful for provisioning machines which are already installed, but not Salted. .. versionchanged:: 2018.3.0 The wake_...
saltstack/salt
salt/cloud/clouds/saltify.py
_verify
python
def _verify(vm_): ''' Verify credentials for an existing system ''' log.info('Verifying credentials for %s', vm_['name']) win_installer = config.get_cloud_config_value( 'win_installer', vm_, __opts__) if win_installer: log.debug('Testing Windows authentication method for %s', ...
Verify credentials for an existing system
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/saltify.py#L305-L396
null
# -*- coding: utf-8 -*- ''' .. _`saltify-module`: Saltify Module ============== The Saltify module is designed to install Salt on a remote machine, virtual or bare metal, using SSH. This module is useful for provisioning machines which are already installed, but not Salted. .. versionchanged:: 2018.3.0 The wake_...
saltstack/salt
salt/cloud/clouds/saltify.py
destroy
python
def destroy(name, call=None): ''' Destroy a node. .. versionadded:: 2018.3.0 Disconnect a minion from the master, and remove its keys. Optionally, (if ``remove_config_on_destroy`` is ``True``), disables salt-minion from running on the minion, and erases the Salt configuration files from i...
Destroy a node. .. versionadded:: 2018.3.0 Disconnect a minion from the master, and remove its keys. Optionally, (if ``remove_config_on_destroy`` is ``True``), disables salt-minion from running on the minion, and erases the Salt configuration files from it. Optionally, (if ``shutdown_on_...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/saltify.py#L399-L485
[ "def get_cloud_config_value(name, vm_, opts, default=None, search_global=True):\n '''\n Search and return a setting in a known order:\n\n 1. In the virtual machine's configuration\n 2. In the virtual machine's profile configuration\n 3. In the virtual machine's provider configuration\n ...
# -*- coding: utf-8 -*- ''' .. _`saltify-module`: Saltify Module ============== The Saltify module is designed to install Salt on a remote machine, virtual or bare metal, using SSH. This module is useful for provisioning machines which are already installed, but not Salted. .. versionchanged:: 2018.3.0 The wake_...
saltstack/salt
salt/cloud/clouds/saltify.py
reboot
python
def reboot(name, call=None): ''' Reboot a saltify minion. ..versionadded:: 2018.3.0 name The name of the VM to reboot. CLI Example: .. code-block:: bash salt-cloud -a reboot vm_name ''' if call != 'action': raise SaltCloudException( 'The reboot a...
Reboot a saltify minion. ..versionadded:: 2018.3.0 name The name of the VM to reboot. CLI Example: .. code-block:: bash salt-cloud -a reboot vm_name
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/saltify.py#L488-L510
[ "def cmd(self,\n tgt,\n fun,\n arg=(),\n timeout=None,\n tgt_type='glob',\n ret='',\n jid='',\n full_return=False,\n kwarg=None,\n **kwargs):\n '''\n Synchronously execute a command on targeted minions\n\n The cmd method will execute and...
# -*- coding: utf-8 -*- ''' .. _`saltify-module`: Saltify Module ============== The Saltify module is designed to install Salt on a remote machine, virtual or bare metal, using SSH. This module is useful for provisioning machines which are already installed, but not Salted. .. versionchanged:: 2018.3.0 The wake_...
saltstack/salt
salt/states/jenkins.py
present
python
def present(name, config=None, **kwargs): ''' Ensure the job is present in the Jenkins configured jobs name The unique name for the Jenkins job config The Salt URL for the file to use for configuring the job ''' ret = {'name': name, 'result':...
Ensure the job is present in the Jenkins configured jobs name The unique name for the Jenkins job config The Salt URL for the file to use for configuring the job
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/jenkins.py#L47-L101
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' Management of Jenkins ===================== .. versionadded:: 2016.3.0 ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import difflib import logging # Import Salt libs from salt.ext import six from salt.ext.six.moves import zip from salt....
saltstack/salt
salt/states/jenkins.py
absent
python
def absent(name, **kwargs): ''' Ensure the job is absent from the Jenkins configured jobs name The name of the Jenkins job to remove ''' ret = {'name': name, 'result': True, 'changes': {}, 'comment': []} if __salt__['jenkins.job_exists'](name...
Ensure the job is absent from the Jenkins configured jobs name The name of the Jenkins job to remove
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/jenkins.py#L104-L126
[ "def _fail(ret, msg):\n ret['comment'] = msg\n ret['result'] = False\n return ret\n" ]
# -*- coding: utf-8 -*- ''' Management of Jenkins ===================== .. versionadded:: 2016.3.0 ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import difflib import logging # Import Salt libs from salt.ext import six from salt.ext.six.moves import zip from salt....
saltstack/salt
salt/beacons/salt_proxy.py
_run_proxy_processes
python
def _run_proxy_processes(proxies): ''' Iterate over a list of proxy names and restart any that aren't running ''' ret = [] for proxy in proxies: result = {} if not __salt__['salt_proxy.is_running'](proxy)['result']: __salt__['salt_proxy.configure_proxy'](proxy, st...
Iterate over a list of proxy names and restart any that aren't running
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/salt_proxy.py#L17-L34
null
# -*- coding: utf-8 -*- ''' Beacon to manage and report the status of one or more salt proxy processes .. versionadded:: 2015.8.3 ''' # Import python libs from __future__ import absolute_import, unicode_literals import logging from salt.ext.six.moves import map log = logging.getLogger(__name__) def va...
saltstack/salt
salt/beacons/salt_proxy.py
beacon
python
def beacon(config): ''' Handle configured proxies .. code-block:: yaml beacons: salt_proxy: - proxies: p8000: {} p8001: {} ''' log.trace('salt proxy beacon called') _config = {} list(map(_config.update, config)) return _ru...
Handle configured proxies .. code-block:: yaml beacons: salt_proxy: - proxies: p8000: {} p8001: {}
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/salt_proxy.py#L60-L77
[ "def _run_proxy_processes(proxies):\n '''\n Iterate over a list of proxy\n names and restart any that\n aren't running\n '''\n ret = []\n for proxy in proxies:\n result = {}\n if not __salt__['salt_proxy.is_running'](proxy)['result']:\n __salt__['salt_proxy.configure_pr...
# -*- coding: utf-8 -*- ''' Beacon to manage and report the status of one or more salt proxy processes .. versionadded:: 2015.8.3 ''' # Import python libs from __future__ import absolute_import, unicode_literals import logging from salt.ext.six.moves import map log = logging.getLogger(__name__) def _ru...
saltstack/salt
salt/modules/powerpath.py
list_licenses
python
def list_licenses(): ''' returns a list of applied powerpath license keys ''' KEY_PATTERN = re.compile('Key (.*)') keys = [] out = __salt__['cmd.run']('/sbin/emcpreg -list') for line in out.splitlines(): match = KEY_PATTERN.match(line) if not match: continue ...
returns a list of applied powerpath license keys
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/powerpath.py#L54-L70
null
# -*- coding: utf-8 -*- ''' powerpath support. Assumes RedHat ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import os import re POLICY_MAP_DICT = { 'Adaptive': 'ad', 'CLAROpt': 'co', 'LeastBlocks': 'lb', 'LeastIos': 'li', 'REquest': 're', '...
saltstack/salt
salt/modules/powerpath.py
add_license
python
def add_license(key): ''' Add a license ''' result = { 'result': False, 'retcode': -1, 'output': '' } if not has_powerpath(): result['output'] = 'PowerPath is not installed' return result cmd = '/sbin/emcpreg -add {0}'.format(key) ret = __salt__[...
Add a license
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/powerpath.py#L73-L98
[ "def has_powerpath():\n if os.path.exists('/sbin/emcpreg'):\n return True\n\n return False\n" ]
# -*- coding: utf-8 -*- ''' powerpath support. Assumes RedHat ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import os import re POLICY_MAP_DICT = { 'Adaptive': 'ad', 'CLAROpt': 'co', 'LeastBlocks': 'lb', 'LeastIos': 'li', 'REquest': 're', '...
saltstack/salt
salt/states/openvswitch_db.py
managed
python
def managed(name, table, data, record=None): ''' Ensures that the specified columns of the named record have the specified values. Args: name: The name of the record. table: The name of the table to which the record belongs. data: Dictionary containing a mapping from column name...
Ensures that the specified columns of the named record have the specified values. Args: name: The name of the record. table: The name of the table to which the record belongs. data: Dictionary containing a mapping from column names to the desired values. Columns that exist, ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/openvswitch_db.py#L17-L69
null
# -*- coding: utf-8 -*- ''' Management of Open vSwitch database records. ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals def __virtual__(): ''' Only make these states available if Open vSwitch module is available. ''' return 'openvswitch.db_get' in __...
saltstack/salt
salt/modules/x509.py
_fix_ctx
python
def _fix_ctx(m2_ctx, issuer=None): ''' This is part of an ugly hack to fix an ancient bug in M2Crypto https://bugzilla.osafoundation.org/show_bug.cgi?id=7530#c13 ''' ctx = _Ctx.from_address(int(m2_ctx)) # pylint: disable=no-member ctx.flags = 0 ctx.subject_cert = None ctx.subject_req =...
This is part of an ugly hack to fix an ancient bug in M2Crypto https://bugzilla.osafoundation.org/show_bug.cgi?id=7530#c13
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/x509.py#L105-L119
null
# -*- coding: utf-8 -*- ''' Manage X509 certificates .. versionadded:: 2015.8.0 :depends: M2Crypto ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function import os import logging import hashlib import glob import random import ctypes import tempfile import re import dateti...
saltstack/salt
salt/modules/x509.py
_new_extension
python
def _new_extension(name, value, critical=0, issuer=None, _pyfree=1): ''' Create new X509_Extension, This is required because M2Crypto doesn't support getting the publickeyidentifier from the issuer to create the authoritykeyidentifier extension. ''' if name == 'subjectKeyIdentifier' and value.st...
Create new X509_Extension, This is required because M2Crypto doesn't support getting the publickeyidentifier from the issuer to create the authoritykeyidentifier extension.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/x509.py#L122-L158
null
# -*- coding: utf-8 -*- ''' Manage X509 certificates .. versionadded:: 2015.8.0 :depends: M2Crypto ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function import os import logging import hashlib import glob import random import ctypes import tempfile import re import dateti...
saltstack/salt
salt/modules/x509.py
_parse_openssl_req
python
def _parse_openssl_req(csr_filename): ''' Parses openssl command line output, this is a workaround for M2Crypto's inability to get them from CSR objects. ''' if not salt.utils.path.which('openssl'): raise salt.exceptions.SaltInvocationError( 'openssl binary not found in path' ...
Parses openssl command line output, this is a workaround for M2Crypto's inability to get them from CSR objects.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/x509.py#L164-L180
null
# -*- coding: utf-8 -*- ''' Manage X509 certificates .. versionadded:: 2015.8.0 :depends: M2Crypto ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function import os import logging import hashlib import glob import random import ctypes import tempfile import re import dateti...
saltstack/salt
salt/modules/x509.py
_get_csr_extensions
python
def _get_csr_extensions(csr): ''' Returns a list of dicts containing the name, value and critical value of any extension contained in a csr object. ''' ret = OrderedDict() csrtempfile = tempfile.NamedTemporaryFile() csrtempfile.write(csr.as_pem()) csrtempfile.flush() csryaml = _pars...
Returns a list of dicts containing the name, value and critical value of any extension contained in a csr object.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/x509.py#L183-L206
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def _parse_openssl_req(csr_filename):\n '''\n Parses openssl command line output, this is a workaround for M2Crypto's\n inability to get them from CSR objects.\n '''\n if not salt.utils.path.which('openssl'):\n raise salt.exceptions...
# -*- coding: utf-8 -*- ''' Manage X509 certificates .. versionadded:: 2015.8.0 :depends: M2Crypto ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function import os import logging import hashlib import glob import random import ctypes import tempfile import re import dateti...
saltstack/salt
salt/modules/x509.py
_parse_openssl_crl
python
def _parse_openssl_crl(crl_filename): ''' Parses openssl command line output, this is a workaround for M2Crypto's inability to get them from CSR objects. ''' if not salt.utils.path.which('openssl'): raise salt.exceptions.SaltInvocationError( 'openssl binary not found in path' ...
Parses openssl command line output, this is a workaround for M2Crypto's inability to get them from CSR objects.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/x509.py#L212-L282
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n" ]
# -*- coding: utf-8 -*- ''' Manage X509 certificates .. versionadded:: 2015.8.0 :depends: M2Crypto ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function import os import logging import hashlib import glob import random import ctypes import tempfile import re import dateti...
saltstack/salt
salt/modules/x509.py
_pretty_hex
python
def _pretty_hex(hex_str): ''' Nicely formats hex strings ''' if len(hex_str) % 2 != 0: hex_str = '0' + hex_str return ':'.join( [hex_str[i:i + 2] for i in range(0, len(hex_str), 2)]).upper()
Nicely formats hex strings
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/x509.py#L295-L302
null
# -*- coding: utf-8 -*- ''' Manage X509 certificates .. versionadded:: 2015.8.0 :depends: M2Crypto ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function import os import logging import hashlib import glob import random import ctypes import tempfile import re import dateti...
saltstack/salt
salt/modules/x509.py
_text_or_file
python
def _text_or_file(input_): ''' Determines if input is a path to a file, or a string with the content to be parsed. ''' if _isfile(input_): with salt.utils.files.fopen(input_) as fp_: out = salt.utils.stringutils.to_str(fp_.read()) else: out = salt.utils.stringutils.to...
Determines if input is a path to a file, or a string with the content to be parsed.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/x509.py#L324-L335
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' Manage X509 certificates .. versionadded:: 2015.8.0 :depends: M2Crypto ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function import os import logging import hashlib import glob import random import ctypes import tempfile import re import dateti...
saltstack/salt
salt/modules/x509.py
_parse_subject
python
def _parse_subject(subject): ''' Returns a dict containing all values in an X509 Subject ''' ret = {} nids = [] for nid_name, nid_num in six.iteritems(subject.nid): if nid_num in nids: continue try: val = getattr(subject, nid_name) if val: ...
Returns a dict containing all values in an X509 Subject
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/x509.py#L338-L355
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n" ]
# -*- coding: utf-8 -*- ''' Manage X509 certificates .. versionadded:: 2015.8.0 :depends: M2Crypto ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function import os import logging import hashlib import glob import random import ctypes import tempfile import re import dateti...
saltstack/salt
salt/modules/x509.py
_get_certificate_obj
python
def _get_certificate_obj(cert): ''' Returns a certificate object based on PEM text. ''' if isinstance(cert, M2Crypto.X509.X509): return cert text = _text_or_file(cert) text = get_pem_entry(text, pem_type='CERTIFICATE') return M2Crypto.X509.load_cert_string(text)
Returns a certificate object based on PEM text.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/x509.py#L358-L367
[ "def get_pem_entry(text, pem_type=None):\n '''\n Returns a properly formatted PEM string from the input text fixing\n any whitespace or line-break issues\n\n text:\n Text containing the X509 PEM entry to be returned or path to\n a file containing the text.\n\n pem_type:\n If spec...
# -*- coding: utf-8 -*- ''' Manage X509 certificates .. versionadded:: 2015.8.0 :depends: M2Crypto ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function import os import logging import hashlib import glob import random import ctypes import tempfile import re import dateti...
saltstack/salt
salt/modules/x509.py
_get_private_key_obj
python
def _get_private_key_obj(private_key, passphrase=None): ''' Returns a private key object based on PEM text. ''' private_key = _text_or_file(private_key) private_key = get_pem_entry(private_key, pem_type='(?:RSA )?PRIVATE KEY') rsaprivkey = M2Crypto.RSA.load_key_string( private_key, callb...
Returns a private key object based on PEM text.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/x509.py#L370-L380
[ "def get_pem_entry(text, pem_type=None):\n '''\n Returns a properly formatted PEM string from the input text fixing\n any whitespace or line-break issues\n\n text:\n Text containing the X509 PEM entry to be returned or path to\n a file containing the text.\n\n pem_type:\n If spec...
# -*- coding: utf-8 -*- ''' Manage X509 certificates .. versionadded:: 2015.8.0 :depends: M2Crypto ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function import os import logging import hashlib import glob import random import ctypes import tempfile import re import dateti...
saltstack/salt
salt/modules/x509.py
_passphrase_callback
python
def _passphrase_callback(passphrase): ''' Returns a callback function used to supply a passphrase for private keys ''' def f(*args): return salt.utils.stringutils.to_bytes(passphrase) return f
Returns a callback function used to supply a passphrase for private keys
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/x509.py#L383-L389
null
# -*- coding: utf-8 -*- ''' Manage X509 certificates .. versionadded:: 2015.8.0 :depends: M2Crypto ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function import os import logging import hashlib import glob import random import ctypes import tempfile import re import dateti...
saltstack/salt
salt/modules/x509.py
_get_request_obj
python
def _get_request_obj(csr): ''' Returns a CSR object based on PEM text. ''' text = _text_or_file(csr) text = get_pem_entry(text, pem_type='CERTIFICATE REQUEST') return M2Crypto.X509.load_request_string(text)
Returns a CSR object based on PEM text.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/x509.py#L392-L398
[ "def get_pem_entry(text, pem_type=None):\n '''\n Returns a properly formatted PEM string from the input text fixing\n any whitespace or line-break issues\n\n text:\n Text containing the X509 PEM entry to be returned or path to\n a file containing the text.\n\n pem_type:\n If spec...
# -*- coding: utf-8 -*- ''' Manage X509 certificates .. versionadded:: 2015.8.0 :depends: M2Crypto ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function import os import logging import hashlib import glob import random import ctypes import tempfile import re import dateti...
saltstack/salt
salt/modules/x509.py
_get_pubkey_hash
python
def _get_pubkey_hash(cert): ''' Returns the sha1 hash of the modulus of a public key in a cert Used for generating subject key identifiers ''' sha_hash = hashlib.sha1(cert.get_pubkey().get_modulus()).hexdigest() return _pretty_hex(sha_hash)
Returns the sha1 hash of the modulus of a public key in a cert Used for generating subject key identifiers
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/x509.py#L401-L407
null
# -*- coding: utf-8 -*- ''' Manage X509 certificates .. versionadded:: 2015.8.0 :depends: M2Crypto ''' # Import python libs from __future__ import absolute_import, unicode_literals, print_function import os import logging import hashlib import glob import random import ctypes import tempfile import re import dateti...