本文整理汇总了Python中wok.utils.wok_log.debug函数的典型用法代码示例。如果您正苦于以下问题:Python debug函数的具体用法?Python debug怎么用?Python debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: get_ipv4_info
def get_ipv4_info(self, info, cfgmap):
wok_log.debug('Begin get_ipv4_info')
if info.__len__() != 0 and cfgmap.__len__() != 0:
info[IPV4_ID] = {}
ipv4_info_keys = [BOOTPROTO, DEFROUTE, PEERROUTES, PEERDNS,
IPV4_FAILURE_FATAL]
for key in ipv4_info_keys:
if key in cfgmap:
info[IPV4_ID][key] = cfgmap[key]
if BOOTPROTO in cfgmap and (info[IPV4_ID][BOOTPROTO] == MANUAL or
info[IPV4_ID][BOOTPROTO] == STATIC):
info[IPV4_ID][IPV4Addresses] = \
cfgInterfacesHelper.get_ipv4_addresses(cfgmap)
dnsaddresses = cfgInterfacesHelper.get_dnsv4_info(cfgmap)
if len(dnsaddresses) > 0:
info[IPV4_ID][DNSAddresses] = dnsaddresses
# construct routeinfo.
if DEVICE in cfgmap:
routes = self.get_routes_map(cfgmap[DEVICE], 4)
elif NAME in cfgmap:
routes = self.get_routes_map(cfgmap[NAME], 4)
if len(routes) > 0:
info[IPV4_ID][ROUTES] = routes
# Fix ginger issue #110
if len(info[IPV4_ID]) > 0:
info[IPV4_ID][IPV4INIT] = CONST_YES
else:
info[IPV4_ID][IPV4INIT] = CONST_NO
wok_log.debug('End get_ipv4_info')
return info
开发者ID:LiftedKilt,项目名称:ginger,代码行数:30,代码来源:cfginterfaces.py
示例2: get_ipv6_info
def get_ipv6_info(self, info, cfgmap):
wok_log.debug('Begin get_ipv6_info')
if info.__len__() != 0 and cfgmap.__len__() != 0:
info[IPV6_ID] = {}
ipv6_info_keys = [IPV6INIT, IPV6_AUTOCONF, IPV6_DEFROUTE,
IPV6_PEERDNS, IPV6_PEERROUTES,
IPV6_FAILURE_FATAL, DHCPV6C,
IPV6_DEFAULTGW, IPV6_PRIVACY]
for key in ipv6_info_keys:
if key in cfgmap:
info[IPV6_ID][key] = cfgmap[key]
ipv6_addresses = cfgInterfacesHelper.get_ipv6_address(cfgmap)
if len(ipv6_addresses):
info[IPV6_ID][IPV6Addresses] = ipv6_addresses
dnsaddresses = cfgInterfacesHelper.get_dnsv6_info(cfgmap)
if len(dnsaddresses) > 0:
info[IPV6_ID][DNSAddresses] = dnsaddresses
# construct routeinfo.
if DEVICE in cfgmap:
routes = self.get_routes_map(cfgmap[DEVICE], 6)
elif NAME in cfgmap:
routes = self.get_routes_map(cfgmap[NAME], 6)
if len(routes) > 0:
info[IPV6_ID][ROUTES] = routes
wok_log.debug('End get_ipv6_info')
return info
开发者ID:LiftedKilt,项目名称:ginger,代码行数:26,代码来源:cfginterfaces.py
示例3: _do_deep_scan
def _do_deep_scan(self, params):
scan_params = dict(ignore_list=[])
scan_params['scan_path'] = params['path']
params['type'] = 'dir'
for pool in self.get_list():
try:
res = StoragePoolModel(conn=self.conn, objstore=self.objstore).lookup(
pool
)
if res['state'] == 'active':
scan_params['ignore_list'].append(res['path'])
except Exception as e:
wok_log.debug(f'Exception {e} occured when get ignore path')
params['path'] = self.scanner.scan_dir_prepare(params['name'])
scan_params['pool_path'] = params['path']
task_id = AsyncTask(
f'/plugins/kimchi/storagepools/{ISO_POOL_NAME}',
self.scanner.start_scan,
scan_params,
).id
# Record scanning-task/storagepool mapping for future querying
try:
with self.objstore as session:
session.store(
'scanning', params['name'], task_id, get_kimchi_version())
return task_id
except Exception as e:
raise OperationFailed('KCHPOOL0037E', {'err': e.message})
开发者ID:alinefm,项目名称:kimchi,代码行数:30,代码来源:storagepools.py
示例4: get_basic_info
def get_basic_info(self, cfgmap):
wok_log.debug('Begin get_basic_info')
info = {}
info[BASIC_INFO] = {}
basic_info_keys = [NAME, DEVICE, ONBOOT, MACADDR,
HWADDR, UUID, MTU, ZONE, TYPE]
for key in basic_info_keys:
if key in cfgmap:
info[BASIC_INFO][key] = cfgmap[key]
if SLAVE in cfgmap and CONST_YES == cfgmap[SLAVE]:
info[BASIC_INFO][SLAVE] = cfgmap[SLAVE]
info[BASIC_INFO][MASTER] = cfgInterfacesHelper.get_master(cfgmap)
interface_type = None
if TYPE in cfgmap:
interface_type = cfgmap[TYPE]
elif VLAN in cfgmap and CONST_YES == cfgmap[VLAN]:
interface_type = IFACE_VLAN
# Fix ginger issue #131
cfgInterfacesHelper.get_architecture_specific_info(info, cfgmap)
if interface_type is not None:
info[BASIC_INFO][TYPE] = interface_type
if interface_type == IFACE_VLAN:
cfgInterfacesHelper.get_vlan_info(info, cfgmap)
elif interface_type == IFACE_BOND:
cfgInterfacesHelper.get_bond_info(info, cfgmap)
wok_log.debug('end get_basic_info')
if MTU not in cfgmap:
info[BASIC_INFO][MTU] = "1500"
return info
开发者ID:LiftedKilt,项目名称:ginger,代码行数:30,代码来源:cfginterfaces.py
示例5: get_storagedevice
def get_storagedevice(device):
"""
get the device info dict for the device passed as parameter.
Raises exception on failure of lscss execution or device is None/blank
:param device: device id for which we need info to be returned
:return: device info dict
"""
device = _validate_device(device)
if dasd_utils._is_dasdeckd_device(device) or _is_zfcp_device(device):
command = [lscss, '-d', device]
msg = 'The command is "%s" ' % command
wok_log.debug(msg)
out, err, rc = run_command(command)
messge = 'The output of command "%s" is %s' % (command, out)
wok_log.debug(messge)
if rc:
err = err.strip().replace("lscss:", '').strip()
wok_log.error(err)
raise OperationFailed("GS390XCMD0001E",
{'command': command,
'rc': rc, 'reason': err})
if out.strip():
device_info = _get_deviceinfo(out, device)
return device_info
wok_log.error("lscss output is either blank or None")
raise OperationFailed("GS390XCMD0001E",
{'command': command,
'rc': rc, 'reason': out})
else:
wok_log.error("Given device id is of type dasd-eckd or zfcp. "
"Device: %s" % device)
raise InvalidParameter("GS390XINVINPUT",
{'reason': 'given device is not of type '
'dasd-eckd or zfcp. '
'Device : %s' % device})
开发者ID:jay-katta,项目名称:ginger,代码行数:35,代码来源:utils.py
示例6: _get_deviceinfo
def _get_deviceinfo(lscss_out, device):
"""
:param lscss_out: out of lscss command
:param device: device id for which we need info to be returned
:return: device info dict for the device from lscss output
"""
device_pattern = r'(' + re.escape(device) + r')\s+' \
r'(\d\.\d\.[0-9a-fA-F]{4})\s+' \
r'(\w+\/\w+)\s+' \
r'(\w+\/\w+)\s' \
r'(\s{3}|yes)\s+' \
r'([0-9a-fA-F]{2})\s+' \
r'([0-9a-fA-F]{2})\s+' \
r'([0-9a-fA-F]{2})\s+' \
r'(\w+\s\w+)'
if device:
device = utils.get_row_data(lscss_out, HEADER_PATTERN, device_pattern)
msg = 'The device is %s' % device
wok_log.debug(msg)
try:
device_info = _format_lscss(device)
return device_info
except KeyError as e:
wok_log.error('lscss column key not found')
raise e
else:
return device
开发者ID:kimchi-project,项目名称:gingers390x,代码行数:27,代码来源:storagedevices.py
示例7: get_disk_xml
def get_disk_xml(params):
"""
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
[source XML according to src_type]
<target dev='%(dev)s' bus='%(bus)s'/>
<readonly/>
</disk>
"""
path = params['path']
disk_type = params.get('disk', None)
if disk_type is None:
disk_type = _get_disk_type(path) if len(path) > 0 else 'file'
disk = E.disk(type=disk_type, device=params['type'])
driver = E.driver(name='qemu', type=params['format'])
try:
fd = os.open(path, os.O_RDONLY | os.O_DIRECT)
os.close(fd)
wok_log.debug("Disk '%s' supports direct I/O. Setting cache=none"
"to enable live migration" % path)
except OSError, e:
if e.errno == errno.EINVAL:
wok_log.debug("Disk '%s' does not support direct I/O: "
"'%s'. Let libvirt sets the default cache mode." %
(path, e.message))
开发者ID:aiminickwong,项目名称:kimchi,代码行数:27,代码来源:disk.py
示例8: _clean_scan
def _clean_scan(self, pool_name):
try:
conn = self.conn.get()
pool = conn.storagePoolLookupByName(pool_name)
pool.destroy()
with self.objstore as session:
session.delete('scanning', pool_name)
except Exception as e:
wok_log.debug(f'Exception {e} occurred when cleaning scan result')
开发者ID:alinefm,项目名称:kimchi,代码行数:9,代码来源:storagepools.py
示例9: _clean_scan
def _clean_scan(self, pool_name):
try:
conn = self.conn.get()
pool = conn.storagePoolLookupByName(pool_name.encode("utf-8"))
pool.destroy()
with self.objstore as session:
session.delete('scanning', pool_name)
except Exception, e:
err = "Exception %s occured when cleaning scan result"
wok_log.debug(err % e.message)
开发者ID:sdnnfv,项目名称:kimchi,代码行数:10,代码来源:storagepools.py
示例10: _do_deep_scan
def _do_deep_scan(self, params):
scan_params = dict(ignore_list=[])
scan_params["scan_path"] = params["path"]
params["type"] = "dir"
for pool in self.get_list():
try:
res = StoragePoolModel(conn=self.conn, objstore=self.objstore).lookup(pool)
if res["state"] == "active":
scan_params["ignore_list"].append(res["path"])
except Exception, e:
err = "Exception %s occured when get ignore path"
wok_log.debug(err % e.message)
开发者ID:andreteodoro,项目名称:kimchi,代码行数:13,代码来源:storagepools.py
示例11: swupdate
def swupdate(self, *name):
try:
swupdate = SoftwareUpdate()
except:
raise OperationFailed('KCHPKGUPD0004E')
pkgs = swupdate.getNumOfUpdates()
if pkgs == 0:
raise OperationFailed('KCHPKGUPD0001E')
wok_log.debug('Host is going to be updated.')
taskid = add_task('/plugins/kimchi/host/swupdate', swupdate.doUpdate,
self.objstore, None)
return self.task.lookup(taskid)
开发者ID:lcorreia,项目名称:kimchi,代码行数:14,代码来源:host.py
示例12: _do_deep_scan
def _do_deep_scan(self, params):
scan_params = dict(ignore_list=[])
scan_params['scan_path'] = params['path']
params['type'] = 'dir'
for pool in self.get_list():
try:
res = StoragePoolModel(conn=self.conn,
objstore=self.objstore).lookup(pool)
if res['state'] == 'active':
scan_params['ignore_list'].append(res['path'])
except Exception, e:
err = "Exception %s occured when get ignore path"
wok_log.debug(err % e.message)
开发者ID:sdnnfv,项目名称:kimchi,代码行数:14,代码来源:storagepools.py
示例13: lookup
def lookup(self, name):
pool = self.get_storagepool(name, self.conn)
info = pool.info()
autostart = True if pool.autostart() else False
persistent = True if pool.isPersistent() else False
xml = pool.XMLDesc(0)
path = xpath_get_text(xml, '/pool/target/path')[0]
pool_type = xpath_get_text(xml, '/pool/@type')[0]
source = self._get_storage_source(pool_type, xml)
# FIXME: nfs workaround - prevent any libvirt operation
# for a nfs if the corresponding NFS server is down.
if pool_type == 'netfs' and not self._nfs_status_online(pool):
wok_log.debug(
'NFS pool %s is offline, reason: NFS ' 'server %s is unreachable.',
name,
source['addr'],
)
# Mark state as '4' => inaccessible.
info[0] = 4
# skip calculating volumes
nr_volumes = 0
else:
nr_volumes = self._get_storagepool_vols_num(pool)
res = {
'state': POOL_STATE_MAP[info[0]],
'path': path,
'source': source,
'type': pool_type,
'autostart': autostart,
'capacity': info[1],
'allocated': info[2],
'available': info[3],
'nr_volumes': nr_volumes,
'persistent': persistent,
'in_use': self._pool_used_by_template(name),
}
if not pool.isPersistent():
# Deal with deep scan generated pool
try:
with self.objstore as session:
task_id = session.get('scanning', name)
res['task_id'] = str(task_id)
res['type'] = 'kimchi-iso'
except NotFoundError:
# User created normal pool
pass
return res
开发者ID:alinefm,项目名称:kimchi,代码行数:49,代码来源:storagepools.py
示例14: swupdate
def swupdate(self, *name):
try:
swupdate = SoftwareUpdate()
except:
raise OperationFailed('GGBPKGUPD0004E')
pkgs = swupdate.getNumOfUpdates()
if pkgs == 0:
wok_log.debug(messages['GGBPKGUPD0001E'])
return {'message': messages['GGBPKGUPD0001E']}
wok_log.debug('Host is going to be updated.')
taskid = AsyncTask('/plugins/gingerbase/host/swupdate',
swupdate.doUpdate).id
return self.task.lookup(taskid)
开发者ID:open-power-host-os,项目名称:gingerbase,代码行数:15,代码来源:host.py
示例15: get_list
def get_list(self, _type=None):
"""
:param _type: supported types are dasd-eckd, zfcp.
Based on this devices will be retrieved
:return: device data list.
"""
device_paths = []
if _type is None:
device_paths.extend(utils.get_directories(syspath_eckd))
device_paths.extend(utils.get_directories(syspath_zfcp))
elif _type == DEV_TYPES[0]:
device_paths = utils.get_directories(syspath_eckd)
elif _type == DEV_TYPES[1]:
device_paths = utils.get_directories(syspath_zfcp)
else:
wok_log.error("Invalid _type given. _type: %s"
% _type)
raise InvalidParameter("GS390XINVTYPE",
{'supported_type': DEV_TYPES})
if not device_paths:
return []
command = [lscss]
msg = 'The command executed is "%s" ' % command
wok_log.debug(msg)
out, err, rc = run_command(command)
if rc:
err = err.strip().replace("lscss:", '').strip()
wok_log.error(err)
raise OperationFailed("GS390XCMD0001E",
{'command': command,
'rc': rc, 'reason': err})
device_pattern = r'(\d\.\d\.[0-9a-fA-F]{4})\s+' \
r'(\d\.\d\.[0-9a-fA-F]{4})\s+' \
r'(\w+\/\w+)\s+' \
r'(\w+\/\w+)\s' \
r'(\s{3}|yes)\s+' \
r'([0-9a-fA-F]{2})\s+' \
r'([0-9a-fA-F]{2})\s+' \
r'([0-9a-fA-F]{2})\s+' \
r'(\w+\s\w+)'
devices = utils.get_rows_info(out, HEADER_PATTERN, device_pattern,
unique_col='device',
format_data=_format_lscss)
device_data_list = _list_devicesinfo(devices, device_paths)
return device_data_list
开发者ID:kimchi-project,项目名称:gingers390x,代码行数:47,代码来源:storagedevices.py
示例16: clean_stale
def clean_stale(self, window=SCAN_TTL):
"""
Clear scan pools generated before time window,
Clear all scan pools if window is -1.
"""
try:
now = time.time()
clean_list = glob.glob("/tmp/kimchi-scan-*")
for d in clean_list:
transient_pool = \
os.path.basename(d).replace('kimchi-scan-', '')[0: -6]
if now - os.path.getmtime(d) > window:
shutil.rmtree(d)
self.clean_cb(transient_pool)
except OSError as e:
msg = "Exception %s occured when cleaning stale pool, ignore"
wok_log.debug(msg % e.message)
开发者ID:Finn10111,项目名称:kimchi,代码行数:17,代码来源:scan.py
示例17: upgrade
def upgrade(self, name):
"""
Execute the update of a specific package (and its dependencies, if
necessary) in the system.
@param: Name
@return: task
"""
if self.host_swupdate is None:
raise OperationFailed('GGBPKGUPD0004E')
self.pkgs2update = self.host_swupdate.getUpdates()
pkgs_list = self._resolve_dependencies(name)
msg = 'The following packages will be updated: ' + ', '.join(pkgs_list)
wok_log.debug(msg)
taskid = AsyncTask('/plugins/gingerbase/host/packagesupdate/%s/upgrade'
% name, self.host_swupdate.doUpdate, pkgs_list).id
return self.task.lookup(taskid)
开发者ID:kimchi-project,项目名称:gingerbase,代码行数:18,代码来源:packagesupdate.py
示例18: lookup
def lookup(self, name):
pool = self.get_storagepool(name, self.conn)
info = pool.info()
autostart = True if pool.autostart() else False
persistent = True if pool.isPersistent() else False
xml = pool.XMLDesc(0)
path = xpath_get_text(xml, "/pool/target/path")[0]
pool_type = xpath_get_text(xml, "/pool/@type")[0]
source = self._get_storage_source(pool_type, xml)
# FIXME: nfs workaround - prevent any libvirt operation
# for a nfs if the corresponding NFS server is down.
if pool_type == "netfs" and not self._nfs_status_online(pool):
wok_log.debug("NFS pool %s is offline, reason: NFS " "server %s is unreachable.", name, source["addr"])
# Mark state as '4' => inaccessible.
info[0] = 4
# skip calculating volumes
nr_volumes = 0
else:
nr_volumes = self._get_storagepool_vols_num(pool)
res = {
"state": POOL_STATE_MAP[info[0]],
"path": path,
"source": source,
"type": pool_type,
"autostart": autostart,
"capacity": info[1],
"allocated": info[2],
"available": info[3],
"nr_volumes": nr_volumes,
"persistent": persistent,
}
if not pool.isPersistent():
# Deal with deep scan generated pool
try:
with self.objstore as session:
task_id = session.get("scanning", name)
res["task_id"] = str(task_id)
res["type"] = "kimchi-iso"
except NotFoundError:
# User created normal pool
pass
return res
开发者ID:andreteodoro,项目名称:kimchi,代码行数:44,代码来源:storagepools.py
示例19: get_storagedevice
def get_storagedevice(self, device):
"""
get the device info dict for the device passed as parameter.
Raises exception on failure of lscss execution or device is None/blank
:param device: device id for which we need info to be returned
:return: device info dict
"""
if device and isinstance(device, unicode):
device = device.encode('utf-8')
device = str(device)
device = _validate_device(device)
if _is_dasdeckd_device(device) or _is_zfcp_device(device):
command = [lscss, '-d', device]
# Use join to handle unicode charater in device
msg = 'The command is "%s" ' % ' '.join(command)
wok_log.debug(msg)
out, err, rc = run_command(command)
messge = 'The output of command "%s" is %s' % (' '.
join(command), out)
wok_log.debug(messge)
if rc:
err = err.strip().replace("lscss:", '').strip()
wok_log.error(err)
raise OperationFailed("GS390XCMD0001E",
{'command': ' '.join(command),
'rc': rc, 'reason': err})
if out.strip().splitlines()[2:]:
# sample command output with '-d' option when device
# not found
# """""
# [[email protected] ginger]# lscss -d 1530
# Device Subchan. DevType CU Type Use PIM PAM POM CHPIDs
# -----------------------------------------------------------
# """""
device_info = _get_deviceinfo(out, device)
return device_info
wok_log.error("lscss output is either blank or None")
raise OperationFailed("GS390XCMD0001E",
{'command': ' '.join(command),
'rc': rc, 'reason': out})
else:
wok_log.error("Given device id is of type dasd-eckd or zfcp. "
"Device: %s" % device)
raise NotFoundError("GS390XSTG00023", {'device': device})
开发者ID:kimchi-project,项目名称:gingers390x,代码行数:44,代码来源:storagedevices.py
示例20: probe
def probe(self):
if not self.bootable:
raise IsoFormatError("KCHISO0002E", {'filename': self.path})
matcher = Matcher(self.volume_id)
for d, v, regex in iso_dir:
if matcher.search(regex):
distro = d
if hasattr(v, '__call__'):
version = v(matcher)
else:
version = v
return (distro, version)
msg = "probe_iso: Unable to identify ISO %s with Volume ID: %s"
wok_log.debug(msg, self.path, self.volume_id)
return ('unknown', 'unknown')
开发者ID:aiminickwong,项目名称:kimchi,代码行数:19,代码来源:isoinfo.py
注:本文中的wok.utils.wok_log.debug函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论