repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
saltstack/salt | salt/modules/virt.py | setvcpus | 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... | 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... | [
"def",
"setvcpus",
"(",
"vm_",
",",
"vcpus",
",",
"config",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"dom",
"=",
"_get_domain",
"(",
"conn",
",",
"vm_",
")",
"if",
"VIRT_STATE_NAME_MAP"... | 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 ... | [
"Changes",
"the",
"amount",
"of",
"vcpus",
"allocated",
"to",
"VM",
".",
"The",
"VM",
"must",
"be",
"shutdown",
"for",
"this",
"to",
"work",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2476-L2519 | train |
saltstack/salt | salt/modules/virt.py | _freemem | 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
... | 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
... | [
"def",
"_freemem",
"(",
"conn",
")",
":",
"mem",
"=",
"conn",
".",
"getInfo",
"(",
")",
"[",
"1",
"]",
"# Take off just enough to sustain the hypervisor",
"mem",
"-=",
"256",
"for",
"dom",
"in",
"_get_domain",
"(",
"conn",
",",
"iterable",
"=",
"True",
")"... | Internal variant of freemem taking a libvirt connection as parameter | [
"Internal",
"variant",
"of",
"freemem",
"taking",
"a",
"libvirt",
"connection",
"as",
"parameter"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2522-L2532 | train |
saltstack/salt | salt/modules/virt.py | freemem | 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... | 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... | [
"def",
"freemem",
"(",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"mem",
"=",
"_freemem",
"(",
"conn",
")",
"conn",
".",
"close",
"(",
")",
"return",
"mem"
] | 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.... | [
"Return",
"an",
"int",
"representing",
"the",
"amount",
"of",
"memory",
"(",
"in",
"MB",
")",
"that",
"has",
"not",
"been",
"given",
"to",
"virtual",
"machines",
"on",
"this",
"node"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2535-L2559 | train |
saltstack/salt | salt/modules/virt.py | _freecpu | 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 | 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 | [
"def",
"_freecpu",
"(",
"conn",
")",
":",
"cpus",
"=",
"conn",
".",
"getInfo",
"(",
")",
"[",
"2",
"]",
"for",
"dom",
"in",
"_get_domain",
"(",
"conn",
",",
"iterable",
"=",
"True",
")",
":",
"if",
"dom",
".",
"ID",
"(",
")",
">",
"0",
":",
"... | Internal variant of freecpu taking a libvirt connection as parameter | [
"Internal",
"variant",
"of",
"freecpu",
"taking",
"a",
"libvirt",
"connection",
"as",
"parameter"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2562-L2570 | train |
saltstack/salt | salt/modules/virt.py | freecpu | 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... | 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... | [
"def",
"freecpu",
"(",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"cpus",
"=",
"_freecpu",
"(",
"conn",
")",
"conn",
".",
"close",
"(",
")",
"return",
"cpus"
] | 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... | [
"Return",
"an",
"int",
"representing",
"the",
"number",
"of",
"unallocated",
"cpus",
"on",
"this",
"hypervisor"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2573-L2597 | train |
saltstack/salt | salt/modules/virt.py | full_info | 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... | 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... | [
"def",
"full_info",
"(",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"info",
"=",
"{",
"'freecpu'",
":",
"_freecpu",
"(",
"conn",
")",
",",
"'freemem'",
":",
"_freemem",
"(",
"conn",
")",
",",
"'node_info'",... | 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
... | [
"Return",
"the",
"node_info",
"vm_info",
"and",
"freemem"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2600-L2626 | train |
saltstack/salt | salt/modules/virt.py | get_xml | 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... | 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... | [
"def",
"get_xml",
"(",
"vm_",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"xml_desc",
"=",
"_get_domain",
"(",
"conn",
",",
"vm_",
")",
".",
"XMLDesc",
"(",
"0",
")",
"conn",
".",
"close",
"(",
")",... | 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... | [
"Returns",
"the",
"XML",
"for",
"a",
"given",
"vm"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2629-L2653 | train |
saltstack/salt | salt/modules/virt.py | get_profiles | 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... | 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... | [
"def",
"get_profiles",
"(",
"hypervisor",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"}",
"caps",
"=",
"capabilities",
"(",
"*",
"*",
"kwargs",
")",
"hypervisors",
"=",
"sorted",
"(",
"{",
"x",
"for",
"y",
"in",
"[",
"guest",
... | 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... | [
"Return",
"the",
"virt",
"profiles",
"for",
"hypervisor",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2656-L2711 | train |
saltstack/salt | salt/modules/virt.py | pause | 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... | 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... | [
"def",
"pause",
"(",
"vm_",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"dom",
"=",
"_get_domain",
"(",
"conn",
",",
"vm_",
")",
"ret",
"=",
"dom",
".",
"suspend",
"(",
")",
"==",
"0",
"conn",
"."... | 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... | [
"Pause",
"the",
"named",
"vm"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2742-L2767 | train |
saltstack/salt | salt/modules/virt.py | start | 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... | 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... | [
"def",
"start",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"ret",
"=",
"_get_domain",
"(",
"conn",
",",
"name",
")",
".",
"create",
"(",
")",
"==",
"0",
"conn",
".",
"close",
"(",
")... | 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... | [
"Start",
"a",
"defined",
"domain"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2798-L2822 | train |
saltstack/salt | salt/modules/virt.py | stop | 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
... | 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
... | [
"def",
"stop",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"ret",
"=",
"_get_domain",
"(",
"conn",
",",
"name",
")",
".",
"destroy",
"(",
")",
"==",
"0",
"conn",
".",
"close",
"(",
")... | 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... | [
"Hard",
"power",
"down",
"the",
"virtual",
"machine",
"this",
"is",
"equivalent",
"to",
"pulling",
"the",
"power",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2825-L2849 | train |
saltstack/salt | salt/modules/virt.py | reboot | 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... | 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... | [
"def",
"reboot",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"ret",
"=",
"_get_domain",
"(",
"conn",
",",
"name",
")",
".",
"reboot",
"(",
"libvirt",
".",
"VIR_DOMAIN_REBOOT_DEFAULT",
")",
... | 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... | [
"Reboot",
"a",
"domain",
"via",
"ACPI",
"request"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2852-L2876 | train |
saltstack/salt | salt/modules/virt.py | reset | 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... | 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... | [
"def",
"reset",
"(",
"vm_",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"dom",
"=",
"_get_domain",
"(",
"conn",
",",
"vm_",
")",
"# reset takes a flag, like reboot, but it is not yet used",
"# so we just pass in 0"... | 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... | [
"Reset",
"a",
"VM",
"by",
"emulating",
"the",
"reset",
"button",
"on",
"a",
"physical",
"machine"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2879-L2908 | train |
saltstack/salt | salt/modules/virt.py | ctrl_alt_del | 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... | 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... | [
"def",
"ctrl_alt_del",
"(",
"vm_",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"dom",
"=",
"_get_domain",
"(",
"conn",
",",
"vm_",
")",
"ret",
"=",
"dom",
".",
"sendKey",
"(",
"0",
",",
"0",
",",
... | 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 ... | [
"Sends",
"CTRL",
"+",
"ALT",
"+",
"DEL",
"to",
"a",
"VM"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2911-L2936 | train |
saltstack/salt | salt/modules/virt.py | create_xml_str | 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 ... | 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 ... | [
"def",
"create_xml_str",
"(",
"xml",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=redefined-outer-name",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"ret",
"=",
"conn",
".",
"createXML",
"(",
"xml",
",",
"0",
")",
"is",
"not",
"None... | 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... | [
"Start",
"a",
"transient",
"domain",
"based",
"on",
"the",
"XML",
"passed",
"to",
"the",
"function"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2939-L2963 | train |
saltstack/salt | salt/modules/virt.py | create_xml_path | 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... | 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... | [
"def",
"create_xml_path",
"(",
"path",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"path",
",",
"'r'",
")",
"as",
"fp_",
":",
"return",
"create_xml_str",
"(",
"salt",
".",
"utils",
"... | 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... | [
"Start",
"a",
"transient",
"domain",
"based",
"on",
"the",
"XML",
"-",
"file",
"path",
"passed",
"to",
"the",
"function"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2966-L2994 | train |
saltstack/salt | salt/modules/virt.py | define_xml_str | 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... | 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... | [
"def",
"define_xml_str",
"(",
"xml",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=redefined-outer-name",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"ret",
"=",
"conn",
".",
"defineXML",
"(",
"xml",
")",
"is",
"not",
"None",
"conn",
... | 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... | [
"Define",
"a",
"persistent",
"domain",
"based",
"on",
"the",
"XML",
"passed",
"to",
"the",
"function"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2997-L3021 | train |
saltstack/salt | salt/modules/virt.py | define_xml_path | 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... | 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... | [
"def",
"define_xml_path",
"(",
"path",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"path",
",",
"'r'",
")",
"as",
"fp_",
":",
"return",
"define_xml_str",
"(",
"salt",
".",
"utils",
"... | 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... | [
"Define",
"a",
"persistent",
"domain",
"based",
"on",
"the",
"XML",
"-",
"file",
"path",
"passed",
"to",
"the",
"function"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3024-L3053 | train |
saltstack/salt | salt/modules/virt.py | define_vol_xml_str | 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... | 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... | [
"def",
"define_vol_xml_str",
"(",
"xml",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=redefined-outer-name",
"poolname",
"=",
"__salt__",
"[",
"'config.get'",
"]",
"(",
"'libvirt:storagepool'",
",",
"None",
")",
"if",
"poolname",
"is",
"not",
"None",
":... | 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.... | [
"Define",
"a",
"volume",
"based",
"on",
"the",
"XML",
"passed",
"to",
"the",
"function"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3056-L3100 | train |
saltstack/salt | salt/modules/virt.py | define_vol_xml_path | 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... | 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... | [
"def",
"define_vol_xml_path",
"(",
"path",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"path",
",",
"'r'",
")",
"as",
"fp_",
":",
"return",
"define_vol_xml_str",
"(",
"salt",
".",
"uti... | 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... | [
"Define",
"a",
"volume",
"based",
"on",
"the",
"XML",
"-",
"file",
"path",
"passed",
"to",
"the",
"function"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3103-L3132 | train |
saltstack/salt | salt/modules/virt.py | migrate_non_shared | 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... | 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... | [
"def",
"migrate_non_shared",
"(",
"vm_",
",",
"target",
",",
"ssh",
"=",
"False",
")",
":",
"cmd",
"=",
"_get_migrate_command",
"(",
")",
"+",
"' --copy-storage-all '",
"+",
"vm_",
"+",
"_get_target",
"(",
"target",
",",
"ssh",
")",
"stdout",
"=",
"subproc... | 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 ... | [
"Attempt",
"to",
"execute",
"non",
"-",
"shared",
"storage",
"all",
"migration"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3135-L3166 | train |
saltstack/salt | salt/modules/virt.py | seed_non_shared_migrate | 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... | 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... | [
"def",
"seed_non_shared_migrate",
"(",
"disks",
",",
"force",
"=",
"False",
")",
":",
"for",
"_",
",",
"data",
"in",
"six",
".",
"iteritems",
"(",
"disks",
")",
":",
"fn_",
"=",
"data",
"[",
"'file'",
"]",
"form",
"=",
"data",
"[",
"'file format'",
"... | 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... | [
"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",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3237-L3274 | train |
saltstack/salt | salt/modules/virt.py | set_autostart | 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... | 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... | [
"def",
"set_autostart",
"(",
"vm_",
",",
"state",
"=",
"'on'",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"dom",
"=",
"_get_domain",
"(",
"conn",
",",
"vm_",
")",
"# return False if state is set to something... | 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... | [
"Set",
"the",
"autostart",
"flag",
"on",
"a",
"VM",
"so",
"that",
"the",
"VM",
"will",
"start",
"with",
"the",
"host",
"system",
"on",
"reboot",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3277-L3314 | train |
saltstack/salt | salt/modules/virt.py | undefine | 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... | 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... | [
"def",
"undefine",
"(",
"vm_",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"dom",
"=",
"_get_domain",
"(",
"conn",
",",
"vm_",
")",
"if",
"getattr",
"(",
"libvirt",
",",
"'VIR_DOMAIN_UNDEFINE_NVRAM'",
","... | 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
... | [
"Remove",
"a",
"defined",
"vm",
"this",
"does",
"not",
"purge",
"the",
"virtual",
"machine",
"image",
"and",
"this",
"only",
"works",
"if",
"the",
"vm",
"is",
"powered",
"down"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3317-L3347 | train |
saltstack/salt | salt/modules/virt.py | purge | 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 ... | 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 ... | [
"def",
"purge",
"(",
"vm_",
",",
"dirs",
"=",
"False",
",",
"removables",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"dom",
"=",
"_get_domain",
"(",
"conn",
",",
"vm_",
")",
"disks",
"... | 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... | [
"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",
"CA... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3350-L3421 | train |
saltstack/salt | salt/modules/virt.py | _is_kvm_hyper | 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... | 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... | [
"def",
"_is_kvm_hyper",
"(",
")",
":",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"'/proc/modules'",
")",
"as",
"fp_",
":",
"if",
"'kvm_'",
"not",
"in",
"salt",
".",
"utils",
".",
"stringutils",
".",
"to_unicode",
"(",
... | Returns a bool whether or not this node is a KVM hypervisor | [
"Returns",
"a",
"bool",
"whether",
"or",
"not",
"this",
"node",
"is",
"a",
"KVM",
"hypervisor"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3437-L3448 | train |
saltstack/salt | salt/modules/virt.py | get_hypervisor | 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... | 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... | [
"def",
"get_hypervisor",
"(",
")",
":",
"# To add a new 'foo' hypervisor, add the _is_foo_hyper function,",
"# add 'foo' to the list below and add it to the docstring with a .. versionadded::",
"hypervisors",
"=",
"[",
"'kvm'",
",",
"'xen'",
",",
"'bhyve'",
"]",
"result",
"=",
"[... | 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... | [
"Returns",
"the",
"name",
"of",
"the",
"hypervisor",
"running",
"on",
"this",
"node",
"or",
"None",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3511-L3534 | train |
saltstack/salt | salt/modules/virt.py | _is_bhyve_hyper | 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... | 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... | [
"def",
"_is_bhyve_hyper",
"(",
")",
":",
"sysctl_cmd",
"=",
"'sysctl hw.vmm.create'",
"vmm_enabled",
"=",
"False",
"try",
":",
"stdout",
"=",
"subprocess",
".",
"Popen",
"(",
"sysctl_cmd",
",",
"shell",
"=",
"True",
",",
"stdout",
"=",
"subprocess",
".",
"PI... | Returns a bool whether or not this node is a bhyve hypervisor | [
"Returns",
"a",
"bool",
"whether",
"or",
"not",
"this",
"node",
"is",
"a",
"bhyve",
"hypervisor"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3537-L3550 | train |
saltstack/salt | salt/modules/virt.py | vm_cputime | 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
... | 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
... | [
"def",
"vm_cputime",
"(",
"vm_",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"host_cpus",
"=",
"conn",
".",
"getInfo",
"(",
")",
"[",
"2",
"]",
"def",
"_info",
"(",
"dom",
")",
":",
"... | 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... | [
"Return",
"cputime",
"used",
"by",
"the",
"vms",
"on",
"this",
"hyper",
"in",
"a",
"list",
"of",
"dicts",
":"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3568-L3628 | train |
saltstack/salt | salt/modules/virt.py | vm_netstats | 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... | 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... | [
"def",
"vm_netstats",
"(",
"vm_",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"_info",
"(",
"dom",
")",
":",
"'''\n Compute network stats of a domain\n '''",
"nics",
"=",
"_get_nics",
"(",
"dom",
")",
"ret",
"=",
"{",
"'rx_bytes'",
"... | 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.... | [
"Return",
"combined",
"network",
"counters",
"used",
"by",
"the",
"vms",
"on",
"this",
"hyper",
"in",
"a",
"list",
"of",
"dicts",
":"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3631-L3709 | train |
saltstack/salt | salt/modules/virt.py | vm_diskstats | 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... | 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... | [
"def",
"vm_diskstats",
"(",
"vm_",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"get_disk_devs",
"(",
"dom",
")",
":",
"'''\n Extract the disk devices names from the domain XML definition\n '''",
"doc",
"=",
"ElementTree",
".",
"fromstring",
"(... | 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
... | [
"Return",
"disk",
"usage",
"counters",
"used",
"by",
"the",
"vms",
"on",
"this",
"hyper",
"in",
"a",
"list",
"of",
"dicts",
":"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3712-L3788 | train |
saltstack/salt | salt/modules/virt.py | _parse_snapshot_description | 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... | 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... | [
"def",
"_parse_snapshot_description",
"(",
"vm_snapshot",
",",
"unix_time",
"=",
"False",
")",
":",
"ret",
"=",
"dict",
"(",
")",
"tree",
"=",
"ElementTree",
".",
"fromstring",
"(",
"vm_snapshot",
".",
"getXMLDesc",
"(",
")",
")",
"for",
"node",
"in",
"tre... | Parse XML doc and return a dict with the status values.
:param xmldoc:
:return: | [
"Parse",
"XML",
"doc",
"and",
"return",
"a",
"dict",
"with",
"the",
"status",
"values",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3791-L3811 | train |
saltstack/salt | salt/modules/virt.py | list_snapshots | 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
..... | 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
..... | [
"def",
"list_snapshots",
"(",
"domain",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"dict",
"(",
")",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"for",
"vm_domain",
"in",
"_get_domain",
"(",
"conn",
",",
"*",
"(",
"dom... | 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 ... | [
"List",
"available",
"snapshots",
"for",
"certain",
"vm",
"or",
"for",
"all",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3814-L3844 | train |
saltstack/salt | salt/modules/virt.py | snapshot | 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... | 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... | [
"def",
"snapshot",
"(",
"domain",
",",
"name",
"=",
"None",
",",
"suffix",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"name",
"and",
"name",
".",
"lower",
"(",
")",
"==",
"domain",
".",
"lower",
"(",
")",
":",
"raise",
"CommandExecutionE... | 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... | [
"Create",
"a",
"snapshot",
"of",
"a",
"VM",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3847-L3894 | train |
saltstack/salt | salt/modules/virt.py | delete_snapshots | 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... | 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... | [
"def",
"delete_snapshots",
"(",
"name",
",",
"*",
"names",
",",
"*",
"*",
"kwargs",
")",
":",
"deleted",
"=",
"dict",
"(",
")",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"domain",
"=",
"_get_domain",
"(",
"conn",
",",
"name",
")",
"f... | 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... | [
"Delete",
"one",
"or",
"more",
"snapshots",
"of",
"the",
"given",
"VM",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3897-L3934 | train |
saltstack/salt | salt/modules/virt.py | revert_snapshot | 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... | 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... | [
"def",
"revert_snapshot",
"(",
"name",
",",
"vm_snapshot",
"=",
"None",
",",
"cleanup",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"dict",
"(",
")",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"domain",
"=",
"_get_domai... | 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... | [
"Revert",
"snapshot",
"to",
"the",
"previous",
"from",
"current",
"(",
"if",
"available",
")",
"or",
"to",
"the",
"specific",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L3937-L4016 | train |
saltstack/salt | salt/modules/virt.py | _caps_add_machine | 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
... | 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
... | [
"def",
"_caps_add_machine",
"(",
"machines",
",",
"node",
")",
":",
"maxcpus",
"=",
"node",
".",
"get",
"(",
"'maxCpus'",
")",
"canonical",
"=",
"node",
".",
"get",
"(",
"'canonical'",
")",
"name",
"=",
"node",
".",
"text",
"alternate_name",
"=",
"\"\"",... | Parse the <machine> element of the host capabilities and add it
to the machines list. | [
"Parse",
"the",
"<machine",
">",
"element",
"of",
"the",
"host",
"capabilities",
"and",
"add",
"it",
"to",
"the",
"machines",
"list",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4019-L4040 | train |
saltstack/salt | salt/modules/virt.py | _parse_caps_guest | 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': ... | 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': ... | [
"def",
"_parse_caps_guest",
"(",
"guest",
")",
":",
"arch_node",
"=",
"guest",
".",
"find",
"(",
"'arch'",
")",
"result",
"=",
"{",
"'os_type'",
":",
"guest",
".",
"find",
"(",
"'os_type'",
")",
".",
"text",
",",
"'arch'",
":",
"{",
"'name'",
":",
"a... | Parse the <guest> element of the connection capabilities XML | [
"Parse",
"the",
"<guest",
">",
"element",
"of",
"the",
"connection",
"capabilities",
"XML"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4043-L4087 | train |
saltstack/salt | salt/modules/virt.py | _parse_caps_cell | 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... | 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... | [
"def",
"_parse_caps_cell",
"(",
"cell",
")",
":",
"result",
"=",
"{",
"'id'",
":",
"int",
"(",
"cell",
".",
"get",
"(",
"'id'",
")",
")",
"}",
"mem_node",
"=",
"cell",
".",
"find",
"(",
"'memory'",
")",
"if",
"mem_node",
"is",
"not",
"None",
":",
... | Parse the <cell> nodes of the connection capabilities XML output. | [
"Parse",
"the",
"<cell",
">",
"nodes",
"of",
"the",
"connection",
"capabilities",
"XML",
"output",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4090-L4134 | train |
saltstack/salt | salt/modules/virt.py | _parse_caps_bank | 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... | 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... | [
"def",
"_parse_caps_bank",
"(",
"bank",
")",
":",
"result",
"=",
"{",
"'id'",
":",
"int",
"(",
"bank",
".",
"get",
"(",
"'id'",
")",
")",
",",
"'level'",
":",
"int",
"(",
"bank",
".",
"get",
"(",
"'level'",
")",
")",
",",
"'type'",
":",
"bank",
... | Parse the <bank> element of the connection capabilities XML. | [
"Parse",
"the",
"<bank",
">",
"element",
"of",
"the",
"connection",
"capabilities",
"XML",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4137-L4165 | train |
saltstack/salt | salt/modules/virt.py | _parse_caps_host | 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... | 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... | [
"def",
"_parse_caps_host",
"(",
"host",
")",
":",
"result",
"=",
"{",
"}",
"for",
"child",
"in",
"host",
":",
"if",
"child",
".",
"tag",
"==",
"'uuid'",
":",
"result",
"[",
"'uuid'",
"]",
"=",
"child",
".",
"text",
"elif",
"child",
".",
"tag",
"=="... | Parse the <host> element of the connection capabilities XML. | [
"Parse",
"the",
"<host",
">",
"element",
"of",
"the",
"connection",
"capabilities",
"XML",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4168-L4226 | train |
saltstack/salt | salt/modules/virt.py | capabilities | 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... | 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... | [
"def",
"capabilities",
"(",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"caps",
"=",
"ElementTree",
".",
"fromstring",
"(",
"conn",
".",
"getCapabilities",
"(",
")",
")",
"conn",
".",
"close",
"(",
")",
"ret... | 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:: ... | [
"Return",
"the",
"hypervisor",
"connection",
"capabilities",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4229-L4252 | train |
saltstack/salt | salt/modules/virt.py | _parse_caps_cpu | 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... | 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... | [
"def",
"_parse_caps_cpu",
"(",
"node",
")",
":",
"result",
"=",
"{",
"}",
"for",
"mode",
"in",
"node",
".",
"findall",
"(",
"'mode'",
")",
":",
"if",
"not",
"mode",
".",
"get",
"(",
"'supported'",
")",
"==",
"'yes'",
":",
"continue",
"name",
"=",
"... | Parse the <cpu> element of the domain capabilities | [
"Parse",
"the",
"<cpu",
">",
"element",
"of",
"the",
"domain",
"capabilities"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4262-L4309 | train |
saltstack/salt | salt/modules/virt.py | _parse_caps_devices_features | 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... | 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... | [
"def",
"_parse_caps_devices_features",
"(",
"node",
")",
":",
"result",
"=",
"{",
"}",
"for",
"child",
"in",
"node",
":",
"if",
"child",
".",
"get",
"(",
"'supported'",
")",
"==",
"'yes'",
":",
"enums",
"=",
"[",
"_parse_caps_enum",
"(",
"node",
")",
"... | Parse the devices or features list of the domain capatilities | [
"Parse",
"the",
"devices",
"or",
"features",
"list",
"of",
"the",
"domain",
"capatilities"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4312-L4321 | train |
saltstack/salt | salt/modules/virt.py | _parse_caps_loader | 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:
... | 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:
... | [
"def",
"_parse_caps_loader",
"(",
"node",
")",
":",
"enums",
"=",
"[",
"_parse_caps_enum",
"(",
"enum",
")",
"for",
"enum",
"in",
"node",
".",
"findall",
"(",
"'enum'",
")",
"]",
"result",
"=",
"{",
"item",
"[",
"0",
"]",
":",
"item",
"[",
"1",
"]"... | Parse the <loader> element of the domain capabilities. | [
"Parse",
"the",
"<loader",
">",
"element",
"of",
"the",
"domain",
"capabilities",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4324-L4336 | train |
saltstack/salt | salt/modules/virt.py | _parse_domain_caps | 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... | 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... | [
"def",
"_parse_domain_caps",
"(",
"caps",
")",
":",
"result",
"=",
"{",
"'emulator'",
":",
"caps",
".",
"find",
"(",
"'path'",
")",
".",
"text",
"if",
"caps",
".",
"find",
"(",
"'path'",
")",
"is",
"not",
"None",
"else",
"None",
",",
"'domain'",
":",... | 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... | [
"Parse",
"the",
"XML",
"document",
"of",
"domain",
"capabilities",
"into",
"a",
"structure",
".",
"Return",
"the",
"domain",
"capabilities",
"given",
"an",
"emulator",
"architecture",
"machine",
"or",
"virtualization",
"type",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4339-L4402 | train |
saltstack/salt | salt/modules/virt.py | domain_capabilities | 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:... | 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:... | [
"def",
"domain_capabilities",
"(",
"emulator",
"=",
"None",
",",
"arch",
"=",
"None",
",",
"machine",
"=",
"None",
",",
"domain",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"result",
"=",
... | 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 ... | [
"Return",
"the",
"domain",
"capabilities",
"given",
"an",
"emulator",
"architecture",
"machine",
"or",
"virtualization",
"type",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4405-L4439 | train |
saltstack/salt | salt/modules/virt.py | all_capabilities | 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... | 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... | [
"def",
"all_capabilities",
"(",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"result",
"=",
"{",
"}",
"try",
":",
"host_caps",
"=",
"ElementTree",
".",
"fromstring",
"(",
"conn",
".",
"getCapabilities",
"(",
")... | 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... | [
"Return",
"the",
"host",
"and",
"domain",
"capabilities",
"in",
"a",
"single",
"call",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4442-L4478 | train |
saltstack/salt | salt/modules/virt.py | cpu_baseline | 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... | 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... | [
"def",
"cpu_baseline",
"(",
"full",
"=",
"False",
",",
"migratable",
"=",
"False",
",",
"out",
"=",
"'libvirt'",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"caps",
"=",
"ElementTree",
".",
"fromstring",
... | 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... | [
"Return",
"the",
"optimal",
"custom",
"CPU",
"baseline",
"config",
"for",
"VM",
"s",
"on",
"this",
"minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4481-L4562 | train |
saltstack/salt | salt/modules/virt.py | network_define | 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)
... | 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)
... | [
"def",
"network_define",
"(",
"name",
",",
"bridge",
",",
"forward",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"vport",
"=",
"kwargs",
".",
"get",
"(",
"'vport'",
",",
"None",
")",
"tag",
"=",
"kwar... | 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... | [
"Create",
"libvirt",
"network",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4565-L4628 | train |
saltstack/salt | salt/modules/virt.py | list_networks | 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:
... | 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:
... | [
"def",
"list_networks",
"(",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"try",
":",
"return",
"[",
"net",
".",
"name",
"(",
")",
"for",
"net",
"in",
"conn",
".",
"listAllNetworks",
"(",
")",
"]",
"finally... | 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 '*... | [
"List",
"all",
"virtual",
"networks",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4631-L4651 | train |
saltstack/salt | salt/modules/virt.py | network_info | 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... | 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... | [
"def",
"network_info",
"(",
"name",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"result",
"=",
"{",
"}",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"def",
"_net_get_leases",
"(",
"net",
")",
":",
"'''\n Get all DHCP leases for a ne... | 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... | [
"Return",
"informations",
"on",
"a",
"virtual",
"network",
"provided",
"its",
"name",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4654-L4703 | train |
saltstack/salt | salt/modules/virt.py | network_start | 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
... | 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
... | [
"def",
"network_start",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"try",
":",
"net",
"=",
"conn",
".",
"networkLookupByName",
"(",
"name",
")",
"return",
"not",
"bool",
"(",
"net",
".",
... | 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... | [
"Start",
"a",
"defined",
"virtual",
"network",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4706-L4728 | train |
saltstack/salt | salt/modules/virt.py | network_stop | 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
... | 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
... | [
"def",
"network_stop",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"try",
":",
"net",
"=",
"conn",
".",
"networkLookupByName",
"(",
"name",
")",
"return",
"not",
"bool",
"(",
"net",
".",
... | 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... | [
"Stop",
"a",
"defined",
"virtual",
"network",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4731-L4753 | train |
saltstack/salt | salt/modules/virt.py | network_undefine | 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... | 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... | [
"def",
"network_undefine",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"try",
":",
"net",
"=",
"conn",
".",
"networkLookupByName",
"(",
"name",
")",
"return",
"not",
"bool",
"(",
"net",
"."... | 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
.... | [
"Remove",
"a",
"defined",
"virtual",
"network",
".",
"This",
"does",
"not",
"stop",
"the",
"virtual",
"network",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4756-L4778 | train |
saltstack/salt | salt/modules/virt.py | network_set_autostart | 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... | 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... | [
"def",
"network_set_autostart",
"(",
"name",
",",
"state",
"=",
"'on'",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"try",
":",
"net",
"=",
"conn",
".",
"networkLookupByName",
"(",
"name",
")",
"return",
... | 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:... | [
"Set",
"the",
"autostart",
"flag",
"on",
"a",
"virtual",
"network",
"so",
"that",
"the",
"network",
"will",
"start",
"with",
"the",
"host",
"system",
"on",
"reboot",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4781-L4806 | train |
saltstack/salt | salt/modules/virt.py | pool_define | 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,
... | 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,
... | [
"def",
"pool_define",
"(",
"name",
",",
"ptype",
",",
"target",
"=",
"None",
",",
"permissions",
"=",
"None",
",",
"source_devices",
"=",
"None",
",",
"source_dir",
"=",
"None",
",",
"source_adapter",
"=",
"None",
",",
"source_hosts",
"=",
"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
... | [
"Create",
"libvirt",
"pool",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4809-L4979 | train |
saltstack/salt | salt/modules/virt.py | list_pools | 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:
.... | 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:
.... | [
"def",
"list_pools",
"(",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"try",
":",
"return",
"[",
"pool",
".",
"name",
"(",
")",
"for",
"pool",
"in",
"conn",
".",
"listAllStoragePools",
"(",
")",
"]",
"fina... | 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 '*' ... | [
"List",
"all",
"storage",
"pools",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L4982-L5002 | train |
saltstack/salt | salt/modules/virt.py | pool_info | 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... | 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... | [
"def",
"pool_info",
"(",
"name",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"result",
"=",
"{",
"}",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"def",
"_pool_extract_infos",
"(",
"pool",
")",
":",
"'''\n Format the pool info dicti... | 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... | [
"Return",
"informations",
"on",
"a",
"storage",
"pool",
"provided",
"its",
"name",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L5005-L5057 | train |
saltstack/salt | salt/modules/virt.py | pool_start | 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... | 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... | [
"def",
"pool_start",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"try",
":",
"pool",
"=",
"conn",
".",
"storagePoolLookupByName",
"(",
"name",
")",
"return",
"not",
"bool",
"(",
"pool",
"."... | 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
... | [
"Start",
"a",
"defined",
"libvirt",
"storage",
"pool",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L5060-L5082 | train |
saltstack/salt | salt/modules/virt.py | pool_build | 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... | 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... | [
"def",
"pool_build",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"try",
":",
"pool",
"=",
"conn",
".",
"storagePoolLookupByName",
"(",
"name",
")",
"return",
"not",
"bool",
"(",
"pool",
"."... | 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
... | [
"Build",
"a",
"defined",
"libvirt",
"storage",
"pool",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L5085-L5107 | train |
saltstack/salt | salt/modules/virt.py | pool_stop | 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... | 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... | [
"def",
"pool_stop",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"try",
":",
"pool",
"=",
"conn",
".",
"storagePoolLookupByName",
"(",
"name",
")",
"return",
"not",
"bool",
"(",
"pool",
".",... | 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... | [
"Stop",
"a",
"defined",
"libvirt",
"storage",
"pool",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L5110-L5132 | train |
saltstack/salt | salt/modules/virt.py | pool_undefine | 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 ... | 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 ... | [
"def",
"pool_undefine",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"try",
":",
"pool",
"=",
"conn",
".",
"storagePoolLookupByName",
"(",
"name",
")",
"return",
"not",
"bool",
"(",
"pool",
... | 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 ... | [
"Remove",
"a",
"defined",
"libvirt",
"storage",
"pool",
".",
"The",
"pool",
"needs",
"to",
"be",
"stopped",
"before",
"calling",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L5135-L5157 | train |
saltstack/salt | salt/modules/virt.py | pool_delete | 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... | 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... | [
"def",
"pool_delete",
"(",
"name",
",",
"fast",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"try",
":",
"pool",
"=",
"conn",
".",
"storagePoolLookupByName",
"(",
"name",
")",
"flags",
"=",
... | 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... | [
"Delete",
"the",
"resources",
"of",
"a",
"defined",
"libvirt",
"storage",
"pool",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L5160-L5187 | train |
saltstack/salt | salt/modules/virt.py | pool_refresh | 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... | 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... | [
"def",
"pool_refresh",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"try",
":",
"pool",
"=",
"conn",
".",
"storagePoolLookupByName",
"(",
"name",
")",
"return",
"not",
"bool",
"(",
"pool",
"... | 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
... | [
"Refresh",
"a",
"defined",
"libvirt",
"storage",
"pool",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L5190-L5212 | train |
saltstack/salt | salt/modules/virt.py | pool_set_autostart | 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
... | 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
... | [
"def",
"pool_set_autostart",
"(",
"name",
",",
"state",
"=",
"'on'",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"try",
":",
"pool",
"=",
"conn",
".",
"storagePoolLookupByName",
"(",
"name",
")",
"return"... | 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... | [
"Set",
"the",
"autostart",
"flag",
"on",
"a",
"libvirt",
"storage",
"pool",
"so",
"that",
"the",
"storage",
"pool",
"will",
"start",
"with",
"the",
"host",
"system",
"on",
"reboot",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L5215-L5240 | train |
saltstack/salt | salt/modules/virt.py | pool_list_volumes | 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... | 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... | [
"def",
"pool_list_volumes",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"try",
":",
"pool",
"=",
"conn",
".",
"storagePoolLookupByName",
"(",
"name",
")",
"return",
"pool",
".",
"listVolumes",
... | 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... | [
"List",
"the",
"volumes",
"contained",
"in",
"a",
"defined",
"libvirt",
"storage",
"pool",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L5243-L5265 | train |
saltstack/salt | salt/modules/virt.py | _get_storage_vol | 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) | 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) | [
"def",
"_get_storage_vol",
"(",
"conn",
",",
"pool",
",",
"vol",
")",
":",
"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. | [
"Helper",
"function",
"getting",
"a",
"storage",
"volume",
".",
"Will",
"throw",
"a",
"libvirtError",
"if",
"the",
"pool",
"or",
"the",
"volume",
"couldn",
"t",
"be",
"found",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L5268-L5274 | train |
saltstack/salt | salt/modules/virt.py | _get_all_volumes_paths | 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... | 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... | [
"def",
"_get_all_volumes_paths",
"(",
"conn",
")",
":",
"volumes",
"=",
"[",
"vol",
"for",
"l",
"in",
"[",
"obj",
".",
"listAllVolumes",
"(",
")",
"for",
"obj",
"in",
"conn",
".",
"listAllStoragePools",
"(",
")",
"]",
"for",
"vol",
"in",
"l",
"]",
"r... | Extract the path and backing stores path of all volumes.
:param conn: libvirt connection to use | [
"Extract",
"the",
"path",
"and",
"backing",
"stores",
"path",
"of",
"all",
"volumes",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L5290-L5298 | train |
saltstack/salt | salt/modules/virt.py | volume_infos | 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 ... | 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 ... | [
"def",
"volume_infos",
"(",
"pool",
"=",
"None",
",",
"volume",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"result",
"=",
"{",
"}",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"try",
":",
"backing_stores",
"=",
"_get_all_volumes_paths... | 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... | [
"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",
"in... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L5301-L5367 | train |
saltstack/salt | salt/modules/virt.py | volume_delete | 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... | 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... | [
"def",
"volume_delete",
"(",
"pool",
",",
"volume",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__get_conn",
"(",
"*",
"*",
"kwargs",
")",
"try",
":",
"vol",
"=",
"_get_storage_vol",
"(",
"conn",
",",
"pool",
",",
"volume",
")",
"return",
"not",... | 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... | [
"Delete",
"a",
"libvirt",
"managed",
"volume",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L5370-L5393 | train |
saltstack/salt | salt/modules/mdata.py | list_ | 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 {} | 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 {} | [
"def",
"list_",
"(",
")",
":",
"mdata",
"=",
"_check_mdata_list",
"(",
")",
"if",
"mdata",
":",
"cmd",
"=",
"'{0}'",
".",
"format",
"(",
"mdata",
")",
"return",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
",",
"ignore_retcode",
"=",
"True",
")",
"... | List available metadata
CLI Example:
.. code-block:: bash
salt '*' mdata.list | [
"List",
"available",
"metadata"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mdata.py#L81-L95 | train |
saltstack/salt | salt/modules/mdata.py | get_ | 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... | 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... | [
"def",
"get_",
"(",
"*",
"keyname",
")",
":",
"mdata",
"=",
"_check_mdata_get",
"(",
")",
"ret",
"=",
"{",
"}",
"if",
"not",
"keyname",
":",
"keyname",
"=",
"list_",
"(",
")",
"for",
"k",
"in",
"keyname",
":",
"if",
"mdata",
":",
"cmd",
"=",
"'{0... | 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 | [
"Get",
"metadata"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mdata.py#L98-L130 | train |
saltstack/salt | salt/modules/mdata.py | put_ | 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, ... | 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, ... | [
"def",
"put_",
"(",
"keyname",
",",
"val",
")",
":",
"mdata",
"=",
"_check_mdata_put",
"(",
")",
"ret",
"=",
"{",
"}",
"if",
"mdata",
":",
"cmd",
"=",
"'echo {2} | {0} {1}'",
".",
"format",
"(",
"mdata",
",",
"keyname",
",",
"val",
")",
"ret",
"=",
... | Put metadata
prop : string
name of property
val : string
value to set
CLI Example:
.. code-block:: bash
salt '*' mdata.list | [
"Put",
"metadata"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mdata.py#L133-L155 | train |
saltstack/salt | salt/modules/mdata.py | delete_ | 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... | 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... | [
"def",
"delete_",
"(",
"*",
"keyname",
")",
":",
"mdata",
"=",
"_check_mdata_delete",
"(",
")",
"valid_keynames",
"=",
"list_",
"(",
")",
"ret",
"=",
"{",
"}",
"for",
"k",
"in",
"keyname",
":",
"if",
"mdata",
"and",
"k",
"in",
"valid_keynames",
":",
... | Delete metadata
prop : string
name of property
CLI Example:
.. code-block:: bash
salt '*' mdata.get salt:role
salt '*' mdata.get user-script salt:role | [
"Delete",
"metadata"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mdata.py#L158-L183 | train |
saltstack/salt | salt/cloud/clouds/saltify.py | show_instance | 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 | 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 | [
"def",
"show_instance",
"(",
"name",
",",
"call",
"=",
"None",
")",
":",
"local",
"=",
"salt",
".",
"client",
".",
"LocalClient",
"(",
")",
"ret",
"=",
"local",
".",
"cmd",
"(",
"name",
",",
"'grains.items'",
")",
"ret",
".",
"update",
"(",
"_build_r... | List the a single node, return dict of grains. | [
"List",
"the",
"a",
"single",
"node",
"return",
"dict",
"of",
"grains",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/saltify.py#L203-L210 | train |
saltstack/salt | salt/cloud/clouds/saltify.py | create | 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... | 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... | [
"def",
"create",
"(",
"vm_",
")",
":",
"deploy_config",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'deploy'",
",",
"vm_",
",",
"__opts__",
",",
"default",
"=",
"False",
")",
"# If ssh_host is not set, default to the minion name",
"if",
"not",
"config",
".... | 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... | [
"if",
"configuration",
"parameter",
"deploy",
"is",
"True"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/saltify.py#L213-L291 | train |
saltstack/salt | salt/cloud/clouds/saltify.py | _verify | 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', ... | 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', ... | [
"def",
"_verify",
"(",
"vm_",
")",
":",
"log",
".",
"info",
"(",
"'Verifying credentials for %s'",
",",
"vm_",
"[",
"'name'",
"]",
")",
"win_installer",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'win_installer'",
",",
"vm_",
",",
"__opts__",
")",
"... | Verify credentials for an existing system | [
"Verify",
"credentials",
"for",
"an",
"existing",
"system"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/saltify.py#L305-L396 | train |
saltstack/salt | salt/cloud/clouds/saltify.py | destroy | 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... | 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... | [
"def",
"destroy",
"(",
"name",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'function'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The destroy action must be called with -d, --destroy, '",
"'-a, or --action.'",
")",
"opts",
"=",
"__opts__",
"__utils__",
... | 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_... | [
"Destroy",
"a",
"node",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/saltify.py#L399-L485 | train |
saltstack/salt | salt/cloud/clouds/saltify.py | reboot | 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... | 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... | [
"def",
"reboot",
"(",
"name",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"!=",
"'action'",
":",
"raise",
"SaltCloudException",
"(",
"'The reboot action must be called with -a or --action.'",
")",
"local",
"=",
"salt",
".",
"client",
".",
"LocalClient",
"(... | 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 | [
"Reboot",
"a",
"saltify",
"minion",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/saltify.py#L488-L510 | train |
saltstack/salt | salt/states/jenkins.py | present | 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':... | 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':... | [
"def",
"present",
"(",
"name",
",",
"config",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"[",
"'Job {0} is up to date.'... | 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 | [
"Ensure",
"the",
"job",
"is",
"present",
"in",
"the",
"Jenkins",
"configured",
"jobs"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/jenkins.py#L47-L101 | train |
saltstack/salt | salt/states/jenkins.py | absent | 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... | 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... | [
"def",
"absent",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"[",
"]",
"}",
"if",
"__salt__",
"[",
"'jenkins.job_exist... | Ensure the job is absent from the Jenkins configured jobs
name
The name of the Jenkins job to remove | [
"Ensure",
"the",
"job",
"is",
"absent",
"from",
"the",
"Jenkins",
"configured",
"jobs"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/jenkins.py#L104-L126 | train |
saltstack/salt | salt/beacons/salt_proxy.py | _run_proxy_processes | 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... | 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... | [
"def",
"_run_proxy_processes",
"(",
"proxies",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"proxy",
"in",
"proxies",
":",
"result",
"=",
"{",
"}",
"if",
"not",
"__salt__",
"[",
"'salt_proxy.is_running'",
"]",
"(",
"proxy",
")",
"[",
"'result'",
"]",
":",
"_... | Iterate over a list of proxy
names and restart any that
aren't running | [
"Iterate",
"over",
"a",
"list",
"of",
"proxy",
"names",
"and",
"restart",
"any",
"that",
"aren",
"t",
"running"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/salt_proxy.py#L17-L34 | train |
saltstack/salt | salt/beacons/salt_proxy.py | beacon | 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... | 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... | [
"def",
"beacon",
"(",
"config",
")",
":",
"log",
".",
"trace",
"(",
"'salt proxy beacon called'",
")",
"_config",
"=",
"{",
"}",
"list",
"(",
"map",
"(",
"_config",
".",
"update",
",",
"config",
")",
")",
"return",
"_run_proxy_processes",
"(",
"_config",
... | Handle configured proxies
.. code-block:: yaml
beacons:
salt_proxy:
- proxies:
p8000: {}
p8001: {} | [
"Handle",
"configured",
"proxies"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/salt_proxy.py#L60-L77 | train |
saltstack/salt | salt/modules/powerpath.py | list_licenses | 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
... | 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
... | [
"def",
"list_licenses",
"(",
")",
":",
"KEY_PATTERN",
"=",
"re",
".",
"compile",
"(",
"'Key (.*)'",
")",
"keys",
"=",
"[",
"]",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'/sbin/emcpreg -list'",
")",
"for",
"line",
"in",
"out",
".",
"splitlines... | returns a list of applied powerpath license keys | [
"returns",
"a",
"list",
"of",
"applied",
"powerpath",
"license",
"keys"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/powerpath.py#L54-L70 | train |
saltstack/salt | salt/modules/powerpath.py | add_license | 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__[... | 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__[... | [
"def",
"add_license",
"(",
"key",
")",
":",
"result",
"=",
"{",
"'result'",
":",
"False",
",",
"'retcode'",
":",
"-",
"1",
",",
"'output'",
":",
"''",
"}",
"if",
"not",
"has_powerpath",
"(",
")",
":",
"result",
"[",
"'output'",
"]",
"=",
"'PowerPath ... | Add a license | [
"Add",
"a",
"license"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/powerpath.py#L73-L98 | train |
saltstack/salt | salt/states/openvswitch_db.py | managed | 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... | 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... | [
"def",
"managed",
"(",
"name",
",",
"table",
",",
"data",
",",
"record",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
"if",
"recor... | 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, ... | [
"Ensures",
"that",
"the",
"specified",
"columns",
"of",
"the",
"named",
"record",
"have",
"the",
"specified",
"values",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/openvswitch_db.py#L17-L69 | train |
saltstack/salt | salt/modules/x509.py | _fix_ctx | 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 =... | 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 =... | [
"def",
"_fix_ctx",
"(",
"m2_ctx",
",",
"issuer",
"=",
"None",
")",
":",
"ctx",
"=",
"_Ctx",
".",
"from_address",
"(",
"int",
"(",
"m2_ctx",
")",
")",
"# pylint: disable=no-member",
"ctx",
".",
"flags",
"=",
"0",
"ctx",
".",
"subject_cert",
"=",
"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 | [
"This",
"is",
"part",
"of",
"an",
"ugly",
"hack",
"to",
"fix",
"an",
"ancient",
"bug",
"in",
"M2Crypto",
"https",
":",
"//",
"bugzilla",
".",
"osafoundation",
".",
"org",
"/",
"show_bug",
".",
"cgi?id",
"=",
"7530#c13"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/x509.py#L105-L119 | train |
saltstack/salt | salt/modules/x509.py | _new_extension | 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... | 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... | [
"def",
"_new_extension",
"(",
"name",
",",
"value",
",",
"critical",
"=",
"0",
",",
"issuer",
"=",
"None",
",",
"_pyfree",
"=",
"1",
")",
":",
"if",
"name",
"==",
"'subjectKeyIdentifier'",
"and",
"value",
".",
"strip",
"(",
"'0123456789abcdefABCDEF:'",
")"... | Create new X509_Extension, This is required because M2Crypto
doesn't support getting the publickeyidentifier from the issuer
to create the authoritykeyidentifier extension. | [
"Create",
"new",
"X509_Extension",
"This",
"is",
"required",
"because",
"M2Crypto",
"doesn",
"t",
"support",
"getting",
"the",
"publickeyidentifier",
"from",
"the",
"issuer",
"to",
"create",
"the",
"authoritykeyidentifier",
"extension",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/x509.py#L122-L158 | train |
saltstack/salt | salt/modules/x509.py | _parse_openssl_req | 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'
... | 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'
... | [
"def",
"_parse_openssl_req",
"(",
"csr_filename",
")",
":",
"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. | [
"Parses",
"openssl",
"command",
"line",
"output",
"this",
"is",
"a",
"workaround",
"for",
"M2Crypto",
"s",
"inability",
"to",
"get",
"them",
"from",
"CSR",
"objects",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/x509.py#L164-L180 | train |
saltstack/salt | salt/modules/x509.py | _get_csr_extensions | 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... | 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... | [
"def",
"_get_csr_extensions",
"(",
"csr",
")",
":",
"ret",
"=",
"OrderedDict",
"(",
")",
"csrtempfile",
"=",
"tempfile",
".",
"NamedTemporaryFile",
"(",
")",
"csrtempfile",
".",
"write",
"(",
"csr",
".",
"as_pem",
"(",
")",
")",
"csrtempfile",
".",
"flush"... | Returns a list of dicts containing the name, value and critical value of
any extension contained in a csr object. | [
"Returns",
"a",
"list",
"of",
"dicts",
"containing",
"the",
"name",
"value",
"and",
"critical",
"value",
"of",
"any",
"extension",
"contained",
"in",
"a",
"csr",
"object",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/x509.py#L183-L206 | train |
saltstack/salt | salt/modules/x509.py | _parse_openssl_crl | 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'
... | 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'
... | [
"def",
"_parse_openssl_crl",
"(",
"crl_filename",
")",
":",
"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. | [
"Parses",
"openssl",
"command",
"line",
"output",
"this",
"is",
"a",
"workaround",
"for",
"M2Crypto",
"s",
"inability",
"to",
"get",
"them",
"from",
"CSR",
"objects",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/x509.py#L212-L282 | train |
saltstack/salt | salt/modules/x509.py | _pretty_hex | 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() | 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() | [
"def",
"_pretty_hex",
"(",
"hex_str",
")",
":",
"if",
"len",
"(",
"hex_str",
")",
"%",
"2",
"!=",
"0",
":",
"hex_str",
"=",
"'0'",
"+",
"hex_str",
"return",
"':'",
".",
"join",
"(",
"[",
"hex_str",
"[",
"i",
":",
"i",
"+",
"2",
"]",
"for",
"i",... | Nicely formats hex strings | [
"Nicely",
"formats",
"hex",
"strings"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/x509.py#L295-L302 | train |
saltstack/salt | salt/modules/x509.py | _text_or_file | 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... | 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... | [
"def",
"_text_or_file",
"(",
"input_",
")",
":",
"if",
"_isfile",
"(",
"input_",
")",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"input_",
")",
"as",
"fp_",
":",
"out",
"=",
"salt",
".",
"utils",
".",
"stringutils",
".",
"t... | Determines if input is a path to a file, or a string with the
content to be parsed. | [
"Determines",
"if",
"input",
"is",
"a",
"path",
"to",
"a",
"file",
"or",
"a",
"string",
"with",
"the",
"content",
"to",
"be",
"parsed",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/x509.py#L324-L335 | train |
saltstack/salt | salt/modules/x509.py | _parse_subject | 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:
... | 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:
... | [
"def",
"_parse_subject",
"(",
"subject",
")",
":",
"ret",
"=",
"{",
"}",
"nids",
"=",
"[",
"]",
"for",
"nid_name",
",",
"nid_num",
"in",
"six",
".",
"iteritems",
"(",
"subject",
".",
"nid",
")",
":",
"if",
"nid_num",
"in",
"nids",
":",
"continue",
... | Returns a dict containing all values in an X509 Subject | [
"Returns",
"a",
"dict",
"containing",
"all",
"values",
"in",
"an",
"X509",
"Subject"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/x509.py#L338-L355 | train |
saltstack/salt | salt/modules/x509.py | _get_certificate_obj | 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) | 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) | [
"def",
"_get_certificate_obj",
"(",
"cert",
")",
":",
"if",
"isinstance",
"(",
"cert",
",",
"M2Crypto",
".",
"X509",
".",
"X509",
")",
":",
"return",
"cert",
"text",
"=",
"_text_or_file",
"(",
"cert",
")",
"text",
"=",
"get_pem_entry",
"(",
"text",
",",
... | Returns a certificate object based on PEM text. | [
"Returns",
"a",
"certificate",
"object",
"based",
"on",
"PEM",
"text",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/x509.py#L358-L367 | train |
saltstack/salt | salt/modules/x509.py | _get_private_key_obj | 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... | 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... | [
"def",
"_get_private_key_obj",
"(",
"private_key",
",",
"passphrase",
"=",
"None",
")",
":",
"private_key",
"=",
"_text_or_file",
"(",
"private_key",
")",
"private_key",
"=",
"get_pem_entry",
"(",
"private_key",
",",
"pem_type",
"=",
"'(?:RSA )?PRIVATE KEY'",
")",
... | Returns a private key object based on PEM text. | [
"Returns",
"a",
"private",
"key",
"object",
"based",
"on",
"PEM",
"text",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/x509.py#L370-L380 | train |
saltstack/salt | salt/modules/x509.py | _passphrase_callback | 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 | 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 | [
"def",
"_passphrase_callback",
"(",
"passphrase",
")",
":",
"def",
"f",
"(",
"*",
"args",
")",
":",
"return",
"salt",
".",
"utils",
".",
"stringutils",
".",
"to_bytes",
"(",
"passphrase",
")",
"return",
"f"
] | Returns a callback function used to supply a passphrase for private keys | [
"Returns",
"a",
"callback",
"function",
"used",
"to",
"supply",
"a",
"passphrase",
"for",
"private",
"keys"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/x509.py#L383-L389 | train |
saltstack/salt | salt/modules/x509.py | _get_request_obj | 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) | 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) | [
"def",
"_get_request_obj",
"(",
"csr",
")",
":",
"text",
"=",
"_text_or_file",
"(",
"csr",
")",
"text",
"=",
"get_pem_entry",
"(",
"text",
",",
"pem_type",
"=",
"'CERTIFICATE REQUEST'",
")",
"return",
"M2Crypto",
".",
"X509",
".",
"load_request_string",
"(",
... | Returns a CSR object based on PEM text. | [
"Returns",
"a",
"CSR",
"object",
"based",
"on",
"PEM",
"text",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/x509.py#L392-L398 | train |
saltstack/salt | salt/modules/x509.py | _get_pubkey_hash | 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) | 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) | [
"def",
"_get_pubkey_hash",
"(",
"cert",
")",
":",
"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 | [
"Returns",
"the",
"sha1",
"hash",
"of",
"the",
"modulus",
"of",
"a",
"public",
"key",
"in",
"a",
"cert",
"Used",
"for",
"generating",
"subject",
"key",
"identifiers"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/x509.py#L401-L407 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.