[Kimchi-devel] [PATCH 15/38] Rename kimchi_log to wok_log
Lucio Correia
luciojhc at linux.vnet.ibm.com
Thu May 21 21:33:28 UTC 2015
---
plugins/kimchi/disks.py | 8 +++---
plugins/kimchi/distroloader.py | 6 ++--
plugins/kimchi/imageinfo.py | 4 +-
plugins/kimchi/isoinfo.py | 4 +-
plugins/kimchi/mockmodel.py | 6 ++--
plugins/kimchi/model/config.py | 8 +++---
plugins/kimchi/model/cpuinfo.py | 6 ++--
plugins/kimchi/model/debugreports.py | 14 ++++++------
plugins/kimchi/model/diskutils.py | 6 ++--
plugins/kimchi/model/featuretests.py | 8 +++---
plugins/kimchi/model/host.py | 8 +++---
plugins/kimchi/model/hostdev.py | 8 +++---
plugins/kimchi/model/libvirtconnection.py | 8 +++---
plugins/kimchi/model/libvirtstoragepool.py | 4 +-
plugins/kimchi/model/networks.py | 16 +++++++-------
plugins/kimchi/model/peers.py | 6 ++--
plugins/kimchi/model/storagepools.py | 32 ++++++++++++++--------------
plugins/kimchi/model/storagetargets.py | 6 ++--
plugins/kimchi/model/storagevolumes.py | 8 +++---
plugins/kimchi/model/vmhostdevs.py | 6 ++--
plugins/kimchi/model/vms.py | 22 +++++++++---------
plugins/kimchi/model/vmstorages.py | 8 +++---
plugins/kimchi/scan.py | 4 +-
plugins/kimchi/screenshot.py | 6 ++--
plugins/kimchi/swupdate.py | 8 +++---
plugins/kimchi/tests/utils.py | 6 ++--
src/wok/objectstore.py | 4 +-
src/wok/utils.py | 18 +++++++-------
28 files changed, 124 insertions(+), 124 deletions(-)
diff --git a/plugins/kimchi/disks.py b/plugins/kimchi/disks.py
index 59e52f9..88a69f4 100644
--- a/plugins/kimchi/disks.py
+++ b/plugins/kimchi/disks.py
@@ -25,7 +25,7 @@ from parted import Device as PDevice
from parted import Disk as PDisk
from wok.exception import OperationFailed
-from wok.utils import kimchi_log
+from wok.utils import wok_log
def _get_dev_node_path(maj_min):
@@ -82,7 +82,7 @@ def _is_dev_leaf(devNodePath):
except OperationFailed as e:
# lsblk is known to fail on multipath devices
# Assume these devices contain children
- kimchi_log.error(
+ wok_log.error(
"Error getting device info for %s: %s", devNodePath, e)
return False
@@ -97,7 +97,7 @@ def _is_dev_extended_partition(devType, devNodePath):
try:
extended_part = PDisk(device).getExtendedPartition()
except NotImplementedError as e:
- kimchi_log.warning(
+ wok_log.warning(
"Error getting extended partition info for dev %s type %s: %s",
devNodePath, devType, e.message)
# Treate disk with unsupported partiton table as if it does not
@@ -180,7 +180,7 @@ def get_partition_details(name):
try:
dev = _get_lsblk_devs(keys, [dev_path])[0]
except OperationFailed as e:
- kimchi_log.error(
+ wok_log.error(
"Error getting partition info for %s: %s", name, e)
return {}
diff --git a/plugins/kimchi/distroloader.py b/plugins/kimchi/distroloader.py
index 8ad34d2..a593246 100644
--- a/plugins/kimchi/distroloader.py
+++ b/plugins/kimchi/distroloader.py
@@ -25,7 +25,7 @@ import os
import config
from wok.exception import NotFoundError, OperationFailed
-from wok.utils import kimchi_log
+from wok.utils import wok_log
ARCHS = {'x86_64': ['x86_64', 'amd64', 'i686', 'x86', 'i386'],
@@ -43,7 +43,7 @@ class DistroLoader(object):
msg_args = {'filename': fname}
if not os.path.isfile(fname):
msg = "DistroLoader: failed to find distro file: %s" % fname
- kimchi_log.error(msg)
+ wok_log.error(msg)
raise NotFoundError("KCHDL0001E", msg_args)
try:
with open(fname) as f:
@@ -51,7 +51,7 @@ class DistroLoader(object):
return data
except ValueError:
msg = "DistroLoader: failed to parse distro file: %s" % fname
- kimchi_log.error(msg)
+ wok_log.error(msg)
raise OperationFailed("KCHDL0002E", msg_args)
def get(self):
diff --git a/plugins/kimchi/imageinfo.py b/plugins/kimchi/imageinfo.py
index fbd1396..7d92f54 100644
--- a/plugins/kimchi/imageinfo.py
+++ b/plugins/kimchi/imageinfo.py
@@ -23,7 +23,7 @@ import sys
import guestfs
from wok.exception import ImageFormatError, InvalidParameter, TimeoutExpired
-from wok.utils import run_command, kimchi_log
+from wok.utils import run_command, wok_log
def probe_img_info(path):
@@ -32,7 +32,7 @@ def probe_img_info(path):
try:
out = run_command(cmd, 10)[0]
except TimeoutExpired:
- kimchi_log.warning("Cannot decide format of base img %s", path)
+ wok_log.warning("Cannot decide format of base img %s", path)
return None
info = json.loads(out)
diff --git a/plugins/kimchi/isoinfo.py b/plugins/kimchi/isoinfo.py
index 4bad471..0feb411 100644
--- a/plugins/kimchi/isoinfo.py
+++ b/plugins/kimchi/isoinfo.py
@@ -29,7 +29,7 @@ import urllib2
from wok.exception import IsoFormatError
-from wok.utils import check_url_path, kimchi_log
+from wok.utils import check_url_path, wok_log
iso_dir = [
@@ -178,7 +178,7 @@ class IsoImage(object):
return (distro, version)
msg = "probe_iso: Unable to identify ISO %s with Volume ID: %s"
- kimchi_log.debug(msg, self.path, self.volume_id)
+ wok_log.debug(msg, self.path, self.volume_id)
return ('unknown', 'unknown')
diff --git a/plugins/kimchi/mockmodel.py b/plugins/kimchi/mockmodel.py
index d742bbd..8797ae7 100644
--- a/plugins/kimchi/mockmodel.py
+++ b/plugins/kimchi/mockmodel.py
@@ -43,7 +43,7 @@ from model.templates import LibvirtVMTemplate
from model.users import PAMUsersModel
from model.groups import PAMGroupsModel
from wok.objectstore import ObjectStore
-from wok.utils import add_task, get_next_clone_name, kimchi_log
+from wok.utils import add_task, get_next_clone_name, wok_log
from vmtemplate import VMTemplate
from wok.xmlutils.utils import xml_item_update
@@ -276,10 +276,10 @@ class MockModel(Model):
conn.storagePoolDefineXML(ET.tostring(root), 0)
def _mock_host_shutdown(self, *name):
- kimchi_log.info("The host system will be shutted down")
+ wok_log.info("The host system will be shutted down")
def _mock_host_reboot(self, *name):
- kimchi_log.info("The host system will be rebooted")
+ wok_log.info("The host system will be rebooted")
def _mock_storagevolumes_create(self, pool, params):
vol_source = ['url', 'capacity']
diff --git a/plugins/kimchi/model/config.py b/plugins/kimchi/model/config.py
index 6a3e23d..84fc27d 100644
--- a/plugins/kimchi/model/config.py
+++ b/plugins/kimchi/model/config.py
@@ -33,7 +33,7 @@ from featuretests import FEATURETEST_VM_NAME
from ..repositories import Repositories
from ..screenshot import VMScreenshot
from ..swupdate import SoftwareUpdate
-from wok.utils import check_url_path, kimchi_log, run_command
+from wok.utils import check_url_path, wok_log, run_command
class ConfigModel(object):
@@ -85,7 +85,7 @@ class CapabilitiesModel(object):
FeatureTests.enable_libvirt_error_logging()
def _set_capabilities(self):
- kimchi_log.info("*** Running feature tests ***")
+ wok_log.info("*** Running feature tests ***")
conn = self.conn.get()
self.qemu_stream = FeatureTests.qemu_supports_iso_stream()
self.nfs_target_probe = FeatureTests.libvirt_support_nfs_probe(conn)
@@ -98,14 +98,14 @@ class CapabilitiesModel(object):
if FeatureTests.libvirt_supports_iso_stream(conn, p):
self.libvirt_stream_protocols.append(p)
- kimchi_log.info("*** Feature tests completed ***")
+ wok_log.info("*** Feature tests completed ***")
_set_capabilities.priority = 90
def _qemu_support_spice(self):
qemu_path = find_qemu_binary(find_emulator=True)
out, err, rc = run_command(['ldd', qemu_path])
if rc != 0:
- kimchi_log.error('Failed to find qemu binary dependencies: %s',
+ wok_log.error('Failed to find qemu binary dependencies: %s',
err)
return False
for line in out.split('\n'):
diff --git a/plugins/kimchi/model/cpuinfo.py b/plugins/kimchi/model/cpuinfo.py
index 54d6eaa..61d1ec6 100644
--- a/plugins/kimchi/model/cpuinfo.py
+++ b/plugins/kimchi/model/cpuinfo.py
@@ -22,7 +22,7 @@ import platform
from xml.etree import ElementTree as ET
from wok.exception import InvalidParameter, InvalidOperation
-from wok.utils import kimchi_log, run_command
+from wok.utils import wok_log, run_command
ARCH = 'power' if platform.machine().startswith('ppc') else 'x86'
@@ -59,11 +59,11 @@ class CPUInfoModel(object):
connect = self.conn.get()
libvirt_topology = get_topo_capabilities(connect)
except Exception as e:
- kimchi_log.info("Unable to get CPU topology capabilities: %s"
+ wok_log.info("Unable to get CPU topology capabilities: %s"
% e.message)
return
if libvirt_topology is None:
- kimchi_log.info("cpu_info topology not supported.")
+ wok_log.info("cpu_info topology not supported.")
return
if ARCH == 'power':
diff --git a/plugins/kimchi/model/debugreports.py b/plugins/kimchi/model/debugreports.py
index 132a730..ea5853d 100644
--- a/plugins/kimchi/model/debugreports.py
+++ b/plugins/kimchi/model/debugreports.py
@@ -29,7 +29,7 @@ from .. import config
from wok.exception import InvalidParameter, WokException, NotFoundError
from wok.exception import OperationFailed
from tasks import TaskModel
-from wok.utils import add_task, kimchi_log
+from wok.utils import add_task, wok_log
from wok.utils import run_command
@@ -95,7 +95,7 @@ class DebugReportsModel(object):
break
# Some error in sosreport happened
if reportFile is None:
- kimchi_log.error('Debug report file not found. See sosreport '
+ wok_log.error('Debug report file not found. See sosreport '
'output for detail:\n%s', output)
fname = (patterns[0] % name).split('/')[-1]
raise OperationFailed('KCHDR0004E', {'name': fname})
@@ -107,14 +107,14 @@ class DebugReportsModel(object):
# Moving report
msg = 'Moving debug report file "%s" to "%s"' % (reportFile,
target)
- kimchi_log.info(msg)
+ wok_log.info(msg)
shutil.move(reportFile, target)
# Deleting md5
msg = 'Deleting report md5 file: "%s"' % (md5_report_file)
- kimchi_log.info(msg)
+ wok_log.info(msg)
with open(md5_report_file) as f:
md5 = f.read().strip()
- kimchi_log.info('Md5 file content: "%s"', md5)
+ wok_log.info('Md5 file content: "%s"', md5)
os.remove(md5_report_file)
cb('OK', True)
return
@@ -151,7 +151,7 @@ class DebugReportsModel(object):
if retcode == 0:
return helper_tool['fn']
except Exception, e:
- kimchi_log.info('Exception running command: %s', e)
+ wok_log.info('Exception running command: %s', e)
return None
@@ -189,7 +189,7 @@ class DebugReportModel(object):
raise InvalidParameter('KCHDR0008E', {'name': params['name']})
shutil.move(file_source, file_target)
- kimchi_log.info('%s renamed to %s' % (file_source, file_target))
+ wok_log.info('%s renamed to %s' % (file_source, file_target))
return params['name']
def delete(self, name):
diff --git a/plugins/kimchi/model/diskutils.py b/plugins/kimchi/model/diskutils.py
index dea7fa5..3f6df6c 100644
--- a/plugins/kimchi/model/diskutils.py
+++ b/plugins/kimchi/model/diskutils.py
@@ -20,7 +20,7 @@
from wok.exception import OperationFailed, NotFoundError
from vms import VMModel, VMsModel
-from wok.utils import kimchi_log
+from wok.utils import wok_log
from ..xmlutils.disk import get_vm_disk_info, get_vm_disks
"""
@@ -35,7 +35,7 @@ def get_disk_ref_cnt(objstore, conn, path):
try:
ref_cnt = session.get('storagevolume', path)['ref_cnt']
except (KeyError, NotFoundError):
- kimchi_log.info('Volume %s not found in obj store.' % path)
+ wok_log.info('Volume %s not found in obj store.' % path)
ref_cnt = 0
# try to find this volume in existing vm
vms_list = VMsModel.get_vms(conn)
@@ -54,7 +54,7 @@ def get_disk_ref_cnt(objstore, conn, path):
# ref_cnts to be out of sync, data corruption could
# occour if a disk is added to two guests
# unknowingly.
- kimchi_log.error('Unable to store storage volume id in'
+ wok_log.error('Unable to store storage volume id in'
' objectstore due error: %s',
e.message)
raise OperationFailed('KCHVOL0017E',
diff --git a/plugins/kimchi/model/featuretests.py b/plugins/kimchi/model/featuretests.py
index 778fe06..bbe0c3d 100644
--- a/plugins/kimchi/model/featuretests.py
+++ b/plugins/kimchi/model/featuretests.py
@@ -26,7 +26,7 @@ import subprocess
from lxml.builder import E
from wok.rollbackcontext import RollbackContext
-from wok.utils import kimchi_log, run_command, servermethod
+from wok.utils import wok_log, run_command, servermethod
FEATURETEST_VM_NAME = "FEATURETEST_VM"
FEATURETEST_POOL_NAME = "FEATURETEST_POOL"
@@ -113,7 +113,7 @@ class FeatureTests(object):
dom.undefine()
return True
except libvirt.libvirtError, e:
- kimchi_log.error(e.message)
+ wok_log.error(e.message)
return False
finally:
FeatureTests.enable_libvirt_error_logging()
@@ -128,7 +128,7 @@ class FeatureTests(object):
FeatureTests.disable_libvirt_error_logging()
conn.findStoragePoolSources('netfs', _get_xml(), 0)
except libvirt.libvirtError as e:
- kimchi_log.error(e.message)
+ wok_log.error(e.message)
if e.get_error_code() == 38:
# if libvirt cannot find showmount,
# it returns 38--general system call failure
@@ -194,7 +194,7 @@ class FeatureTests(object):
def kernel_support_vfio():
out, err, rc = run_command(['modprobe', 'vfio-pci'])
if rc != 0:
- kimchi_log.warning("Unable to load Kernal module vfio-pci.")
+ wok_log.warning("Unable to load Kernal module vfio-pci.")
return False
return True
diff --git a/plugins/kimchi/model/host.py b/plugins/kimchi/model/host.py
index f1f0b83..2a78a88 100644
--- a/plugins/kimchi/model/host.py
+++ b/plugins/kimchi/model/host.py
@@ -37,7 +37,7 @@ from tasks import TaskModel
from vms import DOM_STATE_MAP
from ..repositories import Repositories
from ..swupdate import SoftwareUpdate
-from wok.utils import add_task, kimchi_log
+from wok.utils import add_task, wok_log
from wok.xmlutils.utils import xpath_get_text
@@ -131,7 +131,7 @@ class HostModel(object):
if pkgs == 0:
raise OperationFailed('KCHPKGUPD0001E')
- kimchi_log.debug('Host is going to be updated.')
+ wok_log.debug('Host is going to be updated.')
taskid = add_task('/host/swupdate', swupdate.doUpdate, self.objstore,
None)
return self.task.lookup(taskid)
@@ -142,7 +142,7 @@ class HostModel(object):
if len(running_vms) > 0:
raise OperationFailed("KCHHOST0001E")
- kimchi_log.info('Host is going to shutdown.')
+ wok_log.info('Host is going to shutdown.')
os.system('shutdown -h now')
def reboot(self, args=None):
@@ -151,7 +151,7 @@ class HostModel(object):
if len(running_vms) > 0:
raise OperationFailed("KCHHOST0002E")
- kimchi_log.info('Host is going to reboot.')
+ wok_log.info('Host is going to reboot.')
os.system('reboot')
def _get_vms_list_by_state(self, state):
diff --git a/plugins/kimchi/model/hostdev.py b/plugins/kimchi/model/hostdev.py
index 34a8e1b..9ebc3c3 100644
--- a/plugins/kimchi/model/hostdev.py
+++ b/plugins/kimchi/model/hostdev.py
@@ -22,7 +22,7 @@ from pprint import pformat
from pprint import pprint
from libvirtconnection import LibvirtConnection
-from wok.utils import kimchi_log
+from wok.utils import wok_log
from wok.xmlutils.utils import dictize
@@ -42,7 +42,7 @@ def _get_dev_info_tree(dev_infos):
try:
parent = devs[dev_info['parent']]
except KeyError:
- kimchi_log.error('Parent %s of device %s does not exist.',
+ wok_log.error('Parent %s of device %s does not exist.',
dev_info['parent'], dev_info['name'])
continue
@@ -97,7 +97,7 @@ def _get_same_iommugroup_devices(dev_infos, device_info):
try:
parent_info = dev_dict[parent]
except KeyError:
- kimchi_log.error("Parent %s of device %s does not exist",
+ wok_log.error("Parent %s of device %s does not exist",
parent, dev_info['name'])
break
@@ -184,7 +184,7 @@ def get_dev_info(node_dev):
if dev_type in ('net', 'pci', 'scsi_host', 'storage', 'usb_device'):
return globals()['_get_%s_dev_info' % dev_type](info)
- kimchi_log.error("Unknown device type: %s", dev_type)
+ wok_log.error("Unknown device type: %s", dev_type)
return info
diff --git a/plugins/kimchi/model/libvirtconnection.py b/plugins/kimchi/model/libvirtconnection.py
index 4a4eee4..d2ce031 100644
--- a/plugins/kimchi/model/libvirtconnection.py
+++ b/plugins/kimchi/model/libvirtconnection.py
@@ -23,7 +23,7 @@ import time
import cherrypy
import libvirt
-from wok.utils import kimchi_log
+from wok.utils import wok_log
class LibvirtConnection(object):
@@ -75,7 +75,7 @@ class LibvirtConnection(object):
libvirt.VIR_ERR_NO_CONNECT,
libvirt.VIR_ERR_INVALID_CONN)
if edom in EDOMAINS and ecode in ECODES:
- kimchi_log.error('Connection to libvirt broken. '
+ wok_log.error('Connection to libvirt broken. '
'Recycling. ecode: %d edom: %d' %
(ecode, edom))
with LibvirtConnection._connectionLock:
@@ -95,9 +95,9 @@ class LibvirtConnection(object):
conn = libvirt.open(self.uri)
break
except libvirt.libvirtError:
- kimchi_log.error('Unable to connect to libvirt.')
+ wok_log.error('Unable to connect to libvirt.')
if not retries:
- kimchi_log.error("Unable to establish connection "
+ wok_log.error("Unable to establish connection "
"with libvirt. Please check "
"your libvirt URI which is often "
"defined in "
diff --git a/plugins/kimchi/model/libvirtstoragepool.py b/plugins/kimchi/model/libvirtstoragepool.py
index b7a8291..6c1f031 100644
--- a/plugins/kimchi/model/libvirtstoragepool.py
+++ b/plugins/kimchi/model/libvirtstoragepool.py
@@ -27,7 +27,7 @@ import libvirt
from wok.exception import InvalidParameter, OperationFailed, TimeoutExpired
from ..iscsi import TargetClient
from wok.rollbackcontext import RollbackContext
-from wok.utils import kimchi_log, parse_cmd_output, run_command
+from wok.utils import wok_log, parse_cmd_output, run_command
class StoragePoolDef(object):
@@ -165,7 +165,7 @@ class ScsiPoolDef(StoragePoolDef):
msg = "Libvirt version <= 1.0.5. Setting SCSI host name as '%s'; "\
"setting SCSI adapter type as 'scsi_host'; "\
"ignoring wwnn and wwpn." % tmp_name
- kimchi_log.info(msg)
+ wok_log.info(msg)
# Path for Fibre Channel scsi hosts
self.poolArgs['path'] = '/dev/disk/by-path'
if not self.poolArgs['source']['adapter']['type']:
diff --git a/plugins/kimchi/model/networks.py b/plugins/kimchi/model/networks.py
index 7a3dfc8..594bfca 100644
--- a/plugins/kimchi/model/networks.py
+++ b/plugins/kimchi/model/networks.py
@@ -32,7 +32,7 @@ from wok.exception import InvalidOperation, InvalidParameter
from wok.exception import MissingParameter, NotFoundError, OperationFailed
from ..osinfo import defaults as tmpl_defaults
from wok.rollbackcontext import RollbackContext
-from wok.utils import kimchi_log, run_command
+from wok.utils import wok_log, run_command
from ..xmlutils.network import create_vlan_tagged_bridge_xml
from ..xmlutils.network import to_network_xml
from wok.xmlutils.utils import xpath_get_text
@@ -59,9 +59,9 @@ class NetworksModel(object):
net = conn.networkLookupByName(net_name)
except libvirt.libvirtError, e:
msg = "Fatal: Unable to find network %s."
- kimchi_log.error(msg, net_name)
- kimchi_log.error(error_msg)
- kimchi_log.error("Details: %s", e.message)
+ wok_log.error(msg, net_name)
+ wok_log.error(error_msg)
+ wok_log.error("Details: %s", e.message)
sys.exit(1)
if net.isActive() == 0:
@@ -69,9 +69,9 @@ class NetworksModel(object):
net.create()
except libvirt.libvirtError as e:
msg = "Fatal: Unable to activate network %s."
- kimchi_log.error(msg, net_name)
- kimchi_log.error(error_msg)
- kimchi_log.error("Details: %s", e.message)
+ wok_log.error(msg, net_name)
+ wok_log.error(error_msg)
+ wok_log.error("Details: %s", e.message)
sys.exit(1)
def create(self, params):
@@ -211,7 +211,7 @@ class NetworksModel(object):
try:
bridges.append(net.bridgeName())
except libvirt.libvirtError, e:
- kimchi_log.error(e.message)
+ wok_log.error(e.message)
if br_name in bridges:
raise InvalidOperation("KCHNET0010E", {'iface': br_name})
diff --git a/plugins/kimchi/model/peers.py b/plugins/kimchi/model/peers.py
index ef70b1e..2465550 100644
--- a/plugins/kimchi/model/peers.py
+++ b/plugins/kimchi/model/peers.py
@@ -22,7 +22,7 @@ import re
import socket
from wok.config import config
-from wok.utils import kimchi_log, run_command
+from wok.utils import wok_log, run_command
class PeersModel(object):
@@ -40,7 +40,7 @@ class PeersModel(object):
"service:kimchid://%s" % self.url]
out, error, ret = run_command(cmd)
if out and len(out) != 0:
- kimchi_log.error("Unable to register server on openSLP."
+ wok_log.error("Unable to register server on openSLP."
" Details: %s" % out)
cherrypy.engine.subscribe('exit', self._peer_deregister)
@@ -49,7 +49,7 @@ class PeersModel(object):
"service:kimchid://%s" % self.url]
out, error, ret = run_command(cmd)
if out and len(out) != 0:
- kimchi_log.error("Unable to deregister server on openSLP."
+ wok_log.error("Unable to deregister server on openSLP."
" Details: %s" % out)
def get_list(self):
diff --git a/plugins/kimchi/model/storagepools.py b/plugins/kimchi/model/storagepools.py
index 6d9c8cf..2514ce4 100644
--- a/plugins/kimchi/model/storagepools.py
+++ b/plugins/kimchi/model/storagepools.py
@@ -31,7 +31,7 @@ from config import CapabilitiesModel
from host import DeviceModel
from libvirtstoragepool import StoragePoolDef
from ..osinfo import defaults as tmpl_defaults
-from wok.utils import add_task, kimchi_log, run_command
+from wok.utils import add_task, wok_log, run_command
from ..utils import pool_name_from_uri
from wok.xmlutils.utils import xpath_get_text
@@ -92,8 +92,8 @@ class StoragePoolsModel(object):
pool_path = pools[pool_name].get('path')
if pool_path is None:
msg = "Fatal: Unable to find storage pool %s. " + error_msg
- kimchi_log.error(msg % pool_name)
- kimchi_log.error("Details: %s", e.message)
+ wok_log.error(msg % pool_name)
+ wok_log.error("Details: %s", e.message)
sys.exit(1)
# Try to create the pool
@@ -108,8 +108,8 @@ class StoragePoolsModel(object):
except libvirt.libvirtError, e:
msg = "Fatal: Unable to create storage pool %s. "
msg += error_msg
- kimchi_log.error(msg % pool_name)
- kimchi_log.error("Details: %s", e.message)
+ wok_log.error(msg % pool_name)
+ wok_log.error("Details: %s", e.message)
sys.exit(1)
if pool.isActive() == 0:
@@ -118,8 +118,8 @@ class StoragePoolsModel(object):
except libvirt.libvirtError, e:
msg = "Fatal: Unable to craete storage pool %s. "
msg += error_msg
- kimchi_log.error(msg % pool_name)
- kimchi_log.error("Details: %s", e.message)
+ wok_log.error(msg % pool_name)
+ wok_log.error("Details: %s", e.message)
sys.exit(1)
def get_list(self):
@@ -192,14 +192,14 @@ class StoragePoolsModel(object):
# disable autostart for others
pool.setAutostart(0)
except libvirt.libvirtError as e:
- kimchi_log.error("Problem creating Storage Pool: %s", e)
+ wok_log.error("Problem creating Storage Pool: %s", e)
raise OperationFailed("KCHPOOL0007E",
{'name': name, 'err': e.get_error_message()})
if params['type'] == 'netfs':
output, error, returncode = run_command(['setsebool', '-P',
'virt_use_nfs=1'])
if error or returncode:
- kimchi_log.error("Unable to set virt_use_nfs=1. If you use "
+ wok_log.error("Unable to set virt_use_nfs=1. If you use "
"SELinux, this may prevent NFS pools from "
"being used.")
return name
@@ -213,7 +213,7 @@ class StoragePoolsModel(object):
session.delete('scanning', pool_name)
except Exception, e:
err = "Exception %s occured when cleaning scan result"
- kimchi_log.debug(err % e.message)
+ wok_log.debug(err % e.message)
def _do_deep_scan(self, params):
scan_params = dict(ignore_list=[])
@@ -228,7 +228,7 @@ class StoragePoolsModel(object):
scan_params['ignore_list'].append(res['path'])
except Exception, e:
err = "Exception %s occured when get ignore path"
- kimchi_log.debug(err % e.message)
+ wok_log.debug(err % e.message)
params['path'] = self.scanner.scan_dir_prepare(params['name'])
scan_params['pool_path'] = params['path']
@@ -270,9 +270,9 @@ class StoragePoolModel(object):
# If something (say a busy pool) prevents the refresh,
# throwing an Exception here would prevent all pools from
# displaying information -- so return None for busy
- kimchi_log.error("ERROR: Storage Pool get vol count: %s "
+ wok_log.error("ERROR: Storage Pool get vol count: %s "
% e.get_error_message())
- kimchi_log.error("ERROR: Storage Pool get vol count error no: %s "
+ wok_log.error("ERROR: Storage Pool get vol count error no: %s "
% e.get_error_code())
return 0
except Exception as e:
@@ -325,7 +325,7 @@ class StoragePoolModel(object):
# 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):
- kimchi_log.debug("NFS pool %s is offline, reason: NFS "
+ wok_log.debug("NFS pool %s is offline, reason: NFS "
"server %s is unreachable.", name,
source['addr'])
# Mark state as '4' => inaccessible.
@@ -364,7 +364,7 @@ class StoragePoolModel(object):
lsblk_cmd = ['lsblk', disk]
output, error, returncode = run_command(lsblk_cmd)
if returncode != 0:
- kimchi_log.error('%s is not a valid disk/partition. Could not '
+ wok_log.error('%s is not a valid disk/partition. Could not '
'add it to the pool %s.', disk, pool_name)
raise OperationFailed('KCHPOOL0027E', {'disk': disk,
'pool': pool_name})
@@ -374,7 +374,7 @@ class StoragePoolModel(object):
output, error, returncode = run_command(vgextend_cmd)
if returncode != 0:
msg = "Could not add disks to pool %s, error: %s"
- kimchi_log.error(msg, pool_name, error)
+ wok_log.error(msg, pool_name, error)
raise OperationFailed('KCHPOOL0028E', {'pool': pool_name,
'err': error})
# refreshing pool state
diff --git a/plugins/kimchi/model/storagetargets.py b/plugins/kimchi/model/storagetargets.py
index dd88fec..bbcfb0d 100644
--- a/plugins/kimchi/model/storagetargets.py
+++ b/plugins/kimchi/model/storagetargets.py
@@ -24,7 +24,7 @@ from lxml.builder import E
from config import CapabilitiesModel
from storageservers import STORAGE_SERVERS
-from wok.utils import kimchi_log, patch_find_nfs_target
+from wok.utils import wok_log, patch_find_nfs_target
class StorageTargetsModel(object):
@@ -51,7 +51,7 @@ class StorageTargetsModel(object):
ret = conn.findStoragePoolSources(target_type, xml, 0)
except libvirt.libvirtError as e:
err = "Query storage pool source fails because of %s"
- kimchi_log.warning(err, e.get_error_message())
+ wok_log.warning(err, e.get_error_message())
continue
targets = self._parse_target_source_result(target_type, ret)
@@ -78,7 +78,7 @@ class StorageTargetsModel(object):
except libvirt.libvirtError as e:
err = "Query storage pool source fails because of %s"
- kimchi_log.warning(err, e.get_error_message())
+ wok_log.warning(err, e.get_error_message())
# Filter target_list to not not show the used paths
target_list = [elem for elem in target_list
diff --git a/plugins/kimchi/model/storagevolumes.py b/plugins/kimchi/model/storagevolumes.py
index 8acb027..8b4e4ed 100644
--- a/plugins/kimchi/model/storagevolumes.py
+++ b/plugins/kimchi/model/storagevolumes.py
@@ -36,7 +36,7 @@ from diskutils import get_disk_ref_cnt
from storagepools import StoragePoolModel
from tasks import TaskModel
from wok.utils import add_task, get_next_clone_name, get_unique_file_name
-from wok.utils import kimchi_log
+from wok.utils import wok_log
from wok.xmlutils.utils import xpath_get_text
@@ -164,7 +164,7 @@ class StorageVolumesModel(object):
except Exception as e:
# If the storage volume was created flawlessly, then lets hide this
# error to avoid more error in the VM creation process
- kimchi_log.warning('Unable to store storage volume id in '
+ wok_log.warning('Unable to store storage volume id in '
'objectstore due error: %s', e.message)
cb('', True)
@@ -238,7 +238,7 @@ class StorageVolumesModel(object):
if virt_vol:
virt_vol.delete(0)
except libvirt.libvirtError, virt_e:
- kimchi_log.error(virt_e.message)
+ wok_log.error(virt_e.message)
finally:
raise OperationFailed('KCHVOL0007E', {'name': name,
'pool': pool_name,
@@ -523,7 +523,7 @@ class IsoVolumesModel(object):
volumes = pool.listVolumes()
except Exception, e:
# Skip inactive pools
- kimchi_log.debug("Shallow scan: skipping pool %s because of "
+ wok_log.debug("Shallow scan: skipping pool %s because of "
"error: %s", (pool_name, e.message))
continue
diff --git a/plugins/kimchi/model/vmhostdevs.py b/plugins/kimchi/model/vmhostdevs.py
index f0bc199..6ea7a9e 100644
--- a/plugins/kimchi/model/vmhostdevs.py
+++ b/plugins/kimchi/model/vmhostdevs.py
@@ -30,7 +30,7 @@ from host import DeviceModel, DevicesModel
from utils import get_vm_config_flag
from vms import DOM_STATE_MAP, VMModel
from wok.rollbackcontext import RollbackContext
-from wok.utils import kimchi_log, run_command
+from wok.utils import wok_log, run_command
class VMHostDevsModel(object):
@@ -153,7 +153,7 @@ class VMHostDevsModel(object):
out, err, rc = run_command(['setsebool', '-P',
'virt_use_sysfs=on'])
if rc != 0:
- kimchi_log.warning("Unable to turn on sebool virt_use_sysfs")
+ wok_log.warning("Unable to turn on sebool virt_use_sysfs")
def _attach_pci_device(self, vmid, dev_info):
self._validate_pci_passthrough_env()
@@ -184,7 +184,7 @@ class VMHostDevsModel(object):
try:
dom.attachDeviceFlags(xmlstr, device_flags)
except libvirt.libvirtError:
- kimchi_log.error(
+ wok_log.error(
'Failed to attach host device %s to VM %s: \n%s',
pci_info['name'], vmid, xmlstr)
raise
diff --git a/plugins/kimchi/model/vms.py b/plugins/kimchi/model/vms.py
index ae926a7..8d49cd8 100644
--- a/plugins/kimchi/model/vms.py
+++ b/plugins/kimchi/model/vms.py
@@ -45,7 +45,7 @@ from utils import set_metadata_node
from wok.rollbackcontext import RollbackContext
from ..screenshot import VMScreenshot
from wok.utils import add_task, convert_data_size, get_next_clone_name
-from wok.utils import import_class, kimchi_log, run_setfacl_set_attr
+from wok.utils import import_class, wok_log, run_setfacl_set_attr
from ..utils import template_name_from_uri
from wok.xmlutils.utils import xpath_get_text, xml_item_update
from wok.xmlutils.utils import dictize
@@ -131,7 +131,7 @@ class VMsModel(object):
except Exception as e:
# It is possible to continue Kimchi executions without store
# vm icon info
- kimchi_log.error('Error trying to update database with guest '
+ wok_log.error('Error trying to update database with guest '
'icon information due error: %s', e.message)
# If storagepool is SCSI, volumes will be LUNs and must be passed by
@@ -392,7 +392,7 @@ class VMModel(object):
# a new volume with the same size, the pool 'default' should
# be used
if orig_vol['capacity'] > orig_pool['available']:
- kimchi_log.warning('storage pool \'%s\' doesn\'t have '
+ wok_log.warning('storage pool \'%s\' doesn\'t have '
'enough free space to store image '
'\'%s\'; falling back to \'default\'',
orig_pool_name, path)
@@ -408,7 +408,7 @@ class VMModel(object):
elif orig_pool['type'] in ['scsi', 'iscsi']:
# SCSI and iSCSI always fall back to the storage pool 'default'
- kimchi_log.warning('cannot create new volume for clone in '
+ wok_log.warning('cannot create new volume for clone in '
'storage pool \'%s\'; falling back to '
'\'default\'', orig_pool_name)
new_pool_name = u'default'
@@ -738,7 +738,7 @@ class VMModel(object):
except Exception as e:
# VM might be deleted just after we get the list.
# This is OK, just skip.
- kimchi_log.debug('Error processing VM stats: %s', e.message)
+ wok_log.debug('Error processing VM stats: %s', e.message)
def _get_percentage_cpu_usage(self, vm_uuid, info, seconds):
prevCpuTime = self.stats[vm_uuid].get('cputime', 0)
@@ -914,7 +914,7 @@ class VMModel(object):
try:
snapshot_names = self.vmsnapshots.get_list(name)
except OperationFailed, e:
- kimchi_log.error('cannot list snapshots: %s; '
+ wok_log.error('cannot list snapshots: %s; '
'skipping snapshot deleting...' % e.message)
else:
for s in snapshot_names:
@@ -939,7 +939,7 @@ class VMModel(object):
session.delete('storagevolume', path,
ignore_missing=True)
except libvirt.libvirtError as e:
- kimchi_log.error('Unable to get storage volume by path: %s' %
+ wok_log.error('Unable to get storage volume by path: %s' %
e.message)
except Exception as e:
raise OperationFailed('KCHVOL0017E', {'err': e.message})
@@ -957,7 +957,7 @@ class VMModel(object):
session.delete('vm', dom.UUIDString(), ignore_missing=True)
except Exception as e:
# It is possible to delete vm without delete its database info
- kimchi_log.error('Error deleting vm information from database: '
+ wok_log.error('Error deleting vm information from database: '
'%s', e.message)
vnc.remove_proxy_token(name)
@@ -1053,7 +1053,7 @@ class VMModel(object):
except Exception as e:
# It is possible to continue Kimchi executions without delete
# screenshots
- kimchi_log.error('Error trying to delete vm screenshot from '
+ wok_log.error('Error trying to delete vm screenshot from '
'database due error: %s', e.message)
def suspend(self, name):
@@ -1119,7 +1119,7 @@ class VMScreenshotModel(object):
except Exception as e:
# It is possible to continue Kimchi executions without store
# screenshots
- kimchi_log.error('Error trying to update database with guest '
+ wok_log.error('Error trying to update database with guest '
'screenshot information due error: %s', e.message)
return img_path
@@ -1137,7 +1137,7 @@ class VMScreenshotModel(object):
# exception from '__exit__' when calling 'session.store'
# It is possible to continue Kimchi vm executions without
# screenshots
- kimchi_log.error('Error trying to update database with guest '
+ wok_log.error('Error trying to update database with guest '
'screenshot information due error: %s', e.message)
return LibvirtVMScreenshot(params, conn)
diff --git a/plugins/kimchi/model/vmstorages.py b/plugins/kimchi/model/vmstorages.py
index 54a9a69..9de2f29 100644
--- a/plugins/kimchi/model/vmstorages.py
+++ b/plugins/kimchi/model/vmstorages.py
@@ -29,7 +29,7 @@ from storagevolumes import StorageVolumeModel
from utils import get_vm_config_flag
from ..osinfo import lookup
from diskutils import get_disk_ref_cnt, set_disk_ref_cnt
-from wok.utils import kimchi_log
+from wok.utils import wok_log
from ..xmlutils.disk import get_device_node, get_disk_xml
from ..xmlutils.disk import get_vm_disk_info, get_vm_disks
@@ -190,7 +190,7 @@ class VMStorageModel(object):
if path is not None:
ref_cnt = get_disk_ref_cnt(self.objstore, self.conn, path)
else:
- kimchi_log.error("Unable to decrement volume ref_cnt on"
+ wok_log.error("Unable to decrement volume ref_cnt on"
" delete because no path could be found.")
dom.detachDeviceFlags(etree.tostring(disk),
get_vm_config_flag(dom, 'all'))
@@ -200,7 +200,7 @@ class VMStorageModel(object):
if ref_cnt is not None and ref_cnt > 0:
set_disk_ref_cnt(self.objstore, path, ref_cnt - 1)
else:
- kimchi_log.error("Unable to decrement %s:%s ref_cnt on delete."
+ wok_log.error("Unable to decrement %s:%s ref_cnt on delete."
% (vm_name, dev_name))
def update(self, vm_name, dev_name, params):
@@ -242,6 +242,6 @@ class VMStorageModel(object):
set_disk_ref_cnt(self.objstore, new_disk_path,
new_disk_ref_cnt + 1)
except Exception as e:
- kimchi_log.error("Unable to update dev ref_cnt on update due to"
+ wok_log.error("Unable to update dev ref_cnt on update due to"
" %s:" % e.message)
return dev
diff --git a/plugins/kimchi/scan.py b/plugins/kimchi/scan.py
index 8e42fbc..663b838 100644
--- a/plugins/kimchi/scan.py
+++ b/plugins/kimchi/scan.py
@@ -27,7 +27,7 @@ import time
from isoinfo import IsoImage, probe_iso
-from wok.utils import kimchi_log
+from wok.utils import wok_log
SCAN_IGNORE = ['/tmp/kimchi-scan-*']
@@ -58,7 +58,7 @@ class Scanner(object):
self.clean_cb(transient_pool)
except OSError as e:
msg = "Exception %s occured when cleaning stale pool, ignore"
- kimchi_log.debug(msg % e.message)
+ wok_log.debug(msg % e.message)
def scan_dir_prepare(self, name):
# clean stale scan storage pools
diff --git a/plugins/kimchi/screenshot.py b/plugins/kimchi/screenshot.py
index 765e1a6..05701dd 100644
--- a/plugins/kimchi/screenshot.py
+++ b/plugins/kimchi/screenshot.py
@@ -33,7 +33,7 @@ except ImportError:
import config
-from wok.utils import kimchi_log
+from wok.utils import wok_log
(fd, pipe) = tempfile.mkstemp()
@@ -164,7 +164,7 @@ class VMScreenshot(object):
try:
self._generate_scratch(thumbnail)
except:
- kimchi_log.error("screenshot_creation: Unable to create "
+ wok_log.error("screenshot_creation: Unable to create "
"screenshot image %s." % thumbnail)
else:
self._create_black_image(thumbnail)
@@ -178,7 +178,7 @@ class VMScreenshot(object):
# work around pic truncate validation in thumbnail generation
im.thumbnail(self.THUMBNAIL_SIZE)
except Exception as e:
- kimchi_log.warning("Image load with warning: %s." % e)
+ wok_log.warning("Image load with warning: %s." % e)
im.save(thumbnail, "PNG")
self.info['thumbnail'] = thumbnail
diff --git a/plugins/kimchi/swupdate.py b/plugins/kimchi/swupdate.py
index 26ce72c..cbc7f33 100644
--- a/plugins/kimchi/swupdate.py
+++ b/plugins/kimchi/swupdate.py
@@ -23,7 +23,7 @@ import time
from wok.basemodel import Singleton
from config import kimchiLock
from wok.exception import NotFoundError, OperationFailed
-from wok.utils import kimchi_log, run_command
+from wok.utils import wok_log, run_command
class SoftwareUpdate(object):
@@ -48,18 +48,18 @@ class SoftwareUpdate(object):
# correct package management system
try:
__import__('yum')
- kimchi_log.info("Loading YumUpdate features.")
+ wok_log.info("Loading YumUpdate features.")
self._pkg_mnger = YumUpdate()
except ImportError:
try:
__import__('apt')
- kimchi_log.info("Loading AptUpdate features.")
+ wok_log.info("Loading AptUpdate features.")
self._pkg_mnger = AptUpdate()
except ImportError:
zypper_help = ["zypper", "--help"]
(stdout, stderr, returncode) = run_command(zypper_help)
if returncode == 0:
- kimchi_log.info("Loading ZypperUpdate features.")
+ wok_log.info("Loading ZypperUpdate features.")
self._pkg_mnger = ZypperUpdate()
else:
raise Exception("There is no compatible package manager "
diff --git a/plugins/kimchi/tests/utils.py b/plugins/kimchi/tests/utils.py
index 6144dc7..e22bffa 100644
--- a/plugins/kimchi/tests/utils.py
+++ b/plugins/kimchi/tests/utils.py
@@ -41,7 +41,7 @@ import wok.server
from wok.config import config, paths
from wok.auth import User, USER_NAME, USER_GROUPS, USER_ROLES, tabs
from wok.exception import NotFoundError, OperationFailed
-from wok.utils import kimchi_log
+from wok.utils import wok_log
_ports = {}
@@ -227,12 +227,12 @@ def wait_task(task_lookup, taskid, timeout=10):
for i in range(0, timeout):
task_info = task_lookup(taskid)
if task_info['status'] == "running":
- kimchi_log.info("Waiting task %s, message: %s",
+ wok_log.info("Waiting task %s, message: %s",
taskid, task_info['message'])
time.sleep(1)
else:
return
- kimchi_log.error("Timeout while process long-run task, "
+ wok_log.error("Timeout while process long-run task, "
"try to increase timeout value.")
diff --git a/src/wok/objectstore.py b/src/wok/objectstore.py
index 7c2a5cc..87a30d1 100644
--- a/src/wok/objectstore.py
+++ b/src/wok/objectstore.py
@@ -30,7 +30,7 @@ except ImportError:
from wok import config
from wok.exception import NotFoundError
-from wok.utils import kimchi_log
+from wok.utils import wok_log
class ObjectStoreSession(object):
@@ -129,5 +129,5 @@ class ObjectStore(object):
if type is not None and issubclass(type, sqlite3.DatabaseError):
# Logs the error and return False, which makes __exit__ raise
# exception again
- kimchi_log.error(traceback.format_exc())
+ wok_log.error(traceback.format_exc())
return False
diff --git a/src/wok/utils.py b/src/wok/utils.py
index 49846f0..267cd3e 100644
--- a/src/wok/utils.py
+++ b/src/wok/utils.py
@@ -40,7 +40,7 @@ from wok.config import paths, PluginPaths
from wok.exception import InvalidParameter, TimeoutExpired
-kimchi_log = cherrypy.log.error_log
+wok_log = cherrypy.log.error_log
task_id = 0
@@ -200,22 +200,22 @@ def run_command(cmd, timeout=None):
timer.start()
out, error = proc.communicate()
- kimchi_log.debug("Run command: '%s'", " ".join(cmd))
+ wok_log.debug("Run command: '%s'", " ".join(cmd))
if out:
- kimchi_log.debug("out:\n%s", out)
+ wok_log.debug("out:\n%s", out)
if proc.returncode != 0:
- kimchi_log.error("rc: %s error: %s returned from cmd: %s",
+ wok_log.error("rc: %s error: %s returned from cmd: %s",
proc.returncode, error, ' '.join(cmd))
elif error:
- kimchi_log.debug("error: %s returned from cmd: %s",
+ wok_log.debug("error: %s returned from cmd: %s",
error, ' '.join(cmd))
if timeout_flag[0]:
msg = ("subprocess is killed by signal.SIGKILL for "
"timeout %s seconds" % timeout)
- kimchi_log.error(msg)
+ wok_log.error(msg)
msg_args = {'cmd': " ".join(cmd), 'seconds': str(timeout)}
raise TimeoutExpired("KCHUTILS0002E", msg_args)
@@ -226,7 +226,7 @@ def run_command(cmd, timeout=None):
except Exception as e:
msg = "Failed to run command: %s." % " ".join(cmd)
msg = msg if proc is None else msg + "\n error code: %s."
- kimchi_log.error("%s %s", msg, e)
+ wok_log.error("%s %s", msg, e)
if proc:
return out, error, proc.returncode
@@ -250,7 +250,7 @@ def patch_find_nfs_target(nfs_server):
try:
out = run_command(cmd, 10)[0]
except TimeoutExpired:
- kimchi_log.warning("server %s query timeout, may not have any path "
+ wok_log.warning("server %s query timeout, may not have any path "
"exported", nfs_server)
return list()
@@ -288,7 +288,7 @@ def probe_file_permission_as_user(file, user):
with open(file):
q.put((True, None))
except Exception as e:
- kimchi_log.debug(traceback.format_exc())
+ wok_log.debug(traceback.format_exc())
q.put((False, e))
queue = Queue()
--
1.7.1
More information about the Kimchi-devel
mailing list