repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_capture | def guest_capture(self, userid, image_name, capture_type='rootonly',
compress_level=6):
""" Capture the guest to generate a image
:param userid: (str) the user id of the vm
:param image_name: (str) the unique image name after capture
:param capture_type: (str) the ... | python | def guest_capture(self, userid, image_name, capture_type='rootonly',
compress_level=6):
""" Capture the guest to generate a image
:param userid: (str) the user id of the vm
:param image_name: (str) the unique image name after capture
:param capture_type: (str) the ... | [
"def",
"guest_capture",
"(",
"self",
",",
"userid",
",",
"image_name",
",",
"capture_type",
"=",
"'rootonly'",
",",
"compress_level",
"=",
"6",
")",
":",
"action",
"=",
"(",
"\"capture guest '%(vm)s' to generate image '%(img)s'\"",
"%",
"{",
"'vm'",
":",
"userid",... | Capture the guest to generate a image
:param userid: (str) the user id of the vm
:param image_name: (str) the unique image name after capture
:param capture_type: (str) the type of capture, the value can be:
rootonly: indicate just root device will be captured
alld... | [
"Capture",
"the",
"guest",
"to",
"generate",
"a",
"image"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L359-L377 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_create_nic | def guest_create_nic(self, userid, vdev=None, nic_id=None,
mac_addr=None, active=False):
""" Create the nic for the vm, add NICDEF record into the user direct.
:param str userid: the user id of the vm
:param str vdev: nic device number, 1- to 4- hexadecimal digits
... | python | def guest_create_nic(self, userid, vdev=None, nic_id=None,
mac_addr=None, active=False):
""" Create the nic for the vm, add NICDEF record into the user direct.
:param str userid: the user id of the vm
:param str vdev: nic device number, 1- to 4- hexadecimal digits
... | [
"def",
"guest_create_nic",
"(",
"self",
",",
"userid",
",",
"vdev",
"=",
"None",
",",
"nic_id",
"=",
"None",
",",
"mac_addr",
"=",
"None",
",",
"active",
"=",
"False",
")",
":",
"if",
"mac_addr",
"is",
"not",
"None",
":",
"if",
"not",
"zvmutils",
"."... | Create the nic for the vm, add NICDEF record into the user direct.
:param str userid: the user id of the vm
:param str vdev: nic device number, 1- to 4- hexadecimal digits
:param str nic_id: nic identifier
:param str mac_addr: mac address, it is only be used when changing
... | [
"Create",
"the",
"nic",
"for",
"the",
"vm",
"add",
"NICDEF",
"record",
"into",
"the",
"user",
"direct",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L380-L401 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_delete_nic | def guest_delete_nic(self, userid, vdev, active=False):
""" delete the nic for the vm
:param str userid: the user id of the vm
:param str vdev: nic device number, 1- to 4- hexadecimal digits
:param bool active: whether delete a nic on active guest system
"""
self._networ... | python | def guest_delete_nic(self, userid, vdev, active=False):
""" delete the nic for the vm
:param str userid: the user id of the vm
:param str vdev: nic device number, 1- to 4- hexadecimal digits
:param bool active: whether delete a nic on active guest system
"""
self._networ... | [
"def",
"guest_delete_nic",
"(",
"self",
",",
"userid",
",",
"vdev",
",",
"active",
"=",
"False",
")",
":",
"self",
".",
"_networkops",
".",
"delete_nic",
"(",
"userid",
",",
"vdev",
",",
"active",
"=",
"active",
")"
] | delete the nic for the vm
:param str userid: the user id of the vm
:param str vdev: nic device number, 1- to 4- hexadecimal digits
:param bool active: whether delete a nic on active guest system | [
"delete",
"the",
"nic",
"for",
"the",
"vm"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L404-L411 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_get_definition_info | def guest_get_definition_info(self, userid, **kwargs):
"""Get definition info for the specified guest vm, also could be used
to check specific info.
:param str userid: the user id of the guest vm
:param dict kwargs: Dictionary used to check specific info in user
... | python | def guest_get_definition_info(self, userid, **kwargs):
"""Get definition info for the specified guest vm, also could be used
to check specific info.
:param str userid: the user id of the guest vm
:param dict kwargs: Dictionary used to check specific info in user
... | [
"def",
"guest_get_definition_info",
"(",
"self",
",",
"userid",
",",
"*",
"*",
"kwargs",
")",
":",
"action",
"=",
"\"get the definition info of guest '%s'\"",
"%",
"userid",
"with",
"zvmutils",
".",
"log_and_reraise_sdkbase_error",
"(",
"action",
")",
":",
"return",... | Get definition info for the specified guest vm, also could be used
to check specific info.
:param str userid: the user id of the guest vm
:param dict kwargs: Dictionary used to check specific info in user
direct. Valid keywords for kwargs:
... | [
"Get",
"definition",
"info",
"for",
"the",
"specified",
"guest",
"vm",
"also",
"could",
"be",
"used",
"to",
"check",
"specific",
"info",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L414-L429 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_register | def guest_register(self, userid, meta, net_set):
"""DB operation for migrate vm from another z/VM host in same SSI
:param userid: (str) the userid of the vm to be relocated or tested
:param meta: (str) the metadata of the vm to be relocated or tested
:param net_set: (str) the net_set of ... | python | def guest_register(self, userid, meta, net_set):
"""DB operation for migrate vm from another z/VM host in same SSI
:param userid: (str) the userid of the vm to be relocated or tested
:param meta: (str) the metadata of the vm to be relocated or tested
:param net_set: (str) the net_set of ... | [
"def",
"guest_register",
"(",
"self",
",",
"userid",
",",
"meta",
",",
"net_set",
")",
":",
"userid",
"=",
"userid",
".",
"upper",
"(",
")",
"if",
"not",
"zvmutils",
".",
"check_userid_exist",
"(",
"userid",
")",
":",
"LOG",
".",
"error",
"(",
"\"User ... | DB operation for migrate vm from another z/VM host in same SSI
:param userid: (str) the userid of the vm to be relocated or tested
:param meta: (str) the metadata of the vm to be relocated or tested
:param net_set: (str) the net_set of the vm, default is 1. | [
"DB",
"operation",
"for",
"migrate",
"vm",
"from",
"another",
"z",
"/",
"VM",
"host",
"in",
"same",
"SSI",
":",
"param",
"userid",
":",
"(",
"str",
")",
"the",
"userid",
"of",
"the",
"vm",
"to",
"be",
"relocated",
"or",
"tested",
":",
"param",
"meta"... | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L431-L472 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_live_migrate | def guest_live_migrate(self, userid, dest_zcc_userid, destination,
parms, lgr_action):
"""Move an eligible, running z/VM(R) virtual machine transparently
from one z/VM system to another within an SSI cluster.
:param userid: (str) the userid of the vm to be relocated o... | python | def guest_live_migrate(self, userid, dest_zcc_userid, destination,
parms, lgr_action):
"""Move an eligible, running z/VM(R) virtual machine transparently
from one z/VM system to another within an SSI cluster.
:param userid: (str) the userid of the vm to be relocated o... | [
"def",
"guest_live_migrate",
"(",
"self",
",",
"userid",
",",
"dest_zcc_userid",
",",
"destination",
",",
"parms",
",",
"lgr_action",
")",
":",
"if",
"lgr_action",
".",
"lower",
"(",
")",
"==",
"'move'",
":",
"if",
"dest_zcc_userid",
"==",
"''",
":",
"errm... | Move an eligible, running z/VM(R) virtual machine transparently
from one z/VM system to another within an SSI cluster.
:param userid: (str) the userid of the vm to be relocated or tested
:param dest_zcc_userid: (str) the userid of zcc on destination
:param destination: (str) the system ... | [
"Move",
"an",
"eligible",
"running",
"z",
"/",
"VM",
"(",
"R",
")",
"virtual",
"machine",
"transparently",
"from",
"one",
"z",
"/",
"VM",
"system",
"to",
"another",
"within",
"an",
"SSI",
"cluster",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L475-L539 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_create | def guest_create(self, userid, vcpus, memory, disk_list=None,
user_profile=CONF.zvm.user_profile,
max_cpu=CONF.zvm.user_default_max_cpu,
max_mem=CONF.zvm.user_default_max_memory,
ipl_from='', ipl_param='', ipl_loadparam=''):
"""... | python | def guest_create(self, userid, vcpus, memory, disk_list=None,
user_profile=CONF.zvm.user_profile,
max_cpu=CONF.zvm.user_default_max_cpu,
max_mem=CONF.zvm.user_default_max_memory,
ipl_from='', ipl_param='', ipl_loadparam=''):
"""... | [
"def",
"guest_create",
"(",
"self",
",",
"userid",
",",
"vcpus",
",",
"memory",
",",
"disk_list",
"=",
"None",
",",
"user_profile",
"=",
"CONF",
".",
"zvm",
".",
"user_profile",
",",
"max_cpu",
"=",
"CONF",
".",
"zvm",
".",
"user_default_max_cpu",
",",
"... | create a vm in z/VM
:param userid: (str) the userid of the vm to be created
:param vcpus: (int) amount of vcpus
:param memory: (int) size of memory in MB
:param disk_list: (dict) a list of disks info for the guest.
It has one dictionary that contain some of the below keys... | [
"create",
"a",
"vm",
"in",
"z",
"/",
"VM"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L541-L629 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_live_resize_cpus | def guest_live_resize_cpus(self, userid, cpu_cnt):
"""Live resize virtual cpus of guests.
:param userid: (str) the userid of the guest to be live resized
:param cpu_cnt: (int) The number of virtual cpus that the guest should
have in active state after live resize. The value shoul... | python | def guest_live_resize_cpus(self, userid, cpu_cnt):
"""Live resize virtual cpus of guests.
:param userid: (str) the userid of the guest to be live resized
:param cpu_cnt: (int) The number of virtual cpus that the guest should
have in active state after live resize. The value shoul... | [
"def",
"guest_live_resize_cpus",
"(",
"self",
",",
"userid",
",",
"cpu_cnt",
")",
":",
"action",
"=",
"\"live resize guest '%s' to have '%i' virtual cpus\"",
"%",
"(",
"userid",
",",
"cpu_cnt",
")",
"LOG",
".",
"info",
"(",
"\"Begin to %s\"",
"%",
"action",
")",
... | Live resize virtual cpus of guests.
:param userid: (str) the userid of the guest to be live resized
:param cpu_cnt: (int) The number of virtual cpus that the guest should
have in active state after live resize. The value should be an
integer between 1 and 64. | [
"Live",
"resize",
"virtual",
"cpus",
"of",
"guests",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L632-L646 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_resize_cpus | def guest_resize_cpus(self, userid, cpu_cnt):
"""Resize virtual cpus of guests.
:param userid: (str) the userid of the guest to be resized
:param cpu_cnt: (int) The number of virtual cpus that the guest should
have defined in user directory after resize. The value should
... | python | def guest_resize_cpus(self, userid, cpu_cnt):
"""Resize virtual cpus of guests.
:param userid: (str) the userid of the guest to be resized
:param cpu_cnt: (int) The number of virtual cpus that the guest should
have defined in user directory after resize. The value should
... | [
"def",
"guest_resize_cpus",
"(",
"self",
",",
"userid",
",",
"cpu_cnt",
")",
":",
"action",
"=",
"\"resize guest '%s' to have '%i' virtual cpus\"",
"%",
"(",
"userid",
",",
"cpu_cnt",
")",
"LOG",
".",
"info",
"(",
"\"Begin to %s\"",
"%",
"action",
")",
"with",
... | Resize virtual cpus of guests.
:param userid: (str) the userid of the guest to be resized
:param cpu_cnt: (int) The number of virtual cpus that the guest should
have defined in user directory after resize. The value should
be an integer between 1 and 64. | [
"Resize",
"virtual",
"cpus",
"of",
"guests",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L649-L663 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_live_resize_mem | def guest_live_resize_mem(self, userid, size):
"""Live resize memory of guests.
:param userid: (str) the userid of the guest to be live resized
:param size: (str) The memory size that the guest should have
in available status after live resize.
The value should be ... | python | def guest_live_resize_mem(self, userid, size):
"""Live resize memory of guests.
:param userid: (str) the userid of the guest to be live resized
:param size: (str) The memory size that the guest should have
in available status after live resize.
The value should be ... | [
"def",
"guest_live_resize_mem",
"(",
"self",
",",
"userid",
",",
"size",
")",
":",
"action",
"=",
"\"live resize guest '%s' to have '%s' memory\"",
"%",
"(",
"userid",
",",
"size",
")",
"LOG",
".",
"info",
"(",
"\"Begin to %s\"",
"%",
"action",
")",
"with",
"z... | Live resize memory of guests.
:param userid: (str) the userid of the guest to be live resized
:param size: (str) The memory size that the guest should have
in available status after live resize.
The value should be specified by 1-4 bits of number suffixed by
... | [
"Live",
"resize",
"memory",
"of",
"guests",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L666-L682 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_resize_mem | def guest_resize_mem(self, userid, size):
"""Resize memory of guests.
:param userid: (str) the userid of the guest to be resized
:param size: (str) The memory size that the guest should have
defined in user directory after resize.
The value should be specified by 1... | python | def guest_resize_mem(self, userid, size):
"""Resize memory of guests.
:param userid: (str) the userid of the guest to be resized
:param size: (str) The memory size that the guest should have
defined in user directory after resize.
The value should be specified by 1... | [
"def",
"guest_resize_mem",
"(",
"self",
",",
"userid",
",",
"size",
")",
":",
"action",
"=",
"\"resize guest '%s' to have '%s' memory\"",
"%",
"(",
"userid",
",",
"size",
")",
"LOG",
".",
"info",
"(",
"\"Begin to %s\"",
"%",
"action",
")",
"with",
"zvmutils",
... | Resize memory of guests.
:param userid: (str) the userid of the guest to be resized
:param size: (str) The memory size that the guest should have
defined in user directory after resize.
The value should be specified by 1-4 bits of number suffixed by
either M... | [
"Resize",
"memory",
"of",
"guests",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L685-L700 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_create_disks | def guest_create_disks(self, userid, disk_list):
"""Add disks to an existing guest vm.
:param userid: (str) the userid of the vm to be created
:param disk_list: (list) a list of disks info for the guest.
It has one dictionary that contain some of the below keys for
... | python | def guest_create_disks(self, userid, disk_list):
"""Add disks to an existing guest vm.
:param userid: (str) the userid of the vm to be created
:param disk_list: (list) a list of disks info for the guest.
It has one dictionary that contain some of the below keys for
... | [
"def",
"guest_create_disks",
"(",
"self",
",",
"userid",
",",
"disk_list",
")",
":",
"if",
"disk_list",
"==",
"[",
"]",
"or",
"disk_list",
"is",
"None",
":",
"# nothing to do",
"LOG",
".",
"debug",
"(",
"\"No disk specified when calling guest_create_disks, \"",
"\... | Add disks to an existing guest vm.
:param userid: (str) the userid of the vm to be created
:param disk_list: (list) a list of disks info for the guest.
It has one dictionary that contain some of the below keys for
each disk, the root disk should be the first element in the... | [
"Add",
"disks",
"to",
"an",
"existing",
"guest",
"vm",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L703-L748 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_delete_disks | def guest_delete_disks(self, userid, disk_vdev_list):
"""Delete disks from an existing guest vm.
:param userid: (str) the userid of the vm to be deleted
:param disk_vdev_list: (list) the vdev list of disks to be deleted,
for example: ['0101', '0102']
"""
action = "de... | python | def guest_delete_disks(self, userid, disk_vdev_list):
"""Delete disks from an existing guest vm.
:param userid: (str) the userid of the vm to be deleted
:param disk_vdev_list: (list) the vdev list of disks to be deleted,
for example: ['0101', '0102']
"""
action = "de... | [
"def",
"guest_delete_disks",
"(",
"self",
",",
"userid",
",",
"disk_vdev_list",
")",
":",
"action",
"=",
"\"delete disks '%s' from guest '%s'\"",
"%",
"(",
"str",
"(",
"disk_vdev_list",
")",
",",
"userid",
")",
"with",
"zvmutils",
".",
"log_and_reraise_sdkbase_error... | Delete disks from an existing guest vm.
:param userid: (str) the userid of the vm to be deleted
:param disk_vdev_list: (list) the vdev list of disks to be deleted,
for example: ['0101', '0102'] | [
"Delete",
"disks",
"from",
"an",
"existing",
"guest",
"vm",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L751-L761 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_nic_couple_to_vswitch | def guest_nic_couple_to_vswitch(self, userid, nic_vdev,
vswitch_name, active=False):
""" Couple nic device to specified vswitch.
:param str userid: the user's name who owns the nic
:param str nic_vdev: nic device number, 1- to 4- hexadecimal digits
:p... | python | def guest_nic_couple_to_vswitch(self, userid, nic_vdev,
vswitch_name, active=False):
""" Couple nic device to specified vswitch.
:param str userid: the user's name who owns the nic
:param str nic_vdev: nic device number, 1- to 4- hexadecimal digits
:p... | [
"def",
"guest_nic_couple_to_vswitch",
"(",
"self",
",",
"userid",
",",
"nic_vdev",
",",
"vswitch_name",
",",
"active",
"=",
"False",
")",
":",
"self",
".",
"_networkops",
".",
"couple_nic_to_vswitch",
"(",
"userid",
",",
"nic_vdev",
",",
"vswitch_name",
",",
"... | Couple nic device to specified vswitch.
:param str userid: the user's name who owns the nic
:param str nic_vdev: nic device number, 1- to 4- hexadecimal digits
:param str vswitch_name: the name of the vswitch
:param bool active: whether make the change on active guest system | [
"Couple",
"nic",
"device",
"to",
"specified",
"vswitch",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L764-L774 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_nic_uncouple_from_vswitch | def guest_nic_uncouple_from_vswitch(self, userid, nic_vdev,
active=False):
""" Disonnect nic device with network.
:param str userid: the user's name who owns the nic
:param str nic_vdev: nic device number, 1- to 4- hexadecimal digits
:param bool a... | python | def guest_nic_uncouple_from_vswitch(self, userid, nic_vdev,
active=False):
""" Disonnect nic device with network.
:param str userid: the user's name who owns the nic
:param str nic_vdev: nic device number, 1- to 4- hexadecimal digits
:param bool a... | [
"def",
"guest_nic_uncouple_from_vswitch",
"(",
"self",
",",
"userid",
",",
"nic_vdev",
",",
"active",
"=",
"False",
")",
":",
"self",
".",
"_networkops",
".",
"uncouple_nic_from_vswitch",
"(",
"userid",
",",
"nic_vdev",
",",
"active",
"=",
"active",
")"
] | Disonnect nic device with network.
:param str userid: the user's name who owns the nic
:param str nic_vdev: nic device number, 1- to 4- hexadecimal digits
:param bool active: whether make the change on active guest system | [
"Disonnect",
"nic",
"device",
"with",
"network",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L777-L786 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.vswitch_create | def vswitch_create(self, name, rdev=None, controller='*',
connection='CONNECT', network_type='ETHERNET',
router="NONROUTER", vid='UNAWARE', port_type='ACCESS',
gvrp='GVRP', queue_mem=8, native_vid=1,
persist=True):
""" C... | python | def vswitch_create(self, name, rdev=None, controller='*',
connection='CONNECT', network_type='ETHERNET',
router="NONROUTER", vid='UNAWARE', port_type='ACCESS',
gvrp='GVRP', queue_mem=8, native_vid=1,
persist=True):
""" C... | [
"def",
"vswitch_create",
"(",
"self",
",",
"name",
",",
"rdev",
"=",
"None",
",",
"controller",
"=",
"'*'",
",",
"connection",
"=",
"'CONNECT'",
",",
"network_type",
"=",
"'ETHERNET'",
",",
"router",
"=",
"\"NONROUTER\"",
",",
"vid",
"=",
"'UNAWARE'",
",",... | Create vswitch.
:param str name: the vswitch name
:param str rdev: the real device number, a maximum of three devices,
all 1-4 characters in length, delimited by blanks. 'NONE'
may also be specified
:param str controller: the vswitch's controller, it could be the u... | [
"Create",
"vswitch",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L796-L888 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_get_console_output | def guest_get_console_output(self, userid):
"""Get the console output of the guest virtual machine.
:param str userid: the user id of the vm
:returns: console log string
:rtype: str
"""
action = "get the console output of guest '%s'" % userid
with zvmutils.log_an... | python | def guest_get_console_output(self, userid):
"""Get the console output of the guest virtual machine.
:param str userid: the user id of the vm
:returns: console log string
:rtype: str
"""
action = "get the console output of guest '%s'" % userid
with zvmutils.log_an... | [
"def",
"guest_get_console_output",
"(",
"self",
",",
"userid",
")",
":",
"action",
"=",
"\"get the console output of guest '%s'\"",
"%",
"userid",
"with",
"zvmutils",
".",
"log_and_reraise_sdkbase_error",
"(",
"action",
")",
":",
"output",
"=",
"self",
".",
"_vmops"... | Get the console output of the guest virtual machine.
:param str userid: the user id of the vm
:returns: console log string
:rtype: str | [
"Get",
"the",
"console",
"output",
"of",
"the",
"guest",
"virtual",
"machine",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L891-L902 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_delete | def guest_delete(self, userid):
"""Delete guest.
:param userid: the user id of the vm
"""
# check guest exist in database or not
userid = userid.upper()
if not self._vmops.check_guests_exist_in_db(userid, raise_exc=False):
if zvmutils.check_userid_exist(user... | python | def guest_delete(self, userid):
"""Delete guest.
:param userid: the user id of the vm
"""
# check guest exist in database or not
userid = userid.upper()
if not self._vmops.check_guests_exist_in_db(userid, raise_exc=False):
if zvmutils.check_userid_exist(user... | [
"def",
"guest_delete",
"(",
"self",
",",
"userid",
")",
":",
"# check guest exist in database or not",
"userid",
"=",
"userid",
".",
"upper",
"(",
")",
"if",
"not",
"self",
".",
"_vmops",
".",
"check_guests_exist_in_db",
"(",
"userid",
",",
"raise_exc",
"=",
"... | Delete guest.
:param userid: the user id of the vm | [
"Delete",
"guest",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L904-L924 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_inspect_stats | def guest_inspect_stats(self, userid_list):
"""Get the statistics including cpu and mem of the guests
:param userid_list: a single userid string or a list of guest userids
:returns: dictionary describing the cpu statistics of the vm
in the form {'UID1':
{
... | python | def guest_inspect_stats(self, userid_list):
"""Get the statistics including cpu and mem of the guests
:param userid_list: a single userid string or a list of guest userids
:returns: dictionary describing the cpu statistics of the vm
in the form {'UID1':
{
... | [
"def",
"guest_inspect_stats",
"(",
"self",
",",
"userid_list",
")",
":",
"if",
"not",
"isinstance",
"(",
"userid_list",
",",
"list",
")",
":",
"userid_list",
"=",
"[",
"userid_list",
"]",
"action",
"=",
"\"get the statistics of guest '%s'\"",
"%",
"str",
"(",
... | Get the statistics including cpu and mem of the guests
:param userid_list: a single userid string or a list of guest userids
:returns: dictionary describing the cpu statistics of the vm
in the form {'UID1':
{
'guest_cpus': xx,
'use... | [
"Get",
"the",
"statistics",
"including",
"cpu",
"and",
"mem",
"of",
"the",
"guests"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L927-L968 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_inspect_vnics | def guest_inspect_vnics(self, userid_list):
"""Get the vnics statistics of the guest virtual machines
:param userid_list: a single userid string or a list of guest userids
:returns: dictionary describing the vnics statistics of the vm
in the form
{'UID1':
... | python | def guest_inspect_vnics(self, userid_list):
"""Get the vnics statistics of the guest virtual machines
:param userid_list: a single userid string or a list of guest userids
:returns: dictionary describing the vnics statistics of the vm
in the form
{'UID1':
... | [
"def",
"guest_inspect_vnics",
"(",
"self",
",",
"userid_list",
")",
":",
"if",
"not",
"isinstance",
"(",
"userid_list",
",",
"list",
")",
":",
"userid_list",
"=",
"[",
"userid_list",
"]",
"action",
"=",
"\"get the vnics statistics of guest '%s'\"",
"%",
"str",
"... | Get the vnics statistics of the guest virtual machines
:param userid_list: a single userid string or a list of guest userids
:returns: dictionary describing the vnics statistics of the vm
in the form
{'UID1':
[{
'vswitch_name': xx,... | [
"Get",
"the",
"vnics",
"statistics",
"of",
"the",
"guest",
"virtual",
"machines"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L971-L1013 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.vswitch_set_vlan_id_for_user | def vswitch_set_vlan_id_for_user(self, vswitch_name, userid, vlan_id):
"""Set vlan id for user when connecting to the vswitch
:param str vswitch_name: the name of the vswitch
:param str userid: the user id of the vm
:param int vlan_id: the VLAN id
"""
self._networkops.se... | python | def vswitch_set_vlan_id_for_user(self, vswitch_name, userid, vlan_id):
"""Set vlan id for user when connecting to the vswitch
:param str vswitch_name: the name of the vswitch
:param str userid: the user id of the vm
:param int vlan_id: the VLAN id
"""
self._networkops.se... | [
"def",
"vswitch_set_vlan_id_for_user",
"(",
"self",
",",
"vswitch_name",
",",
"userid",
",",
"vlan_id",
")",
":",
"self",
".",
"_networkops",
".",
"set_vswitch_port_vlan_id",
"(",
"vswitch_name",
",",
"userid",
",",
"vlan_id",
")"
] | Set vlan id for user when connecting to the vswitch
:param str vswitch_name: the name of the vswitch
:param str userid: the user id of the vm
:param int vlan_id: the VLAN id | [
"Set",
"vlan",
"id",
"for",
"user",
"when",
"connecting",
"to",
"the",
"vswitch"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L1035-L1043 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_config_minidisks | def guest_config_minidisks(self, userid, disk_info):
"""Punch the script that used to process additional disks to vm
:param str userid: the user id of the vm
:param disk_info: a list contains disks info for the guest. It
contains dictionaries that describes disk info for each dis... | python | def guest_config_minidisks(self, userid, disk_info):
"""Punch the script that used to process additional disks to vm
:param str userid: the user id of the vm
:param disk_info: a list contains disks info for the guest. It
contains dictionaries that describes disk info for each dis... | [
"def",
"guest_config_minidisks",
"(",
"self",
",",
"userid",
",",
"disk_info",
")",
":",
"action",
"=",
"\"config disks for userid '%s'\"",
"%",
"userid",
"with",
"zvmutils",
".",
"log_and_reraise_sdkbase_error",
"(",
"action",
")",
":",
"self",
".",
"_vmops",
"."... | Punch the script that used to process additional disks to vm
:param str userid: the user id of the vm
:param disk_info: a list contains disks info for the guest. It
contains dictionaries that describes disk info for each disk.
Each dictionary has 3 keys, format is require... | [
"Punch",
"the",
"script",
"that",
"used",
"to",
"process",
"additional",
"disks",
"to",
"vm"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L1046-L1079 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.vswitch_set | def vswitch_set(self, vswitch_name, **kwargs):
"""Change the configuration of an existing virtual switch
:param str vswitch_name: the name of the virtual switch
:param dict kwargs:
- grant_userid=<value>:
A userid to be added to the access list
- user_vla... | python | def vswitch_set(self, vswitch_name, **kwargs):
"""Change the configuration of an existing virtual switch
:param str vswitch_name: the name of the virtual switch
:param dict kwargs:
- grant_userid=<value>:
A userid to be added to the access list
- user_vla... | [
"def",
"vswitch_set",
"(",
"self",
",",
"vswitch_name",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"k",
"in",
"kwargs",
".",
"keys",
"(",
")",
":",
"if",
"k",
"not",
"in",
"constants",
".",
"SET_VSWITCH_KEYWORDS",
":",
"errmsg",
"=",
"(",
"'API vswitch_... | Change the configuration of an existing virtual switch
:param str vswitch_name: the name of the virtual switch
:param dict kwargs:
- grant_userid=<value>:
A userid to be added to the access list
- user_vlan_id=<value>:
user VLAN ID. Support follow... | [
"Change",
"the",
"configuration",
"of",
"an",
"existing",
"virtual",
"switch"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L1081-L1215 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.vswitch_delete | def vswitch_delete(self, vswitch_name, persist=True):
""" Delete vswitch.
:param str name: the vswitch name
:param bool persist: whether delete the vswitch from the permanent
configuration for the system
"""
self._networkops.delete_vswitch(vswitch_name, persist) | python | def vswitch_delete(self, vswitch_name, persist=True):
""" Delete vswitch.
:param str name: the vswitch name
:param bool persist: whether delete the vswitch from the permanent
configuration for the system
"""
self._networkops.delete_vswitch(vswitch_name, persist) | [
"def",
"vswitch_delete",
"(",
"self",
",",
"vswitch_name",
",",
"persist",
"=",
"True",
")",
":",
"self",
".",
"_networkops",
".",
"delete_vswitch",
"(",
"vswitch_name",
",",
"persist",
")"
] | Delete vswitch.
:param str name: the vswitch name
:param bool persist: whether delete the vswitch from the permanent
configuration for the system | [
"Delete",
"vswitch",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L1217-L1224 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_create_network_interface | def guest_create_network_interface(self, userid, os_version,
guest_networks, active=False):
""" Create network interface(s) for the guest inux system. It will
create the nic for the guest, add NICDEF record into the user
direct. It will also constru... | python | def guest_create_network_interface(self, userid, os_version,
guest_networks, active=False):
""" Create network interface(s) for the guest inux system. It will
create the nic for the guest, add NICDEF record into the user
direct. It will also constru... | [
"def",
"guest_create_network_interface",
"(",
"self",
",",
"userid",
",",
"os_version",
",",
"guest_networks",
",",
"active",
"=",
"False",
")",
":",
"if",
"len",
"(",
"guest_networks",
")",
"==",
"0",
":",
"errmsg",
"=",
"(",
"\"API guest_create_network_interfa... | Create network interface(s) for the guest inux system. It will
create the nic for the guest, add NICDEF record into the user
direct. It will also construct network interface configuration
files and punch the files to the guest. These files will take
effect when initializi... | [
"Create",
"network",
"interface",
"(",
"s",
")",
"for",
"the",
"guest",
"inux",
"system",
".",
"It",
"will",
"create",
"the",
"nic",
"for",
"the",
"guest",
"add",
"NICDEF",
"record",
"into",
"the",
"user",
"direct",
".",
"It",
"will",
"also",
"construct"... | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L1294-L1420 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guests_get_nic_info | def guests_get_nic_info(self, userid=None, nic_id=None, vswitch=None):
""" Retrieve nic information in the network database according to
the requirements, the nic information will include the guest
name, nic device number, vswitch name that the nic is coupled
to, nic identifi... | python | def guests_get_nic_info(self, userid=None, nic_id=None, vswitch=None):
""" Retrieve nic information in the network database according to
the requirements, the nic information will include the guest
name, nic device number, vswitch name that the nic is coupled
to, nic identifi... | [
"def",
"guests_get_nic_info",
"(",
"self",
",",
"userid",
"=",
"None",
",",
"nic_id",
"=",
"None",
",",
"vswitch",
"=",
"None",
")",
":",
"action",
"=",
"\"get nic information\"",
"with",
"zvmutils",
".",
"log_and_reraise_sdkbase_error",
"(",
"action",
")",
":... | Retrieve nic information in the network database according to
the requirements, the nic information will include the guest
name, nic device number, vswitch name that the nic is coupled
to, nic identifier and the comments.
:param str userid: the user id of the vm
:par... | [
"Retrieve",
"nic",
"information",
"in",
"the",
"network",
"database",
"according",
"to",
"the",
"requirements",
"the",
"nic",
"information",
"will",
"include",
"the",
"guest",
"name",
"nic",
"device",
"number",
"vswitch",
"name",
"that",
"the",
"nic",
"is",
"c... | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L1422-L1446 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.vswitch_query | def vswitch_query(self, vswitch_name):
"""Check the virtual switch status
:param str vswitch_name: the name of the virtual switch
:returns: Dictionary describing virtual switch info
:rtype: dict
"""
action = "get virtual switch information"
with zvmutils.log_and_... | python | def vswitch_query(self, vswitch_name):
"""Check the virtual switch status
:param str vswitch_name: the name of the virtual switch
:returns: Dictionary describing virtual switch info
:rtype: dict
"""
action = "get virtual switch information"
with zvmutils.log_and_... | [
"def",
"vswitch_query",
"(",
"self",
",",
"vswitch_name",
")",
":",
"action",
"=",
"\"get virtual switch information\"",
"with",
"zvmutils",
".",
"log_and_reraise_sdkbase_error",
"(",
"action",
")",
":",
"return",
"self",
".",
"_networkops",
".",
"vswitch_query",
"(... | Check the virtual switch status
:param str vswitch_name: the name of the virtual switch
:returns: Dictionary describing virtual switch info
:rtype: dict | [
"Check",
"the",
"virtual",
"switch",
"status"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L1448-L1457 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_delete_network_interface | def guest_delete_network_interface(self, userid, os_version,
vdev, active=False):
""" delete the nic and network configuration for the vm
:param str userid: the user id of the guest
:param str os_version: operating system version of the guest
:para... | python | def guest_delete_network_interface(self, userid, os_version,
vdev, active=False):
""" delete the nic and network configuration for the vm
:param str userid: the user id of the guest
:param str os_version: operating system version of the guest
:para... | [
"def",
"guest_delete_network_interface",
"(",
"self",
",",
"userid",
",",
"os_version",
",",
"vdev",
",",
"active",
"=",
"False",
")",
":",
"self",
".",
"_networkops",
".",
"delete_nic",
"(",
"userid",
",",
"vdev",
",",
"active",
"=",
"active",
")",
"self"... | delete the nic and network configuration for the vm
:param str userid: the user id of the guest
:param str os_version: operating system version of the guest
:param str vdev: nic device number, 1- to 4- hexadecimal digits
:param bool active: whether delete a nic on active guest system | [
"delete",
"the",
"nic",
"and",
"network",
"configuration",
"for",
"the",
"vm"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L1460-L1471 |
tonybaloney/requests-staticmock | requests_staticmock/context.py | mock_session_with_fixtures | def mock_session_with_fixtures(session, path, url):
"""
Context Manager
Mock the responses with a particular session
to any files found within a static path
:param session: The requests session object
:type session: :class:`requests.Session`
:param path: The path to the fixtures
:typ... | python | def mock_session_with_fixtures(session, path, url):
"""
Context Manager
Mock the responses with a particular session
to any files found within a static path
:param session: The requests session object
:type session: :class:`requests.Session`
:param path: The path to the fixtures
:typ... | [
"def",
"mock_session_with_fixtures",
"(",
"session",
",",
"path",
",",
"url",
")",
":",
"_orig_adapters",
"=",
"session",
".",
"adapters",
"mock_adapter",
"=",
"adapter",
".",
"Adapter",
"(",
")",
"session",
".",
"adapters",
"=",
"OrderedDict",
"(",
")",
"if... | Context Manager
Mock the responses with a particular session
to any files found within a static path
:param session: The requests session object
:type session: :class:`requests.Session`
:param path: The path to the fixtures
:type path: ``str``
:param url: The base URL to mock, e.g. htt... | [
"Context",
"Manager"
] | train | https://github.com/tonybaloney/requests-staticmock/blob/431a68acc8e04eec42143bd1de43635cbc94fc3f/requests_staticmock/context.py#L24-L51 |
tonybaloney/requests-staticmock | requests_staticmock/context.py | mock_session_with_class | def mock_session_with_class(session, cls, url):
"""
Context Manager
Mock the responses with a particular session
to any private methods for the URLs
:param session: The requests session object
:type session: :class:`requests.Session`
:param cls: The class instance with private methods fo... | python | def mock_session_with_class(session, cls, url):
"""
Context Manager
Mock the responses with a particular session
to any private methods for the URLs
:param session: The requests session object
:type session: :class:`requests.Session`
:param cls: The class instance with private methods fo... | [
"def",
"mock_session_with_class",
"(",
"session",
",",
"cls",
",",
"url",
")",
":",
"_orig_adapters",
"=",
"session",
".",
"adapters",
"mock_adapter",
"=",
"adapter",
".",
"ClassAdapter",
"(",
"cls",
")",
"session",
".",
"adapters",
"=",
"OrderedDict",
"(",
... | Context Manager
Mock the responses with a particular session
to any private methods for the URLs
:param session: The requests session object
:type session: :class:`requests.Session`
:param cls: The class instance with private methods for URLs
:type cls: ``object``
:param url: The base ... | [
"Context",
"Manager"
] | train | https://github.com/tonybaloney/requests-staticmock/blob/431a68acc8e04eec42143bd1de43635cbc94fc3f/requests_staticmock/context.py#L55-L81 |
mfcloud/python-zvm-sdk | zvmsdk/config.py | ConfigOpts._fixpath | def _fixpath(self, p):
"""Apply tilde expansion and absolutization to a path."""
return os.path.abspath(os.path.expanduser(p)) | python | def _fixpath(self, p):
"""Apply tilde expansion and absolutization to a path."""
return os.path.abspath(os.path.expanduser(p)) | [
"def",
"_fixpath",
"(",
"self",
",",
"p",
")",
":",
"return",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"expanduser",
"(",
"p",
")",
")"
] | Apply tilde expansion and absolutization to a path. | [
"Apply",
"tilde",
"expansion",
"and",
"absolutization",
"to",
"a",
"path",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/config.py#L588-L590 |
mfcloud/python-zvm-sdk | zvmsdk/config.py | ConfigOpts._get_config_dirs | def _get_config_dirs(self):
"""Return a list of directories where config files may be located.
following directories are returned::
./
../etc
~/
/etc/zvmsdk/
"""
_cwd = os.path.split(os.path.abspath(__file__))[0]
_pdir = os.pat... | python | def _get_config_dirs(self):
"""Return a list of directories where config files may be located.
following directories are returned::
./
../etc
~/
/etc/zvmsdk/
"""
_cwd = os.path.split(os.path.abspath(__file__))[0]
_pdir = os.pat... | [
"def",
"_get_config_dirs",
"(",
"self",
")",
":",
"_cwd",
"=",
"os",
".",
"path",
".",
"split",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"__file__",
")",
")",
"[",
"0",
"]",
"_pdir",
"=",
"os",
".",
"path",
".",
"split",
"(",
"_cwd",
")",
"... | Return a list of directories where config files may be located.
following directories are returned::
./
../etc
~/
/etc/zvmsdk/ | [
"Return",
"a",
"list",
"of",
"directories",
"where",
"config",
"files",
"may",
"be",
"located",
".",
"following",
"directories",
"are",
"returned",
"::",
".",
"/",
"..",
"/",
"etc",
"~",
"/",
"/",
"etc",
"/",
"zvmsdk",
"/"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/config.py#L592-L612 |
mfcloud/python-zvm-sdk | zvmsdk/config.py | ConfigOpts._search_dirs | def _search_dirs(self, dirs, basename, extension=""):
"""Search a list of directories for a given filename or directory name.
Iterator over the supplied directories, returning the first file
found with the supplied name and extension.
:param dirs: a list of directories
:... | python | def _search_dirs(self, dirs, basename, extension=""):
"""Search a list of directories for a given filename or directory name.
Iterator over the supplied directories, returning the first file
found with the supplied name and extension.
:param dirs: a list of directories
:... | [
"def",
"_search_dirs",
"(",
"self",
",",
"dirs",
",",
"basename",
",",
"extension",
"=",
"\"\"",
")",
":",
"for",
"d",
"in",
"dirs",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"d",
",",
"'%s%s'",
"%",
"(",
"basename",
",",
"extension",
... | Search a list of directories for a given filename or directory name.
Iterator over the supplied directories, returning the first file
found with the supplied name and extension.
:param dirs: a list of directories
:param basename: the filename
:param extension: the file e... | [
"Search",
"a",
"list",
"of",
"directories",
"for",
"a",
"given",
"filename",
"or",
"directory",
"name",
".",
"Iterator",
"over",
"the",
"supplied",
"directories",
"returning",
"the",
"first",
"file",
"found",
"with",
"the",
"supplied",
"name",
"and",
"extensio... | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/config.py#L614-L630 |
mfcloud/python-zvm-sdk | zvmsdk/config.py | ConfigOpts.find_config_file | def find_config_file(self, project=None, extension='.conf'):
"""Return the config file.
:param project: "zvmsdk"
:param extension: the type of the config file
"""
cfg_dirs = self._get_config_dirs()
config_files = self._search_dirs(cfg_dirs, project, extension)
... | python | def find_config_file(self, project=None, extension='.conf'):
"""Return the config file.
:param project: "zvmsdk"
:param extension: the type of the config file
"""
cfg_dirs = self._get_config_dirs()
config_files = self._search_dirs(cfg_dirs, project, extension)
... | [
"def",
"find_config_file",
"(",
"self",
",",
"project",
"=",
"None",
",",
"extension",
"=",
"'.conf'",
")",
":",
"cfg_dirs",
"=",
"self",
".",
"_get_config_dirs",
"(",
")",
"config_files",
"=",
"self",
".",
"_search_dirs",
"(",
"cfg_dirs",
",",
"project",
... | Return the config file.
:param project: "zvmsdk"
:param extension: the type of the config file | [
"Return",
"the",
"config",
"file",
".",
":",
"param",
"project",
":",
"zvmsdk",
":",
"param",
"extension",
":",
"the",
"type",
"of",
"the",
"config",
"file"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/config.py#L632-L642 |
jvarho/pylibscrypt | pylibscrypt/mcf.py | scrypt_mcf | def scrypt_mcf(scrypt, password, salt=None, N=SCRYPT_N, r=SCRYPT_r, p=SCRYPT_p,
prefix=SCRYPT_MCF_PREFIX_DEFAULT):
"""Derives a Modular Crypt Format hash using the scrypt KDF given
Expects the signature:
scrypt(password, salt, N=SCRYPT_N, r=SCRYPT_r, p=SCRYPT_p, olen=64)
If no salt is g... | python | def scrypt_mcf(scrypt, password, salt=None, N=SCRYPT_N, r=SCRYPT_r, p=SCRYPT_p,
prefix=SCRYPT_MCF_PREFIX_DEFAULT):
"""Derives a Modular Crypt Format hash using the scrypt KDF given
Expects the signature:
scrypt(password, salt, N=SCRYPT_N, r=SCRYPT_r, p=SCRYPT_p, olen=64)
If no salt is g... | [
"def",
"scrypt_mcf",
"(",
"scrypt",
",",
"password",
",",
"salt",
"=",
"None",
",",
"N",
"=",
"SCRYPT_N",
",",
"r",
"=",
"SCRYPT_r",
",",
"p",
"=",
"SCRYPT_p",
",",
"prefix",
"=",
"SCRYPT_MCF_PREFIX_DEFAULT",
")",
":",
"if",
"isinstance",
"(",
"password"... | Derives a Modular Crypt Format hash using the scrypt KDF given
Expects the signature:
scrypt(password, salt, N=SCRYPT_N, r=SCRYPT_r, p=SCRYPT_p, olen=64)
If no salt is given, a random salt of 128+ bits is used. (Recommended.) | [
"Derives",
"a",
"Modular",
"Crypt",
"Format",
"hash",
"using",
"the",
"scrypt",
"KDF",
"given"
] | train | https://github.com/jvarho/pylibscrypt/blob/f2ff02e49f44aa620e308a4a64dd8376b9510f99/pylibscrypt/mcf.py#L199-L237 |
jvarho/pylibscrypt | pylibscrypt/mcf.py | scrypt_mcf_check | def scrypt_mcf_check(scrypt, mcf, password):
"""Returns True if the password matches the given MCF hash
Supports both the libscrypt $s1$ format and the $7$ format.
"""
if not isinstance(mcf, bytes):
raise TypeError('MCF must be a byte string')
if isinstance(password, unicode):
passw... | python | def scrypt_mcf_check(scrypt, mcf, password):
"""Returns True if the password matches the given MCF hash
Supports both the libscrypt $s1$ format and the $7$ format.
"""
if not isinstance(mcf, bytes):
raise TypeError('MCF must be a byte string')
if isinstance(password, unicode):
passw... | [
"def",
"scrypt_mcf_check",
"(",
"scrypt",
",",
"mcf",
",",
"password",
")",
":",
"if",
"not",
"isinstance",
"(",
"mcf",
",",
"bytes",
")",
":",
"raise",
"TypeError",
"(",
"'MCF must be a byte string'",
")",
"if",
"isinstance",
"(",
"password",
",",
"unicode"... | Returns True if the password matches the given MCF hash
Supports both the libscrypt $s1$ format and the $7$ format. | [
"Returns",
"True",
"if",
"the",
"password",
"matches",
"the",
"given",
"MCF",
"hash"
] | train | https://github.com/jvarho/pylibscrypt/blob/f2ff02e49f44aa620e308a4a64dd8376b9510f99/pylibscrypt/mcf.py#L240-L257 |
Chilipp/psyplot | psyplot/plugin_template.py | new_plugin | def new_plugin(odir, py_name=None, version='0.0.1.dev0',
description='New plugin'):
"""
Create a new plugin for the psyplot package
Parameters
----------
odir: str
The name of the directory where the data will be copied to. The
directory must not exist! The name of th... | python | def new_plugin(odir, py_name=None, version='0.0.1.dev0',
description='New plugin'):
"""
Create a new plugin for the psyplot package
Parameters
----------
odir: str
The name of the directory where the data will be copied to. The
directory must not exist! The name of th... | [
"def",
"new_plugin",
"(",
"odir",
",",
"py_name",
"=",
"None",
",",
"version",
"=",
"'0.0.1.dev0'",
",",
"description",
"=",
"'New plugin'",
")",
":",
"name",
"=",
"osp",
".",
"basename",
"(",
"odir",
")",
"if",
"py_name",
"is",
"None",
":",
"py_name",
... | Create a new plugin for the psyplot package
Parameters
----------
odir: str
The name of the directory where the data will be copied to. The
directory must not exist! The name of the directory also defines the
name of the package.
py_name: str
The name of the python packa... | [
"Create",
"a",
"new",
"plugin",
"for",
"the",
"psyplot",
"package"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plugin_template.py#L9-L55 |
Chilipp/psyplot | psyplot/__init__.py | get_versions | def get_versions(requirements=True, key=None):
"""
Get the version information for psyplot, the plugins and its requirements
Parameters
----------
requirements: bool
If True, the requirements of the plugins and psyplot are investigated
key: func
A function that determines whethe... | python | def get_versions(requirements=True, key=None):
"""
Get the version information for psyplot, the plugins and its requirements
Parameters
----------
requirements: bool
If True, the requirements of the plugins and psyplot are investigated
key: func
A function that determines whethe... | [
"def",
"get_versions",
"(",
"requirements",
"=",
"True",
",",
"key",
"=",
"None",
")",
":",
"from",
"pkg_resources",
"import",
"iter_entry_points",
"ret",
"=",
"{",
"'psyplot'",
":",
"_get_versions",
"(",
"requirements",
")",
"}",
"for",
"ep",
"in",
"iter_en... | Get the version information for psyplot, the plugins and its requirements
Parameters
----------
requirements: bool
If True, the requirements of the plugins and psyplot are investigated
key: func
A function that determines whether a plugin shall be considererd or
not. The functio... | [
"Get",
"the",
"version",
"information",
"for",
"psyplot",
"the",
"plugins",
"and",
"its",
"requirements"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/__init__.py#L35-L107 |
mfcloud/python-zvm-sdk | zvmsdk/database.py | NetworkDbOperator.switch_delete_record_for_userid | def switch_delete_record_for_userid(self, userid):
"""Remove userid switch record from switch table."""
with get_network_conn() as conn:
conn.execute("DELETE FROM switch WHERE userid=?",
(userid,))
LOG.debug("Switch record for user %s is removed from "
... | python | def switch_delete_record_for_userid(self, userid):
"""Remove userid switch record from switch table."""
with get_network_conn() as conn:
conn.execute("DELETE FROM switch WHERE userid=?",
(userid,))
LOG.debug("Switch record for user %s is removed from "
... | [
"def",
"switch_delete_record_for_userid",
"(",
"self",
",",
"userid",
")",
":",
"with",
"get_network_conn",
"(",
")",
"as",
"conn",
":",
"conn",
".",
"execute",
"(",
"\"DELETE FROM switch WHERE userid=?\"",
",",
"(",
"userid",
",",
")",
")",
"LOG",
".",
"debug... | Remove userid switch record from switch table. | [
"Remove",
"userid",
"switch",
"record",
"from",
"switch",
"table",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/database.py#L154-L160 |
mfcloud/python-zvm-sdk | zvmsdk/database.py | NetworkDbOperator.switch_delete_record_for_nic | def switch_delete_record_for_nic(self, userid, interface):
"""Remove userid switch record from switch table."""
with get_network_conn() as conn:
conn.execute("DELETE FROM switch WHERE userid=? and interface=?",
(userid, interface))
LOG.debug("Switch recor... | python | def switch_delete_record_for_nic(self, userid, interface):
"""Remove userid switch record from switch table."""
with get_network_conn() as conn:
conn.execute("DELETE FROM switch WHERE userid=? and interface=?",
(userid, interface))
LOG.debug("Switch recor... | [
"def",
"switch_delete_record_for_nic",
"(",
"self",
",",
"userid",
",",
"interface",
")",
":",
"with",
"get_network_conn",
"(",
")",
"as",
"conn",
":",
"conn",
".",
"execute",
"(",
"\"DELETE FROM switch WHERE userid=? and interface=?\"",
",",
"(",
"userid",
",",
"... | Remove userid switch record from switch table. | [
"Remove",
"userid",
"switch",
"record",
"from",
"switch",
"table",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/database.py#L162-L168 |
mfcloud/python-zvm-sdk | zvmsdk/database.py | NetworkDbOperator.switch_add_record | def switch_add_record(self, userid, interface, port=None,
switch=None, comments=None):
"""Add userid and nic name address into switch table."""
with get_network_conn() as conn:
conn.execute("INSERT INTO switch VALUES (?, ?, ?, ?, ?)",
(useri... | python | def switch_add_record(self, userid, interface, port=None,
switch=None, comments=None):
"""Add userid and nic name address into switch table."""
with get_network_conn() as conn:
conn.execute("INSERT INTO switch VALUES (?, ?, ?, ?, ?)",
(useri... | [
"def",
"switch_add_record",
"(",
"self",
",",
"userid",
",",
"interface",
",",
"port",
"=",
"None",
",",
"switch",
"=",
"None",
",",
"comments",
"=",
"None",
")",
":",
"with",
"get_network_conn",
"(",
")",
"as",
"conn",
":",
"conn",
".",
"execute",
"("... | Add userid and nic name address into switch table. | [
"Add",
"userid",
"and",
"nic",
"name",
"address",
"into",
"switch",
"table",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/database.py#L170-L178 |
mfcloud/python-zvm-sdk | zvmsdk/database.py | NetworkDbOperator.switch_update_record_with_switch | def switch_update_record_with_switch(self, userid, interface,
switch=None):
"""Update information in switch table."""
if not self._get_switch_by_user_interface(userid, interface):
msg = "User %s with nic %s does not exist in DB" % (userid,
... | python | def switch_update_record_with_switch(self, userid, interface,
switch=None):
"""Update information in switch table."""
if not self._get_switch_by_user_interface(userid, interface):
msg = "User %s with nic %s does not exist in DB" % (userid,
... | [
"def",
"switch_update_record_with_switch",
"(",
"self",
",",
"userid",
",",
"interface",
",",
"switch",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"_get_switch_by_user_interface",
"(",
"userid",
",",
"interface",
")",
":",
"msg",
"=",
"\"User %s with nic %... | Update information in switch table. | [
"Update",
"information",
"in",
"switch",
"table",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/database.py#L190-L216 |
mfcloud/python-zvm-sdk | zvmsdk/database.py | ImageDbOperator.image_query_record | def image_query_record(self, imagename=None):
"""Query the image record from database, if imagename is None, all
of the image records will be returned, otherwise only the specified
image record will be returned."""
if imagename:
with get_image_conn() as conn:
... | python | def image_query_record(self, imagename=None):
"""Query the image record from database, if imagename is None, all
of the image records will be returned, otherwise only the specified
image record will be returned."""
if imagename:
with get_image_conn() as conn:
... | [
"def",
"image_query_record",
"(",
"self",
",",
"imagename",
"=",
"None",
")",
":",
"if",
"imagename",
":",
"with",
"get_image_conn",
"(",
")",
"as",
"conn",
":",
"result",
"=",
"conn",
".",
"execute",
"(",
"\"SELECT * FROM image WHERE \"",
"\"imagename=?\"",
"... | Query the image record from database, if imagename is None, all
of the image records will be returned, otherwise only the specified
image record will be returned. | [
"Query",
"the",
"image",
"record",
"from",
"database",
"if",
"imagename",
"is",
"None",
"all",
"of",
"the",
"image",
"records",
"will",
"be",
"returned",
"otherwise",
"only",
"the",
"specified",
"image",
"record",
"will",
"be",
"returned",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/database.py#L463-L492 |
mfcloud/python-zvm-sdk | zvmsdk/database.py | GuestDbOperator.get_comments_by_userid | def get_comments_by_userid(self, userid):
""" Get comments record.
output should be like: {'k1': 'v1', 'k2': 'v2'}'
"""
userid = userid
with get_guest_conn() as conn:
res = conn.execute("SELECT comments FROM guests "
"WHERE userid=?", (u... | python | def get_comments_by_userid(self, userid):
""" Get comments record.
output should be like: {'k1': 'v1', 'k2': 'v2'}'
"""
userid = userid
with get_guest_conn() as conn:
res = conn.execute("SELECT comments FROM guests "
"WHERE userid=?", (u... | [
"def",
"get_comments_by_userid",
"(",
"self",
",",
"userid",
")",
":",
"userid",
"=",
"userid",
"with",
"get_guest_conn",
"(",
")",
"as",
"conn",
":",
"res",
"=",
"conn",
".",
"execute",
"(",
"\"SELECT comments FROM guests \"",
"\"WHERE userid=?\"",
",",
"(",
... | Get comments record.
output should be like: {'k1': 'v1', 'k2': 'v2'}' | [
"Get",
"comments",
"record",
".",
"output",
"should",
"be",
"like",
":",
"{",
"k1",
":",
"v1",
"k2",
":",
"v2",
"}"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/database.py#L670-L683 |
mfcloud/python-zvm-sdk | zvmsdk/database.py | GuestDbOperator.get_metadata_by_userid | def get_metadata_by_userid(self, userid):
"""get metadata record.
output should be like: "a=1,b=2,c=3"
"""
userid = userid
with get_guest_conn() as conn:
res = conn.execute("SELECT * FROM guests "
"WHERE userid=?", (userid,))
... | python | def get_metadata_by_userid(self, userid):
"""get metadata record.
output should be like: "a=1,b=2,c=3"
"""
userid = userid
with get_guest_conn() as conn:
res = conn.execute("SELECT * FROM guests "
"WHERE userid=?", (userid,))
... | [
"def",
"get_metadata_by_userid",
"(",
"self",
",",
"userid",
")",
":",
"userid",
"=",
"userid",
"with",
"get_guest_conn",
"(",
")",
"as",
"conn",
":",
"res",
"=",
"conn",
".",
"execute",
"(",
"\"SELECT * FROM guests \"",
"\"WHERE userid=?\"",
",",
"(",
"userid... | get metadata record.
output should be like: "a=1,b=2,c=3" | [
"get",
"metadata",
"record",
".",
"output",
"should",
"be",
"like",
":",
"a",
"=",
"1",
"b",
"=",
"2",
"c",
"=",
"3"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/database.py#L685-L703 |
mfcloud/python-zvm-sdk | zvmsdk/database.py | GuestDbOperator.transfer_metadata_to_dict | def transfer_metadata_to_dict(self, meta):
"""transfer str to dict.
output should be like: {'a':1, 'b':2, 'c':3}
"""
dic = {}
arr = meta.strip(' ,').split(',')
for i in arr:
temp = i.split('=')
key = temp[0].strip()
value = temp[1].stri... | python | def transfer_metadata_to_dict(self, meta):
"""transfer str to dict.
output should be like: {'a':1, 'b':2, 'c':3}
"""
dic = {}
arr = meta.strip(' ,').split(',')
for i in arr:
temp = i.split('=')
key = temp[0].strip()
value = temp[1].stri... | [
"def",
"transfer_metadata_to_dict",
"(",
"self",
",",
"meta",
")",
":",
"dic",
"=",
"{",
"}",
"arr",
"=",
"meta",
".",
"strip",
"(",
"' ,'",
")",
".",
"split",
"(",
"','",
")",
"for",
"i",
"in",
"arr",
":",
"temp",
"=",
"i",
".",
"split",
"(",
... | transfer str to dict.
output should be like: {'a':1, 'b':2, 'c':3} | [
"transfer",
"str",
"to",
"dict",
".",
"output",
"should",
"be",
"like",
":",
"{",
"a",
":",
"1",
"b",
":",
"2",
"c",
":",
"3",
"}"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/database.py#L705-L716 |
ratcave/wavefront_reader | wavefront_reader/writing.py | face_index | def face_index(vertices):
"""Takes an MxNx3 array and returns a 2D vertices and MxN face_indices arrays"""
new_verts = []
face_indices = []
for wall in vertices:
face_wall = []
for vert in wall:
if new_verts:
if not np.isclose(vert, new_verts).all(axis=1).any(... | python | def face_index(vertices):
"""Takes an MxNx3 array and returns a 2D vertices and MxN face_indices arrays"""
new_verts = []
face_indices = []
for wall in vertices:
face_wall = []
for vert in wall:
if new_verts:
if not np.isclose(vert, new_verts).all(axis=1).any(... | [
"def",
"face_index",
"(",
"vertices",
")",
":",
"new_verts",
"=",
"[",
"]",
"face_indices",
"=",
"[",
"]",
"for",
"wall",
"in",
"vertices",
":",
"face_wall",
"=",
"[",
"]",
"for",
"vert",
"in",
"wall",
":",
"if",
"new_verts",
":",
"if",
"not",
"np",
... | Takes an MxNx3 array and returns a 2D vertices and MxN face_indices arrays | [
"Takes",
"an",
"MxNx3",
"array",
"and",
"returns",
"a",
"2D",
"vertices",
"and",
"MxN",
"face_indices",
"arrays"
] | train | https://github.com/ratcave/wavefront_reader/blob/c515164a3952d6b85f8044f429406fddd862bfd0/wavefront_reader/writing.py#L8-L23 |
ratcave/wavefront_reader | wavefront_reader/writing.py | fan_triangulate | def fan_triangulate(indices):
"""Return an array of vertices in triangular order using a fan triangulation algorithm."""
if len(indices[0]) != 4:
raise ValueError("Assumes working with a sequence of quad indices")
new_indices = []
for face in indices:
new_indices.extend([face[:-1], face[... | python | def fan_triangulate(indices):
"""Return an array of vertices in triangular order using a fan triangulation algorithm."""
if len(indices[0]) != 4:
raise ValueError("Assumes working with a sequence of quad indices")
new_indices = []
for face in indices:
new_indices.extend([face[:-1], face[... | [
"def",
"fan_triangulate",
"(",
"indices",
")",
":",
"if",
"len",
"(",
"indices",
"[",
"0",
"]",
")",
"!=",
"4",
":",
"raise",
"ValueError",
"(",
"\"Assumes working with a sequence of quad indices\"",
")",
"new_indices",
"=",
"[",
"]",
"for",
"face",
"in",
"i... | Return an array of vertices in triangular order using a fan triangulation algorithm. | [
"Return",
"an",
"array",
"of",
"vertices",
"in",
"triangular",
"order",
"using",
"a",
"fan",
"triangulation",
"algorithm",
"."
] | train | https://github.com/ratcave/wavefront_reader/blob/c515164a3952d6b85f8044f429406fddd862bfd0/wavefront_reader/writing.py#L26-L33 |
ratcave/wavefront_reader | wavefront_reader/writing.py | WavefrontWriter.from_dicts | def from_dicts(cls, mesh_name, vert_dict, normal_dict):
"""Returns a wavefront .obj string using pre-triangulated vertex dict and normal dict as reference."""
# Put header in string
wavefront_str = "o {name}\n".format(name=mesh_name)
# Write Vertex data from vert_dict
for wall ... | python | def from_dicts(cls, mesh_name, vert_dict, normal_dict):
"""Returns a wavefront .obj string using pre-triangulated vertex dict and normal dict as reference."""
# Put header in string
wavefront_str = "o {name}\n".format(name=mesh_name)
# Write Vertex data from vert_dict
for wall ... | [
"def",
"from_dicts",
"(",
"cls",
",",
"mesh_name",
",",
"vert_dict",
",",
"normal_dict",
")",
":",
"# Put header in string",
"wavefront_str",
"=",
"\"o {name}\\n\"",
".",
"format",
"(",
"name",
"=",
"mesh_name",
")",
"# Write Vertex data from vert_dict",
"for",
"wal... | Returns a wavefront .obj string using pre-triangulated vertex dict and normal dict as reference. | [
"Returns",
"a",
"wavefront",
".",
"obj",
"string",
"using",
"pre",
"-",
"triangulated",
"vertex",
"dict",
"and",
"normal",
"dict",
"as",
"reference",
"."
] | train | https://github.com/ratcave/wavefront_reader/blob/c515164a3952d6b85f8044f429406fddd862bfd0/wavefront_reader/writing.py#L47-L76 |
ratcave/wavefront_reader | wavefront_reader/writing.py | WavefrontWriter.from_arrays | def from_arrays(cls, name, verts, normals, n_verts=3):
"""Returns a wavefront .obj string using pre-triangulated vertex dict and normal dict as reference."""
# Put header in string
wavefront_str = "o {name}\n".format(name=name)
# Write Vertex data from vert_dict
for vert in ve... | python | def from_arrays(cls, name, verts, normals, n_verts=3):
"""Returns a wavefront .obj string using pre-triangulated vertex dict and normal dict as reference."""
# Put header in string
wavefront_str = "o {name}\n".format(name=name)
# Write Vertex data from vert_dict
for vert in ve... | [
"def",
"from_arrays",
"(",
"cls",
",",
"name",
",",
"verts",
",",
"normals",
",",
"n_verts",
"=",
"3",
")",
":",
"# Put header in string",
"wavefront_str",
"=",
"\"o {name}\\n\"",
".",
"format",
"(",
"name",
"=",
"name",
")",
"# Write Vertex data from vert_dict"... | Returns a wavefront .obj string using pre-triangulated vertex dict and normal dict as reference. | [
"Returns",
"a",
"wavefront",
".",
"obj",
"string",
"using",
"pre",
"-",
"triangulated",
"vertex",
"dict",
"and",
"normal",
"dict",
"as",
"reference",
"."
] | train | https://github.com/ratcave/wavefront_reader/blob/c515164a3952d6b85f8044f429406fddd862bfd0/wavefront_reader/writing.py#L79-L104 |
ratcave/wavefront_reader | wavefront_reader/writing.py | WavefrontWriter.from_indexed_arrays | def from_indexed_arrays(cls, name, verts, normals):
"""Takes MxNx3 verts, Mx3 normals to build obj file"""
# Put header in string
wavefront_str = "o {name}\n".format(name=name)
new_verts, face_indices = face_index(verts)
assert new_verts.shape[1] == 3, "verts should be Nx3 arr... | python | def from_indexed_arrays(cls, name, verts, normals):
"""Takes MxNx3 verts, Mx3 normals to build obj file"""
# Put header in string
wavefront_str = "o {name}\n".format(name=name)
new_verts, face_indices = face_index(verts)
assert new_verts.shape[1] == 3, "verts should be Nx3 arr... | [
"def",
"from_indexed_arrays",
"(",
"cls",
",",
"name",
",",
"verts",
",",
"normals",
")",
":",
"# Put header in string",
"wavefront_str",
"=",
"\"o {name}\\n\"",
".",
"format",
"(",
"name",
"=",
"name",
")",
"new_verts",
",",
"face_indices",
"=",
"face_index",
... | Takes MxNx3 verts, Mx3 normals to build obj file | [
"Takes",
"MxNx3",
"verts",
"Mx3",
"normals",
"to",
"build",
"obj",
"file"
] | train | https://github.com/ratcave/wavefront_reader/blob/c515164a3952d6b85f8044f429406fddd862bfd0/wavefront_reader/writing.py#L107-L137 |
ratcave/wavefront_reader | wavefront_reader/writing.py | WavefrontWriter.dump | def dump(self, f):
"""Write Wavefront data to file. Takes File object or filename."""
try:
f.write(self._data)
except AttributeError:
with open(f, 'w') as wf:
wf.write(self._data) | python | def dump(self, f):
"""Write Wavefront data to file. Takes File object or filename."""
try:
f.write(self._data)
except AttributeError:
with open(f, 'w') as wf:
wf.write(self._data) | [
"def",
"dump",
"(",
"self",
",",
"f",
")",
":",
"try",
":",
"f",
".",
"write",
"(",
"self",
".",
"_data",
")",
"except",
"AttributeError",
":",
"with",
"open",
"(",
"f",
",",
"'w'",
")",
"as",
"wf",
":",
"wf",
".",
"write",
"(",
"self",
".",
... | Write Wavefront data to file. Takes File object or filename. | [
"Write",
"Wavefront",
"data",
"to",
"file",
".",
"Takes",
"File",
"object",
"or",
"filename",
"."
] | train | https://github.com/ratcave/wavefront_reader/blob/c515164a3952d6b85f8044f429406fddd862bfd0/wavefront_reader/writing.py#L139-L145 |
jvarho/pylibscrypt | pylibscrypt/pyscrypt.py | scrypt | def scrypt(password, salt, N=SCRYPT_N, r=SCRYPT_r, p=SCRYPT_p, olen=64):
"""Returns a key derived using the scrypt key-derivarion function
N must be a power of two larger than 1 but no larger than 2 ** 63 (insane)
r and p must be positive numbers such that r * p < 2 ** 30
The default values are:
N... | python | def scrypt(password, salt, N=SCRYPT_N, r=SCRYPT_r, p=SCRYPT_p, olen=64):
"""Returns a key derived using the scrypt key-derivarion function
N must be a power of two larger than 1 but no larger than 2 ** 63 (insane)
r and p must be positive numbers such that r * p < 2 ** 30
The default values are:
N... | [
"def",
"scrypt",
"(",
"password",
",",
"salt",
",",
"N",
"=",
"SCRYPT_N",
",",
"r",
"=",
"SCRYPT_r",
",",
"p",
"=",
"SCRYPT_p",
",",
"olen",
"=",
"64",
")",
":",
"check_args",
"(",
"password",
",",
"salt",
",",
"N",
",",
"r",
",",
"p",
",",
"ol... | Returns a key derived using the scrypt key-derivarion function
N must be a power of two larger than 1 but no larger than 2 ** 63 (insane)
r and p must be positive numbers such that r * p < 2 ** 30
The default values are:
N -- 2**14 (~16k)
r -- 8
p -- 1
Memory usage is proportional to N*r.... | [
"Returns",
"a",
"key",
"derived",
"using",
"the",
"scrypt",
"key",
"-",
"derivarion",
"function"
] | train | https://github.com/jvarho/pylibscrypt/blob/f2ff02e49f44aa620e308a4a64dd8376b9510f99/pylibscrypt/pyscrypt.py#L37-L61 |
mfcloud/python-zvm-sdk | smtLayer/cmdVM.py | doIt | def doIt(rh):
"""
Perform the requested function by invoking the subfunction handler.
Input:
Request Handle
Output:
Request Handle updated with parsed input.
Return code - 0: ok, non-zero: error
"""
rh.printSysLog("Enter cmdVM.doIt")
# Show the invocation parameters,... | python | def doIt(rh):
"""
Perform the requested function by invoking the subfunction handler.
Input:
Request Handle
Output:
Request Handle updated with parsed input.
Return code - 0: ok, non-zero: error
"""
rh.printSysLog("Enter cmdVM.doIt")
# Show the invocation parameters,... | [
"def",
"doIt",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter cmdVM.doIt\"",
")",
"# Show the invocation parameters, if requested.",
"if",
"'showParms'",
"in",
"rh",
".",
"parms",
"and",
"rh",
".",
"parms",
"[",
"'showParms'",
"]",
"is",
"True",
... | Perform the requested function by invoking the subfunction handler.
Input:
Request Handle
Output:
Request Handle updated with parsed input.
Return code - 0: ok, non-zero: error | [
"Perform",
"the",
"requested",
"function",
"by",
"invoking",
"the",
"subfunction",
"handler",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/cmdVM.py#L66-L98 |
mfcloud/python-zvm-sdk | smtLayer/cmdVM.py | invokeCmd | def invokeCmd(rh):
"""
Invoke the command in the virtual machine's operating system.
Input:
Request Handle with the following properties:
function - 'CMDVM'
subfunction - 'CMD'
userid - userid of the virtual machine
parms['cmd'] - Command to send
... | python | def invokeCmd(rh):
"""
Invoke the command in the virtual machine's operating system.
Input:
Request Handle with the following properties:
function - 'CMDVM'
subfunction - 'CMD'
userid - userid of the virtual machine
parms['cmd'] - Command to send
... | [
"def",
"invokeCmd",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter cmdVM.invokeCmd, userid: \"",
"+",
"rh",
".",
"userid",
")",
"results",
"=",
"execCmdThruIUCV",
"(",
"rh",
",",
"rh",
".",
"userid",
",",
"rh",
".",
"parms",
"[",
"'cmd'",
"... | Invoke the command in the virtual machine's operating system.
Input:
Request Handle with the following properties:
function - 'CMDVM'
subfunction - 'CMD'
userid - userid of the virtual machine
parms['cmd'] - Command to send
Output:
Request Handle... | [
"Invoke",
"the",
"command",
"in",
"the",
"virtual",
"machine",
"s",
"operating",
"system",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/cmdVM.py#L134-L161 |
mfcloud/python-zvm-sdk | smtLayer/cmdVM.py | parseCmdline | def parseCmdline(rh):
"""
Parse the request command input.
Input:
Request Handle
Output:
Request Handle updated with parsed input.
Return code - 0: ok, non-zero: error
"""
rh.printSysLog("Enter cmdVM.parseCmdline")
if rh.totalParms >= 2:
rh.userid = rh.reques... | python | def parseCmdline(rh):
"""
Parse the request command input.
Input:
Request Handle
Output:
Request Handle updated with parsed input.
Return code - 0: ok, non-zero: error
"""
rh.printSysLog("Enter cmdVM.parseCmdline")
if rh.totalParms >= 2:
rh.userid = rh.reques... | [
"def",
"parseCmdline",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter cmdVM.parseCmdline\"",
")",
"if",
"rh",
".",
"totalParms",
">=",
"2",
":",
"rh",
".",
"userid",
"=",
"rh",
".",
"request",
"[",
"1",
"]",
".",
"upper",
"(",
")",
"els... | Parse the request command input.
Input:
Request Handle
Output:
Request Handle updated with parsed input.
Return code - 0: ok, non-zero: error | [
"Parse",
"the",
"request",
"command",
"input",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/cmdVM.py#L164-L211 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient._generate_vdev | def _generate_vdev(self, base, offset):
"""Generate virtual device number based on base vdev
:param base: base virtual device number, string of 4 bit hex.
:param offset: offset to base, integer.
"""
vdev = hex(int(base, 16) + offset)[2:]
return vdev.rjust(4, '0') | python | def _generate_vdev(self, base, offset):
"""Generate virtual device number based on base vdev
:param base: base virtual device number, string of 4 bit hex.
:param offset: offset to base, integer.
"""
vdev = hex(int(base, 16) + offset)[2:]
return vdev.rjust(4, '0') | [
"def",
"_generate_vdev",
"(",
"self",
",",
"base",
",",
"offset",
")",
":",
"vdev",
"=",
"hex",
"(",
"int",
"(",
"base",
",",
"16",
")",
"+",
"offset",
")",
"[",
"2",
":",
"]",
"return",
"vdev",
".",
"rjust",
"(",
"4",
",",
"'0'",
")"
] | Generate virtual device number based on base vdev
:param base: base virtual device number, string of 4 bit hex.
:param offset: offset to base, integer. | [
"Generate",
"virtual",
"device",
"number",
"based",
"on",
"base",
"vdev",
":",
"param",
"base",
":",
"base",
"virtual",
"device",
"number",
"string",
"of",
"4",
"bit",
"hex",
".",
":",
"param",
"offset",
":",
"offset",
"to",
"base",
"integer",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L118-L124 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient.generate_disk_vdev | def generate_disk_vdev(self, start_vdev=None, offset=0):
"""Generate virtual device number for disks
:param offset: offset of user_root_vdev.
:return: virtual device number, string of 4 bit hex.
"""
if not start_vdev:
start_vdev = CONF.zvm.user_root_vdev
vdev ... | python | def generate_disk_vdev(self, start_vdev=None, offset=0):
"""Generate virtual device number for disks
:param offset: offset of user_root_vdev.
:return: virtual device number, string of 4 bit hex.
"""
if not start_vdev:
start_vdev = CONF.zvm.user_root_vdev
vdev ... | [
"def",
"generate_disk_vdev",
"(",
"self",
",",
"start_vdev",
"=",
"None",
",",
"offset",
"=",
"0",
")",
":",
"if",
"not",
"start_vdev",
":",
"start_vdev",
"=",
"CONF",
".",
"zvm",
".",
"user_root_vdev",
"vdev",
"=",
"self",
".",
"_generate_vdev",
"(",
"s... | Generate virtual device number for disks
:param offset: offset of user_root_vdev.
:return: virtual device number, string of 4 bit hex. | [
"Generate",
"virtual",
"device",
"number",
"for",
"disks",
":",
"param",
"offset",
":",
"offset",
"of",
"user_root_vdev",
".",
":",
"return",
":",
"virtual",
"device",
"number",
"string",
"of",
"4",
"bit",
"hex",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L126-L140 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient.add_mdisks | def add_mdisks(self, userid, disk_list, start_vdev=None):
"""Add disks for the userid
:disks: A list dictionary to describe disk info, for example:
disk: [{'size': '1g',
'format': 'ext3',
'disk_pool': 'ECKD:eckdpool1'}]
"""
... | python | def add_mdisks(self, userid, disk_list, start_vdev=None):
"""Add disks for the userid
:disks: A list dictionary to describe disk info, for example:
disk: [{'size': '1g',
'format': 'ext3',
'disk_pool': 'ECKD:eckdpool1'}]
"""
... | [
"def",
"add_mdisks",
"(",
"self",
",",
"userid",
",",
"disk_list",
",",
"start_vdev",
"=",
"None",
")",
":",
"for",
"idx",
",",
"disk",
"in",
"enumerate",
"(",
"disk_list",
")",
":",
"if",
"'vdev'",
"in",
"disk",
":",
"# this means user want to create their ... | Add disks for the userid
:disks: A list dictionary to describe disk info, for example:
disk: [{'size': '1g',
'format': 'ext3',
'disk_pool': 'ECKD:eckdpool1'}] | [
"Add",
"disks",
"for",
"the",
"userid"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L142-L186 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient.dedicate_device | def dedicate_device(self, userid, vaddr, raddr, mode):
"""dedicate device
:userid: The name of the image obtaining a dedicated device
:vaddr: The virtual device number of the device
:raddr: A real device number to be dedicated or attached
to the specified image
:... | python | def dedicate_device(self, userid, vaddr, raddr, mode):
"""dedicate device
:userid: The name of the image obtaining a dedicated device
:vaddr: The virtual device number of the device
:raddr: A real device number to be dedicated or attached
to the specified image
:... | [
"def",
"dedicate_device",
"(",
"self",
",",
"userid",
",",
"vaddr",
",",
"raddr",
",",
"mode",
")",
":",
"# dedicate device to directory entry",
"self",
".",
"_dedicate_device",
"(",
"userid",
",",
"vaddr",
",",
"raddr",
",",
"mode",
")"
] | dedicate device
:userid: The name of the image obtaining a dedicated device
:vaddr: The virtual device number of the device
:raddr: A real device number to be dedicated or attached
to the specified image
:mode: Specify a 1 if the virtual device is to be in read-only mode... | [
"dedicate",
"device"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L192-L203 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient._dedicate_device | def _dedicate_device(self, userid, vaddr, raddr, mode):
"""dedicate device."""
action = 'dedicate'
rd = ('changevm %(uid)s %(act)s %(va)s %(ra)s %(mod)i' %
{'uid': userid, 'act': action,
'va': vaddr, 'ra': raddr, 'mod': mode})
action = "dedicate device to use... | python | def _dedicate_device(self, userid, vaddr, raddr, mode):
"""dedicate device."""
action = 'dedicate'
rd = ('changevm %(uid)s %(act)s %(va)s %(ra)s %(mod)i' %
{'uid': userid, 'act': action,
'va': vaddr, 'ra': raddr, 'mod': mode})
action = "dedicate device to use... | [
"def",
"_dedicate_device",
"(",
"self",
",",
"userid",
",",
"vaddr",
",",
"raddr",
",",
"mode",
")",
":",
"action",
"=",
"'dedicate'",
"rd",
"=",
"(",
"'changevm %(uid)s %(act)s %(va)s %(ra)s %(mod)i'",
"%",
"{",
"'uid'",
":",
"userid",
",",
"'act'",
":",
"a... | dedicate device. | [
"dedicate",
"device",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L205-L213 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient.get_fcp_info_by_status | def get_fcp_info_by_status(self, userid, status):
"""get fcp information by the status.
:userid: The name of the image to query fcp info
:status: The status of target fcps. eg:'active', 'free' or 'offline'.
"""
results = self._get_fcp_info_by_status(userid, status)
retu... | python | def get_fcp_info_by_status(self, userid, status):
"""get fcp information by the status.
:userid: The name of the image to query fcp info
:status: The status of target fcps. eg:'active', 'free' or 'offline'.
"""
results = self._get_fcp_info_by_status(userid, status)
retu... | [
"def",
"get_fcp_info_by_status",
"(",
"self",
",",
"userid",
",",
"status",
")",
":",
"results",
"=",
"self",
".",
"_get_fcp_info_by_status",
"(",
"userid",
",",
"status",
")",
"return",
"results"
] | get fcp information by the status.
:userid: The name of the image to query fcp info
:status: The status of target fcps. eg:'active', 'free' or 'offline'. | [
"get",
"fcp",
"information",
"by",
"the",
"status",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L215-L223 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient._undedicate_device | def _undedicate_device(self, userid, vaddr):
"""undedicate device."""
action = 'undedicate'
rd = ('changevm %(uid)s %(act)s %(va)s' %
{'uid': userid, 'act': action,
'va': vaddr})
action = "undedicate device from userid '%s'" % userid
with zvmutils.log... | python | def _undedicate_device(self, userid, vaddr):
"""undedicate device."""
action = 'undedicate'
rd = ('changevm %(uid)s %(act)s %(va)s' %
{'uid': userid, 'act': action,
'va': vaddr})
action = "undedicate device from userid '%s'" % userid
with zvmutils.log... | [
"def",
"_undedicate_device",
"(",
"self",
",",
"userid",
",",
"vaddr",
")",
":",
"action",
"=",
"'undedicate'",
"rd",
"=",
"(",
"'changevm %(uid)s %(act)s %(va)s'",
"%",
"{",
"'uid'",
":",
"userid",
",",
"'act'",
":",
"action",
",",
"'va'",
":",
"vaddr",
"... | undedicate device. | [
"undedicate",
"device",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L243-L251 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient.get_image_performance_info | def get_image_performance_info(self, userid):
"""Get CPU and memory usage information.
:userid: the zvm userid to be queried
"""
pi_dict = self.image_performance_query([userid])
return pi_dict.get(userid, None) | python | def get_image_performance_info(self, userid):
"""Get CPU and memory usage information.
:userid: the zvm userid to be queried
"""
pi_dict = self.image_performance_query([userid])
return pi_dict.get(userid, None) | [
"def",
"get_image_performance_info",
"(",
"self",
",",
"userid",
")",
":",
"pi_dict",
"=",
"self",
".",
"image_performance_query",
"(",
"[",
"userid",
"]",
")",
"return",
"pi_dict",
".",
"get",
"(",
"userid",
",",
"None",
")"
] | Get CPU and memory usage information.
:userid: the zvm userid to be queried | [
"Get",
"CPU",
"and",
"memory",
"usage",
"information",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L253-L259 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient._parse_vswitch_inspect_data | def _parse_vswitch_inspect_data(self, rd_list):
""" Parse the Virtual_Network_Vswitch_Query_Byte_Stats data to get
inspect data.
"""
def _parse_value(data_list, idx, keyword, offset):
return idx + offset, data_list[idx].rpartition(keyword)[2].strip()
vsw_dict = {}
... | python | def _parse_vswitch_inspect_data(self, rd_list):
""" Parse the Virtual_Network_Vswitch_Query_Byte_Stats data to get
inspect data.
"""
def _parse_value(data_list, idx, keyword, offset):
return idx + offset, data_list[idx].rpartition(keyword)[2].strip()
vsw_dict = {}
... | [
"def",
"_parse_vswitch_inspect_data",
"(",
"self",
",",
"rd_list",
")",
":",
"def",
"_parse_value",
"(",
"data_list",
",",
"idx",
",",
"keyword",
",",
"offset",
")",
":",
"return",
"idx",
"+",
"offset",
",",
"data_list",
"[",
"idx",
"]",
".",
"rpartition",... | Parse the Virtual_Network_Vswitch_Query_Byte_Stats data to get
inspect data. | [
"Parse",
"the",
"Virtual_Network_Vswitch_Query_Byte_Stats",
"data",
"to",
"get",
"inspect",
"data",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L261-L334 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient.get_power_state | def get_power_state(self, userid):
"""Get power status of a z/VM instance."""
LOG.debug('Querying power stat of %s' % userid)
requestData = "PowerVM " + userid + " status"
action = "query power state of '%s'" % userid
with zvmutils.log_and_reraise_smt_request_failed(action):
... | python | def get_power_state(self, userid):
"""Get power status of a z/VM instance."""
LOG.debug('Querying power stat of %s' % userid)
requestData = "PowerVM " + userid + " status"
action = "query power state of '%s'" % userid
with zvmutils.log_and_reraise_smt_request_failed(action):
... | [
"def",
"get_power_state",
"(",
"self",
",",
"userid",
")",
":",
"LOG",
".",
"debug",
"(",
"'Querying power stat of %s'",
"%",
"userid",
")",
"requestData",
"=",
"\"PowerVM \"",
"+",
"userid",
"+",
"\" status\"",
"action",
"=",
"\"query power state of '%s'\"",
"%",... | Get power status of a z/VM instance. | [
"Get",
"power",
"status",
"of",
"a",
"z",
"/",
"VM",
"instance",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L346-L355 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient.guest_start | def guest_start(self, userid):
"""Power on VM."""
requestData = "PowerVM " + userid + " on"
with zvmutils.log_and_reraise_smt_request_failed():
self._request(requestData) | python | def guest_start(self, userid):
"""Power on VM."""
requestData = "PowerVM " + userid + " on"
with zvmutils.log_and_reraise_smt_request_failed():
self._request(requestData) | [
"def",
"guest_start",
"(",
"self",
",",
"userid",
")",
":",
"requestData",
"=",
"\"PowerVM \"",
"+",
"userid",
"+",
"\" on\"",
"with",
"zvmutils",
".",
"log_and_reraise_smt_request_failed",
"(",
")",
":",
"self",
".",
"_request",
"(",
"requestData",
")"
] | Power on VM. | [
"Power",
"on",
"VM",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L368-L372 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient.guest_stop | def guest_stop(self, userid, **kwargs):
"""Power off VM."""
requestData = "PowerVM " + userid + " off"
if 'timeout' in kwargs.keys() and kwargs['timeout']:
requestData += ' --maxwait ' + str(kwargs['timeout'])
if 'poll_interval' in kwargs.keys() and kwargs['poll_interval']:
... | python | def guest_stop(self, userid, **kwargs):
"""Power off VM."""
requestData = "PowerVM " + userid + " off"
if 'timeout' in kwargs.keys() and kwargs['timeout']:
requestData += ' --maxwait ' + str(kwargs['timeout'])
if 'poll_interval' in kwargs.keys() and kwargs['poll_interval']:
... | [
"def",
"guest_stop",
"(",
"self",
",",
"userid",
",",
"*",
"*",
"kwargs",
")",
":",
"requestData",
"=",
"\"PowerVM \"",
"+",
"userid",
"+",
"\" off\"",
"if",
"'timeout'",
"in",
"kwargs",
".",
"keys",
"(",
")",
"and",
"kwargs",
"[",
"'timeout'",
"]",
":... | Power off VM. | [
"Power",
"off",
"VM",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L374-L384 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient.live_migrate_move | def live_migrate_move(self, userid, destination, parms):
""" moves the specified virtual machine, while it continues to run,
to the specified system within the SSI cluster. """
rd = ('migratevm %(uid)s move --destination %(dest)s ' %
{'uid': userid, 'dest': destination})
... | python | def live_migrate_move(self, userid, destination, parms):
""" moves the specified virtual machine, while it continues to run,
to the specified system within the SSI cluster. """
rd = ('migratevm %(uid)s move --destination %(dest)s ' %
{'uid': userid, 'dest': destination})
... | [
"def",
"live_migrate_move",
"(",
"self",
",",
"userid",
",",
"destination",
",",
"parms",
")",
":",
"rd",
"=",
"(",
"'migratevm %(uid)s move --destination %(dest)s '",
"%",
"{",
"'uid'",
":",
"userid",
",",
"'dest'",
":",
"destination",
"}",
")",
"if",
"'maxto... | moves the specified virtual machine, while it continues to run,
to the specified system within the SSI cluster. | [
"moves",
"the",
"specified",
"virtual",
"machine",
"while",
"it",
"continues",
"to",
"run",
"to",
"the",
"specified",
"system",
"within",
"the",
"SSI",
"cluster",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L422-L451 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient.create_vm | def create_vm(self, userid, cpu, memory, disk_list, profile,
max_cpu, max_mem, ipl_from, ipl_param, ipl_loadparam):
""" Create VM and add disks if specified. """
rd = ('makevm %(uid)s directory LBYONLY %(mem)im %(pri)s '
'--cpus %(cpu)i --profile %(prof)s --maxCPU %(max_c... | python | def create_vm(self, userid, cpu, memory, disk_list, profile,
max_cpu, max_mem, ipl_from, ipl_param, ipl_loadparam):
""" Create VM and add disks if specified. """
rd = ('makevm %(uid)s directory LBYONLY %(mem)im %(pri)s '
'--cpus %(cpu)i --profile %(prof)s --maxCPU %(max_c... | [
"def",
"create_vm",
"(",
"self",
",",
"userid",
",",
"cpu",
",",
"memory",
",",
"disk_list",
",",
"profile",
",",
"max_cpu",
",",
"max_mem",
",",
"ipl_from",
",",
"ipl_param",
",",
"ipl_loadparam",
")",
":",
"rd",
"=",
"(",
"'makevm %(uid)s directory LBYONLY... | Create VM and add disks if specified. | [
"Create",
"VM",
"and",
"add",
"disks",
"if",
"specified",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L479-L531 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient._add_mdisk | def _add_mdisk(self, userid, disk, vdev):
"""Create one disk for userid
NOTE: No read, write and multi password specified, and
access mode default as 'MR'.
"""
size = disk['size']
fmt = disk.get('format', 'ext4')
disk_pool = disk.get('disk_pool') or CONF.zvm.dis... | python | def _add_mdisk(self, userid, disk, vdev):
"""Create one disk for userid
NOTE: No read, write and multi password specified, and
access mode default as 'MR'.
"""
size = disk['size']
fmt = disk.get('format', 'ext4')
disk_pool = disk.get('disk_pool') or CONF.zvm.dis... | [
"def",
"_add_mdisk",
"(",
"self",
",",
"userid",
",",
"disk",
",",
"vdev",
")",
":",
"size",
"=",
"disk",
"[",
"'size'",
"]",
"fmt",
"=",
"disk",
".",
"get",
"(",
"'format'",
",",
"'ext4'",
")",
"disk_pool",
"=",
"disk",
".",
"get",
"(",
"'disk_poo... | Create one disk for userid
NOTE: No read, write and multi password specified, and
access mode default as 'MR'. | [
"Create",
"one",
"disk",
"for",
"userid"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L533-L557 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient.get_vm_list | def get_vm_list(self):
"""Get the list of guests that are created by SDK
return userid list"""
action = "list all guests in database"
with zvmutils.log_and_reraise_sdkbase_error(action):
guests_in_db = self._GuestDbOperator.get_guest_list()
guests_migrated = self.... | python | def get_vm_list(self):
"""Get the list of guests that are created by SDK
return userid list"""
action = "list all guests in database"
with zvmutils.log_and_reraise_sdkbase_error(action):
guests_in_db = self._GuestDbOperator.get_guest_list()
guests_migrated = self.... | [
"def",
"get_vm_list",
"(",
"self",
")",
":",
"action",
"=",
"\"list all guests in database\"",
"with",
"zvmutils",
".",
"log_and_reraise_sdkbase_error",
"(",
"action",
")",
":",
"guests_in_db",
"=",
"self",
".",
"_GuestDbOperator",
".",
"get_guest_list",
"(",
")",
... | Get the list of guests that are created by SDK
return userid list | [
"Get",
"the",
"list",
"of",
"guests",
"that",
"are",
"created",
"by",
"SDK",
"return",
"userid",
"list"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L559-L572 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient.guest_authorize_iucv_client | def guest_authorize_iucv_client(self, userid, client=None):
"""Punch a script that used to set the authorized client userid in vm
If the guest is in log off status, the change will take effect when
the guest start up at first time.
If the guest is in active status, power off and power on... | python | def guest_authorize_iucv_client(self, userid, client=None):
"""Punch a script that used to set the authorized client userid in vm
If the guest is in log off status, the change will take effect when
the guest start up at first time.
If the guest is in active status, power off and power on... | [
"def",
"guest_authorize_iucv_client",
"(",
"self",
",",
"userid",
",",
"client",
"=",
"None",
")",
":",
"client",
"=",
"client",
"or",
"zvmutils",
".",
"get_smt_userid",
"(",
")",
"iucv_path",
"=",
"\"/tmp/\"",
"+",
"userid",
"if",
"not",
"os",
".",
"path"... | Punch a script that used to set the authorized client userid in vm
If the guest is in log off status, the change will take effect when
the guest start up at first time.
If the guest is in active status, power off and power on are needed
for the change to take effect.
:param str ... | [
"Punch",
"a",
"script",
"that",
"used",
"to",
"set",
"the",
"authorized",
"client",
"userid",
"in",
"vm",
"If",
"the",
"guest",
"is",
"in",
"log",
"off",
"status",
"the",
"change",
"will",
"take",
"effect",
"when",
"the",
"guest",
"start",
"up",
"at",
... | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L580-L609 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient.guest_deploy | def guest_deploy(self, userid, image_name, transportfiles=None,
remotehost=None, vdev=None):
""" Deploy image and punch config driver to target """
# (TODO: add the support of multiple disks deploy)
msg = ('Start to deploy image %(img)s to guest %(vm)s'
% {'i... | python | def guest_deploy(self, userid, image_name, transportfiles=None,
remotehost=None, vdev=None):
""" Deploy image and punch config driver to target """
# (TODO: add the support of multiple disks deploy)
msg = ('Start to deploy image %(img)s to guest %(vm)s'
% {'i... | [
"def",
"guest_deploy",
"(",
"self",
",",
"userid",
",",
"image_name",
",",
"transportfiles",
"=",
"None",
",",
"remotehost",
"=",
"None",
",",
"vdev",
"=",
"None",
")",
":",
"# (TODO: add the support of multiple disks deploy)",
"msg",
"=",
"(",
"'Start to deploy i... | Deploy image and punch config driver to target | [
"Deploy",
"image",
"and",
"punch",
"config",
"driver",
"to",
"target"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L611-L692 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient.grant_user_to_vswitch | def grant_user_to_vswitch(self, vswitch_name, userid):
"""Set vswitch to grant user."""
smt_userid = zvmutils.get_smt_userid()
requestData = ' '.join((
'SMAPI %s API Virtual_Network_Vswitch_Set_Extended' % smt_userid,
"--operands",
"-k switch_name=%s" % vswitc... | python | def grant_user_to_vswitch(self, vswitch_name, userid):
"""Set vswitch to grant user."""
smt_userid = zvmutils.get_smt_userid()
requestData = ' '.join((
'SMAPI %s API Virtual_Network_Vswitch_Set_Extended' % smt_userid,
"--operands",
"-k switch_name=%s" % vswitc... | [
"def",
"grant_user_to_vswitch",
"(",
"self",
",",
"vswitch_name",
",",
"userid",
")",
":",
"smt_userid",
"=",
"zvmutils",
".",
"get_smt_userid",
"(",
")",
"requestData",
"=",
"' '",
".",
"join",
"(",
"(",
"'SMAPI %s API Virtual_Network_Vswitch_Set_Extended'",
"%",
... | Set vswitch to grant user. | [
"Set",
"vswitch",
"to",
"grant",
"user",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L926-L941 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient.image_performance_query | def image_performance_query(self, uid_list):
"""Call Image_Performance_Query to get guest current status.
:uid_list: A list of zvm userids to be queried
"""
if uid_list == []:
return {}
if not isinstance(uid_list, list):
uid_list = [uid_list]
sm... | python | def image_performance_query(self, uid_list):
"""Call Image_Performance_Query to get guest current status.
:uid_list: A list of zvm userids to be queried
"""
if uid_list == []:
return {}
if not isinstance(uid_list, list):
uid_list = [uid_list]
sm... | [
"def",
"image_performance_query",
"(",
"self",
",",
"uid_list",
")",
":",
"if",
"uid_list",
"==",
"[",
"]",
":",
"return",
"{",
"}",
"if",
"not",
"isinstance",
"(",
"uid_list",
",",
"list",
")",
":",
"uid_list",
"=",
"[",
"uid_list",
"]",
"smt_userid",
... | Call Image_Performance_Query to get guest current status.
:uid_list: A list of zvm userids to be queried | [
"Call",
"Image_Performance_Query",
"to",
"get",
"guest",
"current",
"status",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L985-L1041 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient.system_image_performance_query | def system_image_performance_query(self, namelist):
"""Call System_Image_Performance_Query to get guest current status.
:namelist: A namelist that defined in smapi namelist file.
"""
smt_userid = zvmutils.get_smt_userid()
rd = ' '.join((
"SMAPI %s API System_Image_Pe... | python | def system_image_performance_query(self, namelist):
"""Call System_Image_Performance_Query to get guest current status.
:namelist: A namelist that defined in smapi namelist file.
"""
smt_userid = zvmutils.get_smt_userid()
rd = ' '.join((
"SMAPI %s API System_Image_Pe... | [
"def",
"system_image_performance_query",
"(",
"self",
",",
"namelist",
")",
":",
"smt_userid",
"=",
"zvmutils",
".",
"get_smt_userid",
"(",
")",
"rd",
"=",
"' '",
".",
"join",
"(",
"(",
"\"SMAPI %s API System_Image_Performance_Query\"",
"%",
"smt_userid",
",",
"\"... | Call System_Image_Performance_Query to get guest current status.
:namelist: A namelist that defined in smapi namelist file. | [
"Call",
"System_Image_Performance_Query",
"to",
"get",
"guest",
"current",
"status",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L1043-L1091 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient.set_vswitch | def set_vswitch(self, switch_name, **kwargs):
"""Set vswitch"""
smt_userid = zvmutils.get_smt_userid()
rd = ' '.join((
"SMAPI %s API Virtual_Network_Vswitch_Set_Extended" %
smt_userid,
"--operands",
"-k switch_name=%s" % switch_name))
for ... | python | def set_vswitch(self, switch_name, **kwargs):
"""Set vswitch"""
smt_userid = zvmutils.get_smt_userid()
rd = ' '.join((
"SMAPI %s API Virtual_Network_Vswitch_Set_Extended" %
smt_userid,
"--operands",
"-k switch_name=%s" % switch_name))
for ... | [
"def",
"set_vswitch",
"(",
"self",
",",
"switch_name",
",",
"*",
"*",
"kwargs",
")",
":",
"smt_userid",
"=",
"zvmutils",
".",
"get_smt_userid",
"(",
")",
"rd",
"=",
"' '",
".",
"join",
"(",
"(",
"\"SMAPI %s API Virtual_Network_Vswitch_Set_Extended\"",
"%",
"sm... | Set vswitch | [
"Set",
"vswitch"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L1224-L1243 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient._couple_nic | def _couple_nic(self, userid, vdev, vswitch_name,
active=False):
"""Couple NIC to vswitch by adding vswitch into user direct."""
if active:
self._is_active(userid)
msg = ('Start to couple nic device %(vdev)s of guest %(vm)s '
'with vswitch %(vsw)s'... | python | def _couple_nic(self, userid, vdev, vswitch_name,
active=False):
"""Couple NIC to vswitch by adding vswitch into user direct."""
if active:
self._is_active(userid)
msg = ('Start to couple nic device %(vdev)s of guest %(vm)s '
'with vswitch %(vsw)s'... | [
"def",
"_couple_nic",
"(",
"self",
",",
"userid",
",",
"vdev",
",",
"vswitch_name",
",",
"active",
"=",
"False",
")",
":",
"if",
"active",
":",
"self",
".",
"_is_active",
"(",
"userid",
")",
"msg",
"=",
"(",
"'Start to couple nic device %(vdev)s of guest %(vm)... | Couple NIC to vswitch by adding vswitch into user direct. | [
"Couple",
"NIC",
"to",
"vswitch",
"by",
"adding",
"vswitch",
"into",
"user",
"direct",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L1580-L1658 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient.couple_nic_to_vswitch | def couple_nic_to_vswitch(self, userid, nic_vdev,
vswitch_name, active=False):
"""Couple nic to vswitch."""
if active:
msg = ("both in the user direct of guest %s and on "
"the active guest system" % userid)
else:
msg = "in... | python | def couple_nic_to_vswitch(self, userid, nic_vdev,
vswitch_name, active=False):
"""Couple nic to vswitch."""
if active:
msg = ("both in the user direct of guest %s and on "
"the active guest system" % userid)
else:
msg = "in... | [
"def",
"couple_nic_to_vswitch",
"(",
"self",
",",
"userid",
",",
"nic_vdev",
",",
"vswitch_name",
",",
"active",
"=",
"False",
")",
":",
"if",
"active",
":",
"msg",
"=",
"(",
"\"both in the user direct of guest %s and on \"",
"\"the active guest system\"",
"%",
"use... | Couple nic to vswitch. | [
"Couple",
"nic",
"to",
"vswitch",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L1660-L1670 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient._uncouple_nic | def _uncouple_nic(self, userid, vdev, active=False):
"""Uncouple NIC from vswitch"""
if active:
self._is_active(userid)
msg = ('Start to uncouple nic device %(vdev)s of guest %(vm)s'
% {'vdev': vdev, 'vm': userid})
LOG.info(msg)
requestData = ' '.join... | python | def _uncouple_nic(self, userid, vdev, active=False):
"""Uncouple NIC from vswitch"""
if active:
self._is_active(userid)
msg = ('Start to uncouple nic device %(vdev)s of guest %(vm)s'
% {'vdev': vdev, 'vm': userid})
LOG.info(msg)
requestData = ' '.join... | [
"def",
"_uncouple_nic",
"(",
"self",
",",
"userid",
",",
"vdev",
",",
"active",
"=",
"False",
")",
":",
"if",
"active",
":",
"self",
".",
"_is_active",
"(",
"userid",
")",
"msg",
"=",
"(",
"'Start to uncouple nic device %(vdev)s of guest %(vm)s'",
"%",
"{",
... | Uncouple NIC from vswitch | [
"Uncouple",
"NIC",
"from",
"vswitch"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L1702-L1761 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient.execute_cmd | def execute_cmd(self, userid, cmdStr):
""""cmdVM."""
requestData = 'cmdVM ' + userid + ' CMD \'' + cmdStr + '\''
with zvmutils.log_and_reraise_smt_request_failed(action='execute '
'command on vm via iucv channel'):
results = self._request(requestData)
ret = results['... | python | def execute_cmd(self, userid, cmdStr):
""""cmdVM."""
requestData = 'cmdVM ' + userid + ' CMD \'' + cmdStr + '\''
with zvmutils.log_and_reraise_smt_request_failed(action='execute '
'command on vm via iucv channel'):
results = self._request(requestData)
ret = results['... | [
"def",
"execute_cmd",
"(",
"self",
",",
"userid",
",",
"cmdStr",
")",
":",
"requestData",
"=",
"'cmdVM '",
"+",
"userid",
"+",
"' CMD \\''",
"+",
"cmdStr",
"+",
"'\\''",
"with",
"zvmutils",
".",
"log_and_reraise_smt_request_failed",
"(",
"action",
"=",
"'execu... | cmdVM. | [
"cmdVM",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L1819-L1827 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient.execute_cmd_direct | def execute_cmd_direct(self, userid, cmdStr):
""""cmdVM."""
requestData = 'cmdVM ' + userid + ' CMD \'' + cmdStr + '\''
results = self._smt.request(requestData)
return results | python | def execute_cmd_direct(self, userid, cmdStr):
""""cmdVM."""
requestData = 'cmdVM ' + userid + ' CMD \'' + cmdStr + '\''
results = self._smt.request(requestData)
return results | [
"def",
"execute_cmd_direct",
"(",
"self",
",",
"userid",
",",
"cmdStr",
")",
":",
"requestData",
"=",
"'cmdVM '",
"+",
"userid",
"+",
"' CMD \\''",
"+",
"cmdStr",
"+",
"'\\''",
"results",
"=",
"self",
".",
"_smt",
".",
"request",
"(",
"requestData",
")",
... | cmdVM. | [
"cmdVM",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L1829-L1833 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient.image_import | def image_import(self, image_name, url, image_meta, remote_host=None):
"""Import the image specified in url to SDK image repository, and
create a record in image db, the imported images are located in
image_repository/prov_method/os_version/image_name/, for example,
/opt/sdk/images/netbo... | python | def image_import(self, image_name, url, image_meta, remote_host=None):
"""Import the image specified in url to SDK image repository, and
create a record in image db, the imported images are located in
image_repository/prov_method/os_version/image_name/, for example,
/opt/sdk/images/netbo... | [
"def",
"image_import",
"(",
"self",
",",
"image_name",
",",
"url",
",",
"image_meta",
",",
"remote_host",
"=",
"None",
")",
":",
"image_info",
"=",
"[",
"]",
"try",
":",
"image_info",
"=",
"self",
".",
"_ImageDbOperator",
".",
"image_query_record",
"(",
"i... | Import the image specified in url to SDK image repository, and
create a record in image db, the imported images are located in
image_repository/prov_method/os_version/image_name/, for example,
/opt/sdk/images/netboot/rhel7.2/90685d2b-167bimage/0100 | [
"Import",
"the",
"image",
"specified",
"in",
"url",
"to",
"SDK",
"image",
"repository",
"and",
"create",
"a",
"record",
"in",
"image",
"db",
"the",
"imported",
"images",
"are",
"located",
"in",
"image_repository",
"/",
"prov_method",
"/",
"os_version",
"/",
... | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L1835-L1919 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient.image_export | def image_export(self, image_name, dest_url, remote_host=None):
"""Export the specific image to remote host or local file system
:param image_name: image name that can be uniquely identify an image
:param dest_path: the location to store exported image, eg.
/opt/images, the image will be... | python | def image_export(self, image_name, dest_url, remote_host=None):
"""Export the specific image to remote host or local file system
:param image_name: image name that can be uniquely identify an image
:param dest_path: the location to store exported image, eg.
/opt/images, the image will be... | [
"def",
"image_export",
"(",
"self",
",",
"image_name",
",",
"dest_url",
",",
"remote_host",
"=",
"None",
")",
":",
"image_info",
"=",
"self",
".",
"_ImageDbOperator",
".",
"image_query_record",
"(",
"image_name",
")",
"if",
"not",
"image_info",
":",
"msg",
"... | Export the specific image to remote host or local file system
:param image_name: image name that can be uniquely identify an image
:param dest_path: the location to store exported image, eg.
/opt/images, the image will be stored in folder
/opt/images/
:param remote_host: the ser... | [
"Export",
"the",
"specific",
"image",
"to",
"remote",
"host",
"or",
"local",
"file",
"system",
":",
"param",
"image_name",
":",
"image",
"name",
"that",
"can",
"be",
"uniquely",
"identify",
"an",
"image",
":",
"param",
"dest_path",
":",
"the",
"location",
... | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L1921-L1969 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient._get_image_size | def _get_image_size(self, image_path):
"""Return disk size in bytes"""
command = 'du -b %s' % image_path
(rc, output) = zvmutils.execute(command)
if rc:
msg = ("Error happened when executing command du -b with"
"reason: %s" % output)
LOG.error(m... | python | def _get_image_size(self, image_path):
"""Return disk size in bytes"""
command = 'du -b %s' % image_path
(rc, output) = zvmutils.execute(command)
if rc:
msg = ("Error happened when executing command du -b with"
"reason: %s" % output)
LOG.error(m... | [
"def",
"_get_image_size",
"(",
"self",
",",
"image_path",
")",
":",
"command",
"=",
"'du -b %s'",
"%",
"image_path",
"(",
"rc",
",",
"output",
")",
"=",
"zvmutils",
".",
"execute",
"(",
"command",
")",
"if",
"rc",
":",
"msg",
"=",
"(",
"\"Error happened ... | Return disk size in bytes | [
"Return",
"disk",
"size",
"in",
"bytes"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L2007-L2017 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient._get_md5sum | def _get_md5sum(self, fpath):
"""Calculate the md5sum of the specific image file"""
try:
current_md5 = hashlib.md5()
if isinstance(fpath, six.string_types) and os.path.exists(fpath):
with open(fpath, "rb") as fh:
for chunk in self._read_chunks(... | python | def _get_md5sum(self, fpath):
"""Calculate the md5sum of the specific image file"""
try:
current_md5 = hashlib.md5()
if isinstance(fpath, six.string_types) and os.path.exists(fpath):
with open(fpath, "rb") as fh:
for chunk in self._read_chunks(... | [
"def",
"_get_md5sum",
"(",
"self",
",",
"fpath",
")",
":",
"try",
":",
"current_md5",
"=",
"hashlib",
".",
"md5",
"(",
")",
"if",
"isinstance",
"(",
"fpath",
",",
"six",
".",
"string_types",
")",
"and",
"os",
".",
"path",
".",
"exists",
"(",
"fpath",... | Calculate the md5sum of the specific image file | [
"Calculate",
"the",
"md5sum",
"of",
"the",
"specific",
"image",
"file"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L2047-L2066 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient.image_get_root_disk_size | def image_get_root_disk_size(self, image_name):
"""Return the root disk units of the specified image
image_name: the unique image name in db
Return the disk units in format like 3339:CYL or 467200:BLK
"""
image_info = self.image_query(image_name)
if not image_info:
... | python | def image_get_root_disk_size(self, image_name):
"""Return the root disk units of the specified image
image_name: the unique image name in db
Return the disk units in format like 3339:CYL or 467200:BLK
"""
image_info = self.image_query(image_name)
if not image_info:
... | [
"def",
"image_get_root_disk_size",
"(",
"self",
",",
"image_name",
")",
":",
"image_info",
"=",
"self",
".",
"image_query",
"(",
"image_name",
")",
"if",
"not",
"image_info",
":",
"raise",
"exception",
".",
"SDKImageOperationError",
"(",
"rs",
"=",
"20",
",",
... | Return the root disk units of the specified image
image_name: the unique image name in db
Return the disk units in format like 3339:CYL or 467200:BLK | [
"Return",
"the",
"root",
"disk",
"units",
"of",
"the",
"specified",
"image",
"image_name",
":",
"the",
"unique",
"image",
"name",
"in",
"db",
"Return",
"the",
"disk",
"units",
"in",
"format",
"like",
"3339",
":",
"CYL",
"or",
"467200",
":",
"BLK"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L2102-L2111 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient.get_guest_connection_status | def get_guest_connection_status(self, userid):
'''Get guest vm connection status.'''
rd = ' '.join(('getvm', userid, 'isreachable'))
results = self._request(rd)
if results['rs'] == 1:
return True
else:
return False | python | def get_guest_connection_status(self, userid):
'''Get guest vm connection status.'''
rd = ' '.join(('getvm', userid, 'isreachable'))
results = self._request(rd)
if results['rs'] == 1:
return True
else:
return False | [
"def",
"get_guest_connection_status",
"(",
"self",
",",
"userid",
")",
":",
"rd",
"=",
"' '",
".",
"join",
"(",
"(",
"'getvm'",
",",
"userid",
",",
"'isreachable'",
")",
")",
"results",
"=",
"self",
".",
"_request",
"(",
"rd",
")",
"if",
"results",
"["... | Get guest vm connection status. | [
"Get",
"guest",
"vm",
"connection",
"status",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L2125-L2132 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient.process_additional_minidisks | def process_additional_minidisks(self, userid, disk_info):
'''Generate and punch the scripts used to process additional disk into
target vm's reader.
'''
for idx, disk in enumerate(disk_info):
vdev = disk.get('vdev') or self.generate_disk_vdev(
... | python | def process_additional_minidisks(self, userid, disk_info):
'''Generate and punch the scripts used to process additional disk into
target vm's reader.
'''
for idx, disk in enumerate(disk_info):
vdev = disk.get('vdev') or self.generate_disk_vdev(
... | [
"def",
"process_additional_minidisks",
"(",
"self",
",",
"userid",
",",
"disk_info",
")",
":",
"for",
"idx",
",",
"disk",
"in",
"enumerate",
"(",
"disk_info",
")",
":",
"vdev",
"=",
"disk",
".",
"get",
"(",
"'vdev'",
")",
"or",
"self",
".",
"generate_dis... | Generate and punch the scripts used to process additional disk into
target vm's reader. | [
"Generate",
"and",
"punch",
"the",
"scripts",
"used",
"to",
"process",
"additional",
"disk",
"into",
"target",
"vm",
"s",
"reader",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L2145-L2161 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | SMTClient._request_with_error_ignored | def _request_with_error_ignored(self, rd):
"""Send smt request, log and ignore any errors."""
try:
return self._request(rd)
except Exception as err:
# log as warning and ignore namelist operation failures
LOG.warning(six.text_type(err)) | python | def _request_with_error_ignored(self, rd):
"""Send smt request, log and ignore any errors."""
try:
return self._request(rd)
except Exception as err:
# log as warning and ignore namelist operation failures
LOG.warning(six.text_type(err)) | [
"def",
"_request_with_error_ignored",
"(",
"self",
",",
"rd",
")",
":",
"try",
":",
"return",
"self",
".",
"_request",
"(",
"rd",
")",
"except",
"Exception",
"as",
"err",
":",
"# log as warning and ignore namelist operation failures",
"LOG",
".",
"warning",
"(",
... | Send smt request, log and ignore any errors. | [
"Send",
"smt",
"request",
"log",
"and",
"ignore",
"any",
"errors",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L2743-L2749 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | FilesystemBackend.image_import | def image_import(cls, image_name, url, target, **kwargs):
"""Import image from remote host to local image repository using scp.
If remote_host not specified, it means the source file exist in local
file system, just copy the image to image repository
"""
source = urlparse.urlpars... | python | def image_import(cls, image_name, url, target, **kwargs):
"""Import image from remote host to local image repository using scp.
If remote_host not specified, it means the source file exist in local
file system, just copy the image to image repository
"""
source = urlparse.urlpars... | [
"def",
"image_import",
"(",
"cls",
",",
"image_name",
",",
"url",
",",
"target",
",",
"*",
"*",
"kwargs",
")",
":",
"source",
"=",
"urlparse",
".",
"urlparse",
"(",
"url",
")",
".",
"path",
"if",
"kwargs",
"[",
"'remote_host'",
"]",
":",
"if",
"'@'",... | Import image from remote host to local image repository using scp.
If remote_host not specified, it means the source file exist in local
file system, just copy the image to image repository | [
"Import",
"image",
"from",
"remote",
"host",
"to",
"local",
"image",
"repository",
"using",
"scp",
".",
"If",
"remote_host",
"not",
"specified",
"it",
"means",
"the",
"source",
"file",
"exist",
"in",
"local",
"file",
"system",
"just",
"copy",
"the",
"image",... | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L3273-L3307 |
mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | FilesystemBackend.image_export | def image_export(cls, source_path, dest_url, **kwargs):
"""Export the specific image to remote host or local file system """
dest_path = urlparse.urlparse(dest_url).path
if kwargs['remote_host']:
target_path = ':'.join([kwargs['remote_host'], dest_path])
command = ' '.joi... | python | def image_export(cls, source_path, dest_url, **kwargs):
"""Export the specific image to remote host or local file system """
dest_path = urlparse.urlparse(dest_url).path
if kwargs['remote_host']:
target_path = ':'.join([kwargs['remote_host'], dest_path])
command = ' '.joi... | [
"def",
"image_export",
"(",
"cls",
",",
"source_path",
",",
"dest_url",
",",
"*",
"*",
"kwargs",
")",
":",
"dest_path",
"=",
"urlparse",
".",
"urlparse",
"(",
"dest_url",
")",
".",
"path",
"if",
"kwargs",
"[",
"'remote_host'",
"]",
":",
"target_path",
"=... | Export the specific image to remote host or local file system | [
"Export",
"the",
"specific",
"image",
"to",
"remote",
"host",
"or",
"local",
"file",
"system"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/smtclient.py#L3310-L3338 |
Chilipp/psyplot | psyplot/docstring.py | dedent | def dedent(func):
"""
Dedent the docstring of a function and substitute with :attr:`params`
Parameters
----------
func: function
function with the documentation to dedent"""
if isinstance(func, types.MethodType) and not six.PY3:
func = func.im_func
func.__doc__ = func.__doc_... | python | def dedent(func):
"""
Dedent the docstring of a function and substitute with :attr:`params`
Parameters
----------
func: function
function with the documentation to dedent"""
if isinstance(func, types.MethodType) and not six.PY3:
func = func.im_func
func.__doc__ = func.__doc_... | [
"def",
"dedent",
"(",
"func",
")",
":",
"if",
"isinstance",
"(",
"func",
",",
"types",
".",
"MethodType",
")",
"and",
"not",
"six",
".",
"PY3",
":",
"func",
"=",
"func",
".",
"im_func",
"func",
".",
"__doc__",
"=",
"func",
".",
"__doc__",
"and",
"d... | Dedent the docstring of a function and substitute with :attr:`params`
Parameters
----------
func: function
function with the documentation to dedent | [
"Dedent",
"the",
"docstring",
"of",
"a",
"function",
"and",
"substitute",
"with",
":",
"attr",
":",
"params"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/docstring.py#L12-L23 |
Chilipp/psyplot | psyplot/docstring.py | indent | def indent(text, num=4):
"""Indet the given string"""
str_indent = ' ' * num
return str_indent + ('\n' + str_indent).join(text.splitlines()) | python | def indent(text, num=4):
"""Indet the given string"""
str_indent = ' ' * num
return str_indent + ('\n' + str_indent).join(text.splitlines()) | [
"def",
"indent",
"(",
"text",
",",
"num",
"=",
"4",
")",
":",
"str_indent",
"=",
"' '",
"*",
"num",
"return",
"str_indent",
"+",
"(",
"'\\n'",
"+",
"str_indent",
")",
".",
"join",
"(",
"text",
".",
"splitlines",
"(",
")",
")"
] | Indet the given string | [
"Indet",
"the",
"given",
"string"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/docstring.py#L26-L29 |
Chilipp/psyplot | psyplot/docstring.py | append_original_doc | def append_original_doc(parent, num=0):
"""Return an iterator that append the docstring of the given `parent`
function to the applied function"""
def func(func):
func.__doc__ = func.__doc__ and func.__doc__ + indent(
parent.__doc__, num)
return func
return func | python | def append_original_doc(parent, num=0):
"""Return an iterator that append the docstring of the given `parent`
function to the applied function"""
def func(func):
func.__doc__ = func.__doc__ and func.__doc__ + indent(
parent.__doc__, num)
return func
return func | [
"def",
"append_original_doc",
"(",
"parent",
",",
"num",
"=",
"0",
")",
":",
"def",
"func",
"(",
"func",
")",
":",
"func",
".",
"__doc__",
"=",
"func",
".",
"__doc__",
"and",
"func",
".",
"__doc__",
"+",
"indent",
"(",
"parent",
".",
"__doc__",
",",
... | Return an iterator that append the docstring of the given `parent`
function to the applied function | [
"Return",
"an",
"iterator",
"that",
"append",
"the",
"docstring",
"of",
"the",
"given",
"parent",
"function",
"to",
"the",
"applied",
"function"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/docstring.py#L32-L39 |
Chilipp/psyplot | psyplot/docstring.py | PsyplotDocstringProcessor.get_sections | def get_sections(self, s, base, sections=[
'Parameters', 'Other Parameters', 'Possible types']):
"""
Extract the specified sections out of the given string
The same as the :meth:`docrep.DocstringProcessor.get_sections` method
but uses the ``'Possible types'`` section by defa... | python | def get_sections(self, s, base, sections=[
'Parameters', 'Other Parameters', 'Possible types']):
"""
Extract the specified sections out of the given string
The same as the :meth:`docrep.DocstringProcessor.get_sections` method
but uses the ``'Possible types'`` section by defa... | [
"def",
"get_sections",
"(",
"self",
",",
"s",
",",
"base",
",",
"sections",
"=",
"[",
"'Parameters'",
",",
"'Other Parameters'",
",",
"'Possible types'",
"]",
")",
":",
"return",
"super",
"(",
"PsyplotDocstringProcessor",
",",
"self",
")",
".",
"get_sections",... | Extract the specified sections out of the given string
The same as the :meth:`docrep.DocstringProcessor.get_sections` method
but uses the ``'Possible types'`` section by default, too
Parameters
----------
%(DocstringProcessor.get_sections.parameters)s
Returns
-... | [
"Extract",
"the",
"specified",
"sections",
"out",
"of",
"the",
"given",
"string"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/docstring.py#L57-L75 |
mfcloud/python-zvm-sdk | zvmsdk/configdrive.py | create_config_drive | def create_config_drive(network_interface_info, os_version):
"""Generate config driver for zVM guest vm.
:param dict network_interface_info: Required keys:
ip_addr - (str) IP address
nic_vdev - (str) VDEV of the nic
gateway_v4 - IPV4 gateway
broadcast_v4 - IPV4 broadcast address... | python | def create_config_drive(network_interface_info, os_version):
"""Generate config driver for zVM guest vm.
:param dict network_interface_info: Required keys:
ip_addr - (str) IP address
nic_vdev - (str) VDEV of the nic
gateway_v4 - IPV4 gateway
broadcast_v4 - IPV4 broadcast address... | [
"def",
"create_config_drive",
"(",
"network_interface_info",
",",
"os_version",
")",
":",
"temp_path",
"=",
"CONF",
".",
"guest",
".",
"temp_path",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"temp_path",
")",
":",
"os",
".",
"mkdir",
"(",
"temp_pa... | Generate config driver for zVM guest vm.
:param dict network_interface_info: Required keys:
ip_addr - (str) IP address
nic_vdev - (str) VDEV of the nic
gateway_v4 - IPV4 gateway
broadcast_v4 - IPV4 broadcast address
netmask_v4 - IPV4 netmask
:param str os_version: operat... | [
"Generate",
"config",
"driver",
"for",
"zVM",
"guest",
"vm",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/configdrive.py#L113-L153 |
jvarho/pylibscrypt | pylibscrypt/hashlibscrypt.py | scrypt | def scrypt(password, salt, N=SCRYPT_N, r=SCRYPT_r, p=SCRYPT_p, olen=64):
"""Returns a key derived using the scrypt key-derivarion function
N must be a power of two larger than 1 but no larger than 2 ** 63 (insane)
r and p must be positive numbers such that r * p < 2 ** 30
The default values are:
N... | python | def scrypt(password, salt, N=SCRYPT_N, r=SCRYPT_r, p=SCRYPT_p, olen=64):
"""Returns a key derived using the scrypt key-derivarion function
N must be a power of two larger than 1 but no larger than 2 ** 63 (insane)
r and p must be positive numbers such that r * p < 2 ** 30
The default values are:
N... | [
"def",
"scrypt",
"(",
"password",
",",
"salt",
",",
"N",
"=",
"SCRYPT_N",
",",
"r",
"=",
"SCRYPT_r",
",",
"p",
"=",
"SCRYPT_p",
",",
"olen",
"=",
"64",
")",
":",
"check_args",
"(",
"password",
",",
"salt",
",",
"N",
",",
"r",
",",
"p",
",",
"ol... | Returns a key derived using the scrypt key-derivarion function
N must be a power of two larger than 1 but no larger than 2 ** 63 (insane)
r and p must be positive numbers such that r * p < 2 ** 30
The default values are:
N -- 2**14 (~16k)
r -- 8
p -- 1
Memory usage is proportional to N*r.... | [
"Returns",
"a",
"key",
"derived",
"using",
"the",
"scrypt",
"key",
"-",
"derivarion",
"function"
] | train | https://github.com/jvarho/pylibscrypt/blob/f2ff02e49f44aa620e308a4a64dd8376b9510f99/pylibscrypt/hashlibscrypt.py#L30-L58 |
mfcloud/python-zvm-sdk | zvmsdk/monitor.py | MeteringCache.set | def set(self, ctype, key, data):
"""Set or update cache content.
:param ctype: cache type
:param key: the key to be set value
:param data: cache data
"""
with zvmutils.acquire_lock(self._lock):
target_cache = self._get_ctype_cache(ctype)
target_ca... | python | def set(self, ctype, key, data):
"""Set or update cache content.
:param ctype: cache type
:param key: the key to be set value
:param data: cache data
"""
with zvmutils.acquire_lock(self._lock):
target_cache = self._get_ctype_cache(ctype)
target_ca... | [
"def",
"set",
"(",
"self",
",",
"ctype",
",",
"key",
",",
"data",
")",
":",
"with",
"zvmutils",
".",
"acquire_lock",
"(",
"self",
".",
"_lock",
")",
":",
"target_cache",
"=",
"self",
".",
"_get_ctype_cache",
"(",
"ctype",
")",
"target_cache",
"[",
"'da... | Set or update cache content.
:param ctype: cache type
:param key: the key to be set value
:param data: cache data | [
"Set",
"or",
"update",
"cache",
"content",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/monitor.py#L190-L199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.