[PATCH] [Kimchi] Customize user request log messages
by Lucio Correia
Signed-off-by: Lucio Correia <luciojhc(a)linux.vnet.ibm.com>
---
control/networks.py | 15 +++++++++++++++
control/storagepools.py | 16 ++++++++++++++++
control/storagevolumes.py | 17 +++++++++++++++++
control/templates.py | 15 +++++++++++++++
control/vm/hostdevs.py | 11 +++++++++++
control/vm/ifaces.py | 12 ++++++++++++
control/vm/snapshots.py | 14 ++++++++++++++
control/vm/storages.py | 12 ++++++++++++
control/vms.py | 24 ++++++++++++++++++++++++
9 files changed, 136 insertions(+)
diff --git a/control/networks.py b/control/networks.py
index cd1feed..a8a26b2 100644
--- a/control/networks.py
+++ b/control/networks.py
@@ -21,6 +21,19 @@ from wok.control.base import Collection, Resource
from wok.control.utils import UrlSubNode
+NETWORKS_REQUESTS = {
+ 'POST': {'default': "Create virtual network '%(name)s'"},
+}
+
+NETWORK_REQUESTS = {
+ 'DELETE': {'default': "Remove virtual network '%(ident)s'"},
+ 'POST': {
+ 'activate': "Activate virtual network '%(ident)s'",
+ 'deactivate': "Deactivate virtual network '%(ident)s'",
+ },
+}
+
+
@UrlSubNode('networks', True)
class Networks(Collection):
def __init__(self, model):
@@ -28,6 +41,7 @@ class Networks(Collection):
self.role_key = 'network'
self.admin_methods = ['POST']
self.resource = Network
+ self.log_map = NETWORKS_REQUESTS
class Network(Resource):
@@ -39,6 +53,7 @@ class Network(Resource):
self.activate = self.generate_action_handler('activate')
self.deactivate = self.generate_action_handler('deactivate',
destructive=True)
+ self.log_map = NETWORK_REQUESTS
@property
def data(self):
diff --git a/control/storagepools.py b/control/storagepools.py
index 10b371d..2139566 100644
--- a/control/storagepools.py
+++ b/control/storagepools.py
@@ -29,6 +29,20 @@ from wok.plugins.kimchi.control.storagevolumes import StorageVolumes
from wok.plugins.kimchi.model.storagepools import ISO_POOL_NAME
+STORAGEPOOLS_REQUESTS = {
+ 'POST': {'default': "Create storage pool '%(name)s'"},
+}
+
+STORAGEPOOL_REQUESTS = {
+ 'DELETE': {'default': "Remove storage pool '%(ident)s'"},
+ 'PUT': {'default': "Update storage pool"},
+ 'POST': {
+ 'activate': "Activate storage pool '%(ident)s'",
+ 'deactivate': "Deactivate storage pool '%(ident)s'",
+ },
+}
+
+
@UrlSubNode('storagepools', True)
class StoragePools(Collection):
def __init__(self, model):
@@ -38,6 +52,7 @@ class StoragePools(Collection):
self.resource = StoragePool
isos = IsoPool(model)
setattr(self, ISO_POOL_NAME, isos)
+ self.log_map = STORAGEPOOLS_REQUESTS
def create(self, params, *args):
try:
@@ -84,6 +99,7 @@ class StoragePool(Resource):
self.deactivate = self.generate_action_handler('deactivate',
destructive=True)
self.storagevolumes = StorageVolumes(self.model, ident)
+ self.log_map = STORAGEPOOL_REQUESTS
@property
def data(self):
diff --git a/control/storagevolumes.py b/control/storagevolumes.py
index d78eefb..01654cb 100644
--- a/control/storagevolumes.py
+++ b/control/storagevolumes.py
@@ -22,6 +22,21 @@ from wok.control.base import AsyncCollection, Collection, Resource
from wok.control.utils import get_class_name, model_fn
+STORAGEVOLUMES_REQUESTS = {
+ 'POST': {'default': "Create storage volume '%(name)s'"},
+}
+
+STORAGEVOLUME_REQUESTS = {
+ 'DELETE': {'default': "Remove template '%(ident)s'"},
+ 'PUT': {'default': "Update storage volume"},
+ 'POST': {
+ 'wipe': "Wipe storage volume '%(ident)s'",
+ 'resize': "Resize storage volume '%(ident)s'",
+ 'clone': "Clone storage volume '%(ident)s'",
+ },
+}
+
+
class StorageVolumes(AsyncCollection):
def __init__(self, model, pool):
super(StorageVolumes, self).__init__(model)
@@ -29,6 +44,7 @@ class StorageVolumes(AsyncCollection):
self.pool = pool
self.resource_args = [self.pool, ]
self.model_args = [self.pool, ]
+ self.log_map = STORAGEVOLUMES_REQUESTS
def filter_data(self, resources, fields_filter):
# filter directory from storage volumes
@@ -48,6 +64,7 @@ class StorageVolume(Resource):
self.resize = self.generate_action_handler('resize', ['size'])
self.wipe = self.generate_action_handler('wipe')
self.clone = self.generate_action_handler_task('clone')
+ self.log_map = STORAGEVOLUME_REQUESTS
@property
def data(self):
diff --git a/control/templates.py b/control/templates.py
index aebac0c..486dca1 100644
--- a/control/templates.py
+++ b/control/templates.py
@@ -21,6 +21,19 @@ from wok.control.base import Collection, Resource
from wok.control.utils import UrlSubNode
+TEMPLATES_REQUESTS = {
+ 'POST': {'default': "Create template '%(name)s'"},
+}
+
+TEMPLATE_REQUESTS = {
+ 'DELETE': {'default': "Remove template '%(ident)s'"},
+ 'PUT': {'default': "Update template"},
+ 'POST': {
+ 'clone': "Clone template '%(ident)s'",
+ },
+}
+
+
@UrlSubNode('templates', True)
class Templates(Collection):
def __init__(self, model):
@@ -28,6 +41,7 @@ class Templates(Collection):
self.role_key = 'templates'
self.admin_methods = ['GET', 'POST']
self.resource = Template
+ self.log_map = TEMPLATES_REQUESTS
class Template(Resource):
@@ -37,6 +51,7 @@ class Template(Resource):
self.admin_methods = ['PUT', 'POST', 'DELETE']
self.uri_fmt = "/templates/%s"
self.clone = self.generate_action_handler('clone')
+ self.log_map = TEMPLATE_REQUESTS
@property
def data(self):
diff --git a/control/vm/hostdevs.py b/control/vm/hostdevs.py
index bae98df..11e59c2 100644
--- a/control/vm/hostdevs.py
+++ b/control/vm/hostdevs.py
@@ -21,6 +21,15 @@ from wok.control.base import Collection, Resource
from wok.control.utils import UrlSubNode
+VMHOSTDEVS_REQUESTS = {
+ 'POST': {'default': "Attach host device '%(name)s' to guest"},
+}
+
+VMHOSTDEV_REQUESTS = {
+ 'DELETE': {'default': "Detach host device '%(ident)s' from guest"},
+}
+
+
@UrlSubNode("hostdevs")
class VMHostDevs(Collection):
def __init__(self, model, vmid):
@@ -29,6 +38,7 @@ class VMHostDevs(Collection):
self.vmid = vmid
self.resource_args = [self.vmid, ]
self.model_args = [self.vmid, ]
+ self.log_map = VMHOSTDEVS_REQUESTS
class VMHostDev(Resource):
@@ -37,6 +47,7 @@ class VMHostDev(Resource):
self.vmid = vmid
self.ident = ident
self.model_args = [self.vmid, self.ident]
+ self.log_map = VMHOSTDEV_REQUESTS
@property
def data(self):
diff --git a/control/vm/ifaces.py b/control/vm/ifaces.py
index d856956..f7c4e36 100644
--- a/control/vm/ifaces.py
+++ b/control/vm/ifaces.py
@@ -21,6 +21,16 @@ from wok.control.base import Collection, Resource
from wok.control.utils import UrlSubNode
+VMIFACES_REQUESTS = {
+ 'POST': {'default': "Attach network interface '%(network)s' to guest"},
+}
+
+VMIFACE_REQUESTS = {
+ 'DELETE': {'default': "Detach network interface '%(ident)s' from guest"},
+ 'PUT': {'default': "Update guest network interface"},
+}
+
+
@UrlSubNode("ifaces")
class VMIfaces(Collection):
def __init__(self, model, vm):
@@ -29,6 +39,7 @@ class VMIfaces(Collection):
self.vm = vm
self.resource_args = [self.vm, ]
self.model_args = [self.vm, ]
+ self.log_map = VMIFACES_REQUESTS
class VMIface(Resource):
@@ -39,6 +50,7 @@ class VMIface(Resource):
self.info = {}
self.model_args = [self.vm, self.ident]
self.uri_fmt = '/vms/%s/ifaces/%s'
+ self.log_map = VMIFACE_REQUESTS
@property
def data(self):
diff --git a/control/vm/snapshots.py b/control/vm/snapshots.py
index b95eaa9..5a6013c 100644
--- a/control/vm/snapshots.py
+++ b/control/vm/snapshots.py
@@ -21,6 +21,18 @@ from wok.control.base import AsyncCollection, Resource
from wok.control.utils import UrlSubNode
+VMSNAPSHOTS_REQUESTS = {
+ 'POST': {'default': "Create guest snapshot '%(name)s'"},
+}
+
+VMSNAPSHOT_REQUESTS = {
+ 'DELETE': {'default': "Remove guest snapshot '%(ident)s'"},
+ 'POST': {
+ 'revert': "Revert to guest snapshot '%(ident)s'",
+ },
+}
+
+
@UrlSubNode('snapshots')
class VMSnapshots(AsyncCollection):
def __init__(self, model, vm):
@@ -30,6 +42,7 @@ class VMSnapshots(AsyncCollection):
self.resource_args = [self.vm, ]
self.model_args = [self.vm, ]
self.current = CurrentVMSnapshot(model, vm)
+ self.log_map = VMSNAPSHOTS_REQUESTS
class VMSnapshot(Resource):
@@ -40,6 +53,7 @@ class VMSnapshot(Resource):
self.model_args = [self.vm, self.ident]
self.uri_fmt = '/vms/%s/snapshots/%s'
self.revert = self.generate_action_handler('revert')
+ self.log_map = VMSNAPSHOT_REQUESTS
@property
def data(self):
diff --git a/control/vm/storages.py b/control/vm/storages.py
index 3c7d1a3..5e7b8c4 100644
--- a/control/vm/storages.py
+++ b/control/vm/storages.py
@@ -21,6 +21,16 @@ from wok.control.base import Collection, Resource
from wok.control.utils import UrlSubNode
+VMSTORAGES_REQUESTS = {
+ 'POST': {'default': "Attach '%(type)s' storage '%(path)s' to guest"},
+}
+
+VMSTORAGE_REQUESTS = {
+ 'DELETE': {'default': "Remove storage '%(ident)s' from guest"},
+ 'PUT': {'default': "Update guest storage path to '%(path)s'"},
+}
+
+
@UrlSubNode("storages")
class VMStorages(Collection):
def __init__(self, model, vm):
@@ -29,6 +39,7 @@ class VMStorages(Collection):
self.vm = vm
self.resource_args = [self.vm, ]
self.model_args = [self.vm, ]
+ self.log_map = VMSTORAGES_REQUESTS
class VMStorage(Resource):
@@ -39,6 +50,7 @@ class VMStorage(Resource):
self.info = {}
self.model_args = [self.vm, self.ident]
self.uri_fmt = '/vms/%s/storages/%s'
+ self.log_map = VMSTORAGE_REQUESTS
@property
def data(self):
diff --git a/control/vms.py b/control/vms.py
index 7745a18..1297955 100644
--- a/control/vms.py
+++ b/control/vms.py
@@ -23,6 +23,28 @@ from wok.control.utils import internal_redirect, UrlSubNode
from wok.plugins.kimchi.control.vm import sub_nodes
+VMS_REQUESTS = {
+ 'POST': {'default': "Create guest from template '%(template)s'"},
+}
+
+VM_REQUESTS = {
+ 'DELETE': {'default': "Remove guest '%(ident)s'"},
+ 'PUT': {'default': "Update guest"},
+ 'POST': {
+ 'start': "Start guest '%(ident)s'",
+ 'poweroff': "Power off guest '%(ident)s'",
+ 'shutdown': "Shutdown guest '%(ident)s'",
+ 'reset': "Restart guest '%(ident)s'",
+ 'connect': "Connect to guest '%(ident)s' through novnc/spice",
+ 'clone': "Clone guest '%(ident)s'",
+ 'migrate': "Migrate guest '%(ident)s'",
+ 'suspend': "Suspend guest '%(ident)s'",
+ 'resume': "Resume guest '%(ident)s'",
+ 'serial': "Connect to guest '%(ident)s' through serial",
+ },
+}
+
+
@UrlSubNode('vms', True)
class VMs(AsyncCollection):
def __init__(self, model):
@@ -30,6 +52,7 @@ class VMs(AsyncCollection):
self.resource = VM
self.role_key = 'guests'
self.admin_methods = ['POST']
+ self.log_map = VMS_REQUESTS
class VM(Resource):
@@ -56,6 +79,7 @@ class VM(Resource):
self.suspend = self.generate_action_handler('suspend')
self.resume = self.generate_action_handler('resume')
self.serial = self.generate_action_handler('serial')
+ self.log_map = VM_REQUESTS
@property
def data(self):
--
1.9.1
8 years, 8 months
[PATCH v3][Kimchi] Increase guest Max Memory limits
by Rodrigo Trujillo
This patch changes the limits of max memory to 16TiB in PowerPC and 4TiB
in x86 architectures.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
i18n.py | 2 +-
model/templates.py | 12 ++++++++----
tests/test_template.py | 5 +++--
3 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/i18n.py b/i18n.py
index 008e327..707b74b 100644
--- a/i18n.py
+++ b/i18n.py
@@ -133,7 +133,7 @@ messages = {
"KCHVM0076E": _("VM %(name)s must have serial and console defined to open a web serial console"),
"KCHVM0077E": _("Impossible to get the serial console of %(name)s"),
"KCHVM0078E": _("Memory or Maximum Memory value is higher than amount supported by the host: %(memHost)sMiB."),
- "KCHVM0079E": _("Memory or Maximum Memory value is higher than maximum amount recommended: 1TiB"),
+ "KCHVM0079E": _("Memory or Maximum Memory value is higher than maximum amount recommended: %(value)sTiB"),
"KCHVM0080E": _("Cannot update Maximum Memory when guest is running."),
"KCHVMHDEV0001E": _("VM %(vmid)s does not contain directly assigned host device %(dev_name)s."),
diff --git a/model/templates.py b/model/templates.py
index fb63dc1..92705b6 100644
--- a/model/templates.py
+++ b/model/templates.py
@@ -38,8 +38,10 @@ from wok.plugins.kimchi.vmtemplate import VMTemplate
# In PowerPC, memories must be aligned to 256 MiB
PPC_MEM_ALIGN = 256
-# Max memory 1TB, in KiB
-MAX_MEM_LIM = 1073741824
+# Max memory 16TB for PPC and 4TiB for X (according to Red Hat), in KiB
+MAX_MEM_LIM = 4294967296 # 4 TiB
+if os.uname()[4] in ['ppc', 'ppc64', 'ppc64le']:
+ MAX_MEM_LIM *= 4 # 16TiB
class TemplatesModel(object):
@@ -225,9 +227,11 @@ def validate_memory(memory):
else:
host_memory = psutil.TOTAL_PHYMEM >> 10 >> 10
- # Memories must be lesser than 1TB and the Host memory limit
+ # Memories must be lesser than 16TiB (PPC) or 4TiB (x86) and the Host
+ # memory limit
if (current > (MAX_MEM_LIM >> 10)) or (maxmem > (MAX_MEM_LIM >> 10)):
- raise InvalidParameter("KCHVM0079E")
+ raise InvalidParameter("KCHVM0079E",
+ {'value': str(MAX_MEM_LIM / (1024**3))})
if (current > host_memory) or (maxmem > host_memory):
raise InvalidParameter("KCHVM0078E", {'memHost': host_memory})
diff --git a/tests/test_template.py b/tests/test_template.py
index 4a74955..fcb2e46 100644
--- a/tests/test_template.py
+++ b/tests/test_template.py
@@ -29,6 +29,7 @@ from tests.utils import get_free_port, patch_auth, request, run_server
from wok.plugins.kimchi.config import READONLY_POOL_TYPE
from wok.plugins.kimchi.mockmodel import MockModel
from wok.plugins.kimchi.model.featuretests import FeatureTests
+from wok.plugins.kimchi.model.templates import MAX_MEM_LIM
model = None
@@ -227,8 +228,8 @@ class TemplateTests(unittest.TestCase):
req = json.dumps({'memory': {'current': 2048}})
resp = self.request(new_tmpl_uri, req, 'PUT')
self.assertEquals(400, resp.status)
- # - max memory greater than 1TiB limit
- req = json.dumps({'memory': {'maxmemory': 1073741824 + 1024}})
+ # - max memory greater than limit: 16TiB to PPC and 4TiB to x86
+ req = json.dumps({'memory': {'maxmemory': MAX_MEM_LIM + 1024}})
resp = self.request(new_tmpl_uri, req, 'PUT')
self.assertEquals(400, resp.status)
self.assertTrue('KCHVM0079E' in resp.read())
--
2.1.0
8 years, 8 months
[PATCH v2][Kimchi] Increase guest Max Memory limits
by Rodrigo Trujillo
This patch changes the limits of max memory to 16TiB in PowerPC and 4TiB
in x86 architectures.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
i18n.py | 2 +-
model/templates.py | 12 ++++++++----
tests/test_template.py | 5 +++--
3 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/i18n.py b/i18n.py
index 008e327..707b74b 100644
--- a/i18n.py
+++ b/i18n.py
@@ -133,7 +133,7 @@ messages = {
"KCHVM0076E": _("VM %(name)s must have serial and console defined to open a web serial console"),
"KCHVM0077E": _("Impossible to get the serial console of %(name)s"),
"KCHVM0078E": _("Memory or Maximum Memory value is higher than amount supported by the host: %(memHost)sMiB."),
- "KCHVM0079E": _("Memory or Maximum Memory value is higher than maximum amount recommended: 1TiB"),
+ "KCHVM0079E": _("Memory or Maximum Memory value is higher than maximum amount recommended: %(value)sTiB"),
"KCHVM0080E": _("Cannot update Maximum Memory when guest is running."),
"KCHVMHDEV0001E": _("VM %(vmid)s does not contain directly assigned host device %(dev_name)s."),
diff --git a/model/templates.py b/model/templates.py
index fb63dc1..ef725f5 100644
--- a/model/templates.py
+++ b/model/templates.py
@@ -38,8 +38,10 @@ from wok.plugins.kimchi.vmtemplate import VMTemplate
# In PowerPC, memories must be aligned to 256 MiB
PPC_MEM_ALIGN = 256
-# Max memory 1TB, in KiB
-MAX_MEM_LIM = 1073741824
+# Max memory 16TB for PPC and 4TiB for X (according to Red Hat), in KiB
+MAX_MEM_LIM = 4294967296 # 4 TiB
+if os.uname()[4] in ['ppc', 'ppc64', 'ppc64le']:
+ MAX_MEM_LIM = 4 * 4294967296 # 16TiB
class TemplatesModel(object):
@@ -225,9 +227,11 @@ def validate_memory(memory):
else:
host_memory = psutil.TOTAL_PHYMEM >> 10 >> 10
- # Memories must be lesser than 1TB and the Host memory limit
+ # Memories must be lesser than 16TiB (PPC) or 4TiB (x86) and the Host
+ # memory limit
if (current > (MAX_MEM_LIM >> 10)) or (maxmem > (MAX_MEM_LIM >> 10)):
- raise InvalidParameter("KCHVM0079E")
+ raise InvalidParameter("KCHVM0079E",
+ {'value': str(MAX_MEM_LIM / (1024**3))})
if (current > host_memory) or (maxmem > host_memory):
raise InvalidParameter("KCHVM0078E", {'memHost': host_memory})
diff --git a/tests/test_template.py b/tests/test_template.py
index 4a74955..fcb2e46 100644
--- a/tests/test_template.py
+++ b/tests/test_template.py
@@ -29,6 +29,7 @@ from tests.utils import get_free_port, patch_auth, request, run_server
from wok.plugins.kimchi.config import READONLY_POOL_TYPE
from wok.plugins.kimchi.mockmodel import MockModel
from wok.plugins.kimchi.model.featuretests import FeatureTests
+from wok.plugins.kimchi.model.templates import MAX_MEM_LIM
model = None
@@ -227,8 +228,8 @@ class TemplateTests(unittest.TestCase):
req = json.dumps({'memory': {'current': 2048}})
resp = self.request(new_tmpl_uri, req, 'PUT')
self.assertEquals(400, resp.status)
- # - max memory greater than 1TiB limit
- req = json.dumps({'memory': {'maxmemory': 1073741824 + 1024}})
+ # - max memory greater than limit: 16TiB to PPC and 4TiB to x86
+ req = json.dumps({'memory': {'maxmemory': MAX_MEM_LIM + 1024}})
resp = self.request(new_tmpl_uri, req, 'PUT')
self.assertEquals(400, resp.status)
self.assertTrue('KCHVM0079E' in resp.read())
--
2.1.0
8 years, 8 months
[PATCH][Kimchi] Increase guest Max Memory limit to 16TiB
by Rodrigo Trujillo
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
i18n.py | 2 +-
model/templates.py | 6 +++---
tests/test_template.py | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/i18n.py b/i18n.py
index 008e327..dc374c3 100644
--- a/i18n.py
+++ b/i18n.py
@@ -133,7 +133,7 @@ messages = {
"KCHVM0076E": _("VM %(name)s must have serial and console defined to open a web serial console"),
"KCHVM0077E": _("Impossible to get the serial console of %(name)s"),
"KCHVM0078E": _("Memory or Maximum Memory value is higher than amount supported by the host: %(memHost)sMiB."),
- "KCHVM0079E": _("Memory or Maximum Memory value is higher than maximum amount recommended: 1TiB"),
+ "KCHVM0079E": _("Memory or Maximum Memory value is higher than maximum amount recommended: 16TiB"),
"KCHVM0080E": _("Cannot update Maximum Memory when guest is running."),
"KCHVMHDEV0001E": _("VM %(vmid)s does not contain directly assigned host device %(dev_name)s."),
diff --git a/model/templates.py b/model/templates.py
index fb63dc1..39e8982 100644
--- a/model/templates.py
+++ b/model/templates.py
@@ -38,8 +38,8 @@ from wok.plugins.kimchi.vmtemplate import VMTemplate
# In PowerPC, memories must be aligned to 256 MiB
PPC_MEM_ALIGN = 256
-# Max memory 1TB, in KiB
-MAX_MEM_LIM = 1073741824
+# Max memory 16TB, in KiB
+MAX_MEM_LIM = 17179869184
class TemplatesModel(object):
@@ -225,7 +225,7 @@ def validate_memory(memory):
else:
host_memory = psutil.TOTAL_PHYMEM >> 10 >> 10
- # Memories must be lesser than 1TB and the Host memory limit
+ # Memories must be lesser than 16TB and the Host memory limit
if (current > (MAX_MEM_LIM >> 10)) or (maxmem > (MAX_MEM_LIM >> 10)):
raise InvalidParameter("KCHVM0079E")
if (current > host_memory) or (maxmem > host_memory):
diff --git a/tests/test_template.py b/tests/test_template.py
index 4a74955..912afe3 100644
--- a/tests/test_template.py
+++ b/tests/test_template.py
@@ -227,8 +227,8 @@ class TemplateTests(unittest.TestCase):
req = json.dumps({'memory': {'current': 2048}})
resp = self.request(new_tmpl_uri, req, 'PUT')
self.assertEquals(400, resp.status)
- # - max memory greater than 1TiB limit
- req = json.dumps({'memory': {'maxmemory': 1073741824 + 1024}})
+ # - max memory greater than 16TiB limit
+ req = json.dumps({'memory': {'maxmemory': (16 * 1073741824) + 1024}})
resp = self.request(new_tmpl_uri, req, 'PUT')
self.assertEquals(400, resp.status)
self.assertTrue('KCHVM0079E' in resp.read())
--
2.1.0
8 years, 8 months
[PATCH] [Kimchi] Bug fix: Remove storage volume file while removing the storage volume
by Aline Manera
When removing a storage volume, it was only removed from a libvirt
perspective, ie, the storage volume file kept in the system.
It may confuse user as he/she will not be able to create a new storage
volume with the same name from the storage volume removed before as the file
exists in the system.
To avoid it, remove the file from the system after removing it from a
libvirt perspective.
This issue was identified due a failure in the test suite.
2 files related to storage volume tests were kept on the system causing
errors when running the test suite multiple times.
To verify this patch, please, make sure to do not have any leftovers in the
'default' storage pool directory (/var/lib/libvirt/images).
After that, run the test suite mutliple times and you will see no
leftovers will be in the system when the test completes.
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
model/storagevolumes.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/model/storagevolumes.py b/model/storagevolumes.py
index d010bcd..f87738f 100644
--- a/model/storagevolumes.py
+++ b/model/storagevolumes.py
@@ -367,12 +367,19 @@ class StorageVolumeModel(object):
raise InvalidParameter("KCHVOL0012E", {'type': pool_info['type']})
volume = StorageVolumeModel.get_storagevolume(pool, name, self.conn)
+ vol_path = volume.path()
try:
volume.delete(0)
except libvirt.libvirtError as e:
raise OperationFailed("KCHVOL0010E",
{'name': name, 'err': e.get_error_message()})
+ try:
+ os.remove(vol_path)
+ except OSError, e:
+ wok_log.error("Unable to delete storage volume file: %s."
+ "Details: %s" % (pool_info['path'], e.message))
+
def resize(self, pool, name, size):
volume = StorageVolumeModel.get_storagevolume(pool, name, self.conn)
--
2.5.0
8 years, 8 months
[PATCH V2] [Kimchi] Customize user request log messages
by Lucio Correia
Signed-off-by: Lucio Correia <luciojhc(a)linux.vnet.ibm.com>
---
control/networks.py | 15 +++++++++++++++
control/storagepools.py | 16 ++++++++++++++++
control/storagevolumes.py | 25 +++++++++++++++++++++++++
control/templates.py | 15 +++++++++++++++
control/vm/hostdevs.py | 19 +++++++++++++++++++
control/vm/ifaces.py | 24 ++++++++++++++++++++++++
control/vm/snapshots.py | 21 +++++++++++++++++++++
control/vm/storages.py | 21 +++++++++++++++++++++
control/vms.py | 27 +++++++++++++++++++++++++++
9 files changed, 183 insertions(+)
Changes in V2:
- Improve log messages according to wok modifications
diff --git a/control/networks.py b/control/networks.py
index cd1feed..8ba2206 100644
--- a/control/networks.py
+++ b/control/networks.py
@@ -21,6 +21,19 @@ from wok.control.base import Collection, Resource
from wok.control.utils import UrlSubNode
+NETWORKS_REQUESTS = {
+ 'POST': {'default': "Create %(connection)s virtual network '%(name)s'"},
+}
+
+NETWORK_REQUESTS = {
+ 'DELETE': {'default': "Remove virtual network '%(ident)s'"},
+ 'POST': {
+ 'activate': "Activate virtual network '%(ident)s'",
+ 'deactivate': "Deactivate virtual network '%(ident)s'",
+ },
+}
+
+
@UrlSubNode('networks', True)
class Networks(Collection):
def __init__(self, model):
@@ -28,6 +41,7 @@ class Networks(Collection):
self.role_key = 'network'
self.admin_methods = ['POST']
self.resource = Network
+ self.log_map = NETWORKS_REQUESTS
class Network(Resource):
@@ -39,6 +53,7 @@ class Network(Resource):
self.activate = self.generate_action_handler('activate')
self.deactivate = self.generate_action_handler('deactivate',
destructive=True)
+ self.log_map = NETWORK_REQUESTS
@property
def data(self):
diff --git a/control/storagepools.py b/control/storagepools.py
index 10b371d..aa7dbd3 100644
--- a/control/storagepools.py
+++ b/control/storagepools.py
@@ -29,6 +29,20 @@ from wok.plugins.kimchi.control.storagevolumes import StorageVolumes
from wok.plugins.kimchi.model.storagepools import ISO_POOL_NAME
+STORAGEPOOLS_REQUESTS = {
+ 'POST': {'default': "Create %(type)s storage pool '%(name)s'"},
+}
+
+STORAGEPOOL_REQUESTS = {
+ 'DELETE': {'default': "Remove storage pool '%(ident)s'"},
+ 'PUT': {'default': "Update storage pool '%(ident)s'"},
+ 'POST': {
+ 'activate': "Activate storage pool '%(ident)s'",
+ 'deactivate': "Deactivate storage pool '%(ident)s'",
+ },
+}
+
+
@UrlSubNode('storagepools', True)
class StoragePools(Collection):
def __init__(self, model):
@@ -38,6 +52,7 @@ class StoragePools(Collection):
self.resource = StoragePool
isos = IsoPool(model)
setattr(self, ISO_POOL_NAME, isos)
+ self.log_map = STORAGEPOOLS_REQUESTS
def create(self, params, *args):
try:
@@ -84,6 +99,7 @@ class StoragePool(Resource):
self.deactivate = self.generate_action_handler('deactivate',
destructive=True)
self.storagevolumes = StorageVolumes(self.model, ident)
+ self.log_map = STORAGEPOOL_REQUESTS
@property
def data(self):
diff --git a/control/storagevolumes.py b/control/storagevolumes.py
index d78eefb..a04ad35 100644
--- a/control/storagevolumes.py
+++ b/control/storagevolumes.py
@@ -22,6 +22,23 @@ from wok.control.base import AsyncCollection, Collection, Resource
from wok.control.utils import get_class_name, model_fn
+STORAGEVOLUMES_REQUESTS = {
+ 'POST': {'default': "Create storage volume '%(name)s' at pool '%(pool)s'"},
+}
+
+STORAGEVOLUME_REQUESTS = {
+ 'DELETE': {'default': "Remove storage volume '%(ident)s' from "
+ "pool '%(pool)s'"},
+ 'PUT': {'default': "Update storage volume '%(ident)s' at pool '%(pool)s'"},
+ 'POST': {
+ 'wipe': "Wipe storage volume '%(ident)s' off pool '%(pool)s'",
+ 'resize': "Resize storage volume '%(ident)s' at pool '%(pool)s' with "
+ "size %(size)s",
+ 'clone': "Clone storage volume '%(ident)s' at pool '%(pool)s'",
+ },
+}
+
+
class StorageVolumes(AsyncCollection):
def __init__(self, model, pool):
super(StorageVolumes, self).__init__(model)
@@ -29,6 +46,10 @@ class StorageVolumes(AsyncCollection):
self.pool = pool
self.resource_args = [self.pool, ]
self.model_args = [self.pool, ]
+ self.log_map = STORAGEVOLUMES_REQUESTS
+ self.log_args.update({
+ 'pool': self.pool.encode('utf-8') if self.pool else '',
+ })
def filter_data(self, resources, fields_filter):
# filter directory from storage volumes
@@ -48,6 +69,10 @@ class StorageVolume(Resource):
self.resize = self.generate_action_handler('resize', ['size'])
self.wipe = self.generate_action_handler('wipe')
self.clone = self.generate_action_handler_task('clone')
+ self.log_map = STORAGEVOLUME_REQUESTS
+ self.log_args.update({
+ 'pool': self.pool.encode('utf-8') if self.pool else '',
+ })
@property
def data(self):
diff --git a/control/templates.py b/control/templates.py
index aebac0c..343ced1 100644
--- a/control/templates.py
+++ b/control/templates.py
@@ -21,6 +21,19 @@ from wok.control.base import Collection, Resource
from wok.control.utils import UrlSubNode
+TEMPLATES_REQUESTS = {
+ 'POST': {'default': "Create template '%(name)s'"},
+}
+
+TEMPLATE_REQUESTS = {
+ 'DELETE': {'default': "Remove template '%(ident)s'"},
+ 'PUT': {'default': "Update template '%(ident)s'"},
+ 'POST': {
+ 'clone': "Clone template '%(ident)s'",
+ },
+}
+
+
@UrlSubNode('templates', True)
class Templates(Collection):
def __init__(self, model):
@@ -28,6 +41,7 @@ class Templates(Collection):
self.role_key = 'templates'
self.admin_methods = ['GET', 'POST']
self.resource = Template
+ self.log_map = TEMPLATES_REQUESTS
class Template(Resource):
@@ -37,6 +51,7 @@ class Template(Resource):
self.admin_methods = ['PUT', 'POST', 'DELETE']
self.uri_fmt = "/templates/%s"
self.clone = self.generate_action_handler('clone')
+ self.log_map = TEMPLATE_REQUESTS
@property
def data(self):
diff --git a/control/vm/hostdevs.py b/control/vm/hostdevs.py
index bae98df..8a82db0 100644
--- a/control/vm/hostdevs.py
+++ b/control/vm/hostdevs.py
@@ -21,6 +21,17 @@ from wok.control.base import Collection, Resource
from wok.control.utils import UrlSubNode
+VMHOSTDEVS_REQUESTS = {
+ 'POST': {'default': "Attach host device '%(name)s' to guest '%(vmid)s'"},
+}
+
+VMHOSTDEV_REQUESTS = {
+ 'DELETE': {
+ 'default': "Detach host device '%(ident)s' from guest '%(vmid)s'",
+ },
+}
+
+
@UrlSubNode("hostdevs")
class VMHostDevs(Collection):
def __init__(self, model, vmid):
@@ -29,6 +40,10 @@ class VMHostDevs(Collection):
self.vmid = vmid
self.resource_args = [self.vmid, ]
self.model_args = [self.vmid, ]
+ self.log_map = VMHOSTDEVS_REQUESTS
+ self.log_args.update({
+ 'vmid': self.vmid.encode('utf-8') if self.vmid else '',
+ })
class VMHostDev(Resource):
@@ -37,6 +52,10 @@ class VMHostDev(Resource):
self.vmid = vmid
self.ident = ident
self.model_args = [self.vmid, self.ident]
+ self.log_map = VMHOSTDEV_REQUESTS
+ self.log_args.update({
+ 'vmid': self.vmid.encode('utf-8') if self.vmid else '',
+ })
@property
def data(self):
diff --git a/control/vm/ifaces.py b/control/vm/ifaces.py
index d856956..9ecfc8f 100644
--- a/control/vm/ifaces.py
+++ b/control/vm/ifaces.py
@@ -21,6 +21,22 @@ from wok.control.base import Collection, Resource
from wok.control.utils import UrlSubNode
+VMIFACES_REQUESTS = {
+ 'POST': {
+ 'default': "Attach network interface '%(network)s' to guest '%(vm)s'",
+ },
+}
+
+VMIFACE_REQUESTS = {
+ 'DELETE': {
+ 'default': "Detach network interface '%(ident)s' from guest '%(vm)s'",
+ },
+ 'PUT': {
+ 'default': "Update network interface '%(ident)s' at guest '%(vm)s'",
+ },
+}
+
+
@UrlSubNode("ifaces")
class VMIfaces(Collection):
def __init__(self, model, vm):
@@ -29,6 +45,10 @@ class VMIfaces(Collection):
self.vm = vm
self.resource_args = [self.vm, ]
self.model_args = [self.vm, ]
+ self.log_map = VMIFACES_REQUESTS
+ self.log_args.update({
+ 'vm': self.vm.encode('utf-8') if self.vm else '',
+ })
class VMIface(Resource):
@@ -39,6 +59,10 @@ class VMIface(Resource):
self.info = {}
self.model_args = [self.vm, self.ident]
self.uri_fmt = '/vms/%s/ifaces/%s'
+ self.log_map = VMIFACE_REQUESTS
+ self.log_args.update({
+ 'vm': self.vm.encode('utf-8') if self.vm else '',
+ })
@property
def data(self):
diff --git a/control/vm/snapshots.py b/control/vm/snapshots.py
index b95eaa9..d8cccc1 100644
--- a/control/vm/snapshots.py
+++ b/control/vm/snapshots.py
@@ -21,6 +21,18 @@ from wok.control.base import AsyncCollection, Resource
from wok.control.utils import UrlSubNode
+VMSNAPSHOTS_REQUESTS = {
+ 'POST': {'default': "Create snapshot '%(name)s' at guest '%(vm)s'"},
+}
+
+VMSNAPSHOT_REQUESTS = {
+ 'DELETE': {'default': "Remove snapshot '%(ident)s' from guest '%(vm)s'"},
+ 'POST': {
+ 'revert': "Revert guest '%(vm)s' to snapshot '%(ident)s'",
+ },
+}
+
+
@UrlSubNode('snapshots')
class VMSnapshots(AsyncCollection):
def __init__(self, model, vm):
@@ -30,6 +42,11 @@ class VMSnapshots(AsyncCollection):
self.resource_args = [self.vm, ]
self.model_args = [self.vm, ]
self.current = CurrentVMSnapshot(model, vm)
+ self.log_map = VMSNAPSHOTS_REQUESTS
+ self.log_args.update({
+ 'vm': self.vm.encode('utf-8') if self.vm else '',
+ 'name': '',
+ })
class VMSnapshot(Resource):
@@ -40,6 +57,10 @@ class VMSnapshot(Resource):
self.model_args = [self.vm, self.ident]
self.uri_fmt = '/vms/%s/snapshots/%s'
self.revert = self.generate_action_handler('revert')
+ self.log_map = VMSNAPSHOT_REQUESTS
+ self.log_args.update({
+ 'vm': self.vm.encode('utf-8') if self.vm else '',
+ })
@property
def data(self):
diff --git a/control/vm/storages.py b/control/vm/storages.py
index 3c7d1a3..4a4c8d2 100644
--- a/control/vm/storages.py
+++ b/control/vm/storages.py
@@ -21,6 +21,18 @@ from wok.control.base import Collection, Resource
from wok.control.utils import UrlSubNode
+VMSTORAGES_REQUESTS = {
+ 'POST': {
+ 'default': "Attach %(type)s storage '%(path)s' to guest '%(vm)s'",
+ },
+}
+
+VMSTORAGE_REQUESTS = {
+ 'DELETE': {'default': "Remove storage '%(ident)s' from guest '%(vm)s'"},
+ 'PUT': {'default': "Update storage '%(ident)s' at guest '%(vm)s'"},
+}
+
+
@UrlSubNode("storages")
class VMStorages(Collection):
def __init__(self, model, vm):
@@ -29,6 +41,11 @@ class VMStorages(Collection):
self.vm = vm
self.resource_args = [self.vm, ]
self.model_args = [self.vm, ]
+ self.log_map = VMSTORAGES_REQUESTS
+ self.log_args.update({
+ 'vm': self.vm.encode('utf-8') if self.vm else '',
+ 'path': '',
+ })
class VMStorage(Resource):
@@ -39,6 +56,10 @@ class VMStorage(Resource):
self.info = {}
self.model_args = [self.vm, self.ident]
self.uri_fmt = '/vms/%s/storages/%s'
+ self.log_map = VMSTORAGE_REQUESTS
+ self.log_args.update({
+ 'vm': self.vm.encode('utf-8') if self.vm else '',
+ })
@property
def data(self):
diff --git a/control/vms.py b/control/vms.py
index 7745a18..64df00e 100644
--- a/control/vms.py
+++ b/control/vms.py
@@ -23,6 +23,30 @@ from wok.control.utils import internal_redirect, UrlSubNode
from wok.plugins.kimchi.control.vm import sub_nodes
+VMS_REQUESTS = {
+ 'POST': {
+ 'default': "Create guest '%(name)s' from template '%(template)s'",
+ },
+}
+
+VM_REQUESTS = {
+ 'DELETE': {'default': "Remove guest '%(ident)s'"},
+ 'PUT': {'default': "Edit guest '%(ident)s'"},
+ 'POST': {
+ 'start': "Start guest '%(ident)s'",
+ 'poweroff': "Power off guest '%(ident)s'",
+ 'shutdown': "Shutdown guest '%(ident)s'",
+ 'reset': "Restart guest '%(ident)s'",
+ 'connect': "Connect to guest '%(ident)s' through novnc/spice",
+ 'clone': "Clone guest '%(ident)s'",
+ 'migrate': "Migrate guest '%(ident)s' to '%(remote_host)s'",
+ 'suspend': "Suspend guest '%(ident)s'",
+ 'resume': "Resume guest '%(ident)s'",
+ 'serial': "Connect to guest '%(ident)s' through serial",
+ },
+}
+
+
@UrlSubNode('vms', True)
class VMs(AsyncCollection):
def __init__(self, model):
@@ -30,6 +54,8 @@ class VMs(AsyncCollection):
self.resource = VM
self.role_key = 'guests'
self.admin_methods = ['POST']
+ self.log_map = VMS_REQUESTS
+ self.log_args.update({'name': ''})
class VM(Resource):
@@ -56,6 +82,7 @@ class VM(Resource):
self.suspend = self.generate_action_handler('suspend')
self.resume = self.generate_action_handler('resume')
self.serial = self.generate_action_handler('serial')
+ self.log_map = VM_REQUESTS
@property
def data(self):
--
1.9.1
8 years, 8 months
[PATCH] [Wok] User Request Log backend improvements
by Lucio Correia
- Use log_args attribute to improve message quality
- Fix handling of utf8 vs str messages
Signed-off-by: Lucio Correia <luciojhc(a)linux.vnet.ibm.com>
---
src/wok/control/base.py | 59 ++++++++++++++++++++++++-------------------------
src/wok/reqlogger.py | 5 +++--
src/wok/utils.py | 23 +++++++++++++++++++
3 files changed, 55 insertions(+), 32 deletions(-)
diff --git a/src/wok/control/base.py b/src/wok/control/base.py
index 79dd22c..be2e35e 100644
--- a/src/wok/control/base.py
+++ b/src/wok/control/base.py
@@ -33,13 +33,15 @@ from wok.exception import InvalidOperation, InvalidParameter
from wok.exception import MissingParameter, NotFoundError
from wok.exception import OperationFailed, UnauthorizedError, WokException
from wok.reqlogger import RequestRecord
-from wok.utils import get_plugin_from_request
+from wok.utils import get_plugin_from_request, utf8_dict
# Default request log messages
COLLECTION_DEFAULT_LOG = "request on collection"
RESOURCE_DEFAULT_LOG = "request on resource"
+LOG_DISABLED_METHODS = ['GET']
+
class Resource(object):
"""
@@ -66,6 +68,9 @@ class Resource(object):
self.role_key = None
self.admin_methods = []
self.log_map = {}
+ self.log_args = {
+ 'ident': self.ident.encode('utf-8') if self.ident else '',
+ }
def _redirect(self, action_result, code=303):
uri_params = []
@@ -129,12 +134,10 @@ class Resource(object):
action_fn = getattr(self.model, model_fn(self, action_name))
action_result = action_fn(*model_args)
- params = {}
- if model_args:
- params = {'ident': model_args[0].encode('utf-8')}
-
+ # log request
+ reqParams = utf8_dict(self.log_args, request)
RequestRecord(
- self.getRequestMessage(method, action_name) % params,
+ self.getRequestMessage(method, action_name) % reqParams,
app=get_plugin_from_request(),
req=method,
user=cherrypy.session.get(USER_NAME, 'N/A')
@@ -175,18 +178,6 @@ class Resource(object):
fn = getattr(self.model, model_fn(self, 'delete'))
fn(*self.model_args)
cherrypy.response.status = 204
-
- method = 'DELETE'
- params = {}
- if self.model_args:
- params = {'ident': self.model_args[0].encode('utf-8')}
-
- RequestRecord(
- self.getRequestMessage(method, 'default') % params,
- app=get_plugin_from_request(),
- req=method,
- user=cherrypy.session.get(USER_NAME, 'N/A')
- ).log()
except AttributeError:
e = InvalidOperation('WOKAPI0002E', {'resource':
get_class_name(self)})
@@ -206,9 +197,9 @@ class Resource(object):
if not self.is_authorized():
raise UnauthorizedError('WOKAPI0009E')
- return {'GET': self.get,
- 'DELETE': self.delete,
- 'PUT': self.update}[method](*args, **kargs)
+ result = {'GET': self.get,
+ 'DELETE': self.delete,
+ 'PUT': self.update}[method](*args, **kargs)
except InvalidOperation, e:
raise cherrypy.HTTPError(400, e.message)
except InvalidParameter, e:
@@ -222,6 +213,17 @@ class Resource(object):
except WokException, e:
raise cherrypy.HTTPError(500, e.message)
+ # log request
+ if method not in LOG_DISABLED_METHODS:
+ RequestRecord(
+ self.getRequestMessage(method) % self.log_args,
+ app=get_plugin_from_request(),
+ req=method,
+ user=cherrypy.session.get(USER_NAME, 'N/A')
+ ).log()
+
+ return result
+
def is_authorized(self):
user_name = cherrypy.session.get(USER_NAME, '')
user_groups = cherrypy.session.get(USER_GROUPS, [])
@@ -249,14 +251,6 @@ class Resource(object):
args = list(self.model_args) + [params]
ident = update(*args)
-
- method = 'PUT'
- RequestRecord(
- self.getRequestMessage(method) % params,
- app=get_plugin_from_request(),
- req=method,
- user=cherrypy.session.get(USER_NAME, 'N/A')
- ).log()
self._redirect(ident)
self.lookup()
return self.get()
@@ -323,6 +317,7 @@ class Collection(object):
self.role_key = None
self.admin_methods = []
self.log_map = {}
+ self.log_args = {}
def create(self, params, *args):
try:
@@ -413,12 +408,16 @@ class Collection(object):
elif method == 'POST':
params = parse_request()
result = self.create(params, *args)
+
+ # log request
+ reqParams = utf8_dict(self.log_args, params)
RequestRecord(
- self.getRequestMessage(method) % params,
+ self.getRequestMessage(method) % reqParams,
app=get_plugin_from_request(),
req=method,
user=cherrypy.session.get(USER_NAME, 'N/A')
).log()
+
return result
except InvalidOperation, e:
raise cherrypy.HTTPError(400, e.message)
diff --git a/src/wok/reqlogger.py b/src/wok/reqlogger.py
index 3e79377..1294be1 100644
--- a/src/wok/reqlogger.py
+++ b/src/wok/reqlogger.py
@@ -29,7 +29,7 @@ from tempfile import NamedTemporaryFile
from wok.config import config, get_log_download_path
from wok.exception import InvalidParameter, OperationFailed
-from wok.utils import remove_old_files
+from wok.utils import ascii_dict, remove_old_files
# Log search setup
@@ -89,7 +89,8 @@ class RequestParser(object):
with fd:
for record in sortedList:
- fd.write(LOG_FORMAT % record)
+ asciiRecord = ascii_dict(record)
+ fd.write(LOG_FORMAT % asciiRecord)
fd.close()
except IOError as e:
diff --git a/src/wok/utils.py b/src/wok/utils.py
index e3a4124..7e9a928 100644
--- a/src/wok/utils.py
+++ b/src/wok/utils.py
@@ -21,6 +21,7 @@
#
import cherrypy
+import copy
import glob
import grp
import os
@@ -135,6 +136,28 @@ def get_plugin_from_request():
return 'wok'
+def ascii_dict(base, overlay=None):
+ result = copy.deepcopy(base)
+ result.update(overlay or {})
+
+ for key, value in result.iteritems():
+ if isinstance(value, unicode):
+ result[key] = str(value.decode('utf-8'))
+
+ return result
+
+
+def utf8_dict(base, overlay=None):
+ result = copy.deepcopy(base)
+ result.update(overlay or {})
+
+ for key, value in result.iteritems():
+ if isinstance(value, unicode):
+ result[key] = value.encode('utf-8')
+
+ return result
+
+
def import_class(class_path):
module_name, class_name = class_path.rsplit('.', 1)
try:
--
1.9.1
8 years, 8 months
[PATCH][Wok] Display Wok messages when requested from plugins
by Rodrigo Trujillo
When a plugin makes a request and backend fails in some Wok routine or
function, a Wok error message is returned. However, only the message
code is displayed not the message text.
This patch fixes this problem, so Wok error messages are displayed
properly.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
src/wok/exception.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/wok/exception.py b/src/wok/exception.py
index 878922a..023334b 100644
--- a/src/wok/exception.py
+++ b/src/wok/exception.py
@@ -43,10 +43,11 @@ class WokException(Exception):
# itself to a unicode string.
args[key] = unicode(value)
- if cherrypy.request.app:
+ # First, check if it is a Wok error message, then search in plugin
+ # error messages list
+ msg = _messages.get(code, code)
+ if (msg == code) and (cherrypy.request.app):
msg = self._get_translation()
- else:
- msg = _messages.get(code, code)
msg = unicode(msg, 'utf-8') % args
pattern = "%s: %s" % (code, msg)
--
2.1.0
8 years, 8 months
[PATCH v2][Kimchi] Fix minor issues in Kimchi UI: Template CPUs and Guest CPUs
by Rodrigo Trujillo
This patch apply two fixes:
- display Templates number of cores (it was missing the number)
- change "Memory Used" by "Memory Utilization"
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
ui/pages/guest.html.tmpl | 2 +-
ui/pages/tabs/guests.html.tmpl | 2 +-
ui/pages/tabs/templates.html.tmpl | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/ui/pages/guest.html.tmpl b/ui/pages/guest.html.tmpl
index be9b47e..c8f32a9 100644
--- a/ui/pages/guest.html.tmpl
+++ b/ui/pages/guest.html.tmpl
@@ -82,7 +82,7 @@
<div class="progress-bar light-grey cpu"></div>
<div class="progress-bar cpu-progress-bar"></div>
</div><!--
- --><span class="item-hidden">$_("Processors Used")</span>
+ --><span class="item-hidden">$_("Processors Utilization")</span>
</span><!--
--><span class='column-memory'>
<div class='percentage-label memory-percentage'></div>
diff --git a/ui/pages/tabs/guests.html.tmpl b/ui/pages/tabs/guests.html.tmpl
index 4d72ea6..af68d66 100644
--- a/ui/pages/tabs/guests.html.tmpl
+++ b/ui/pages/tabs/guests.html.tmpl
@@ -72,7 +72,7 @@
--><span class="column-name"><span>$_("Guest Name ID")</span></span><!--
--><span class="column-type"><span>$_("OS Type")</span></span><!--
--><span class="column-vnc"><span>$_("VNC")</span></span><!--
- --><span class="column-processors"><span>$_("Processors Used")</span></span><!--
+ --><span class="column-processors"><span>$_("Processors Utilization")</span></span><!--
--><span class="column-memory"><span>$_("Memory Utilization")</span></span><!--
--><span class="column-storage"><span>$_("Storage I/O")</span></span><!--
--><span class="column-network"><span>$_("Network I/O")</span></span><!--
diff --git a/ui/pages/tabs/templates.html.tmpl b/ui/pages/tabs/templates.html.tmpl
index d62a8c3..7e92a37 100644
--- a/ui/pages/tabs/templates.html.tmpl
+++ b/ui/pages/tabs/templates.html.tmpl
@@ -127,7 +127,7 @@
--><span class="item-hidden column-type os-type-filter">$_("OS")</span><!--
--><span class='column-version os-version-filter font-bold' val="{os_version}">{os_version}</span><!--
--><span class="item-hidden column-version os-version-filter">$_("Version")</span><!--
- --><span class='column-processors cpus-filter' val="{cpus}"><strong>{cpus}</strong> $_("cores")</span><!--
+ --><span class='column-processors cpus-filter' val="{cpu_info.vcpus}"><strong>{cpu_info.vcpus}</strong> $_("cores")</span><!--
--><span class="item-hidden column-processors cpus-filter">$_("CPUs")</span><!--
--><span class='column-memory memory-filter' val="{memory.current}"><strong>{memory.current}</strong> $_("M")</span><!--
--><span class="item-hidden column-memory memory-filter">$_("Memory")</span>
--
2.1.0
8 years, 8 months
[PATCH][Kimchi] Fix minor issues in Kimchi UI: Template CPUs and Guest CPUs
by Rodrigo Trujillo
This patch apply two fixes:
- display Templates number of cores (it was missing the number)
- change "Memory Used" by "Memory Utilization"
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
ui/pages/guest.html.tmpl | 2 +-
ui/pages/tabs/guests.html.tmpl | 2 +-
ui/pages/tabs/templates.html.tmpl | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/ui/pages/guest.html.tmpl b/ui/pages/guest.html.tmpl
index 4097a0c..15bac3e 100644
--- a/ui/pages/guest.html.tmpl
+++ b/ui/pages/guest.html.tmpl
@@ -73,7 +73,7 @@
<div class="progress-bar cpu-progress-bar"></div>
</div>
</span><!--
- --><span class="item-hidden">$_("Processors Used")</span><!--
+ --><span class="item-hidden">$_("Processors Utilization")</span><!--
--><span class='column-memory'>
<div class='percentage-label memory-percentage'></div>
<div class="progress">
diff --git a/ui/pages/tabs/guests.html.tmpl b/ui/pages/tabs/guests.html.tmpl
index 8bd815f..d1e9dc3 100644
--- a/ui/pages/tabs/guests.html.tmpl
+++ b/ui/pages/tabs/guests.html.tmpl
@@ -69,7 +69,7 @@
--><span class="column-name"><span>$_("Guest Name ID")</span></span><!--
--><span class="column-type"><span>$_("OS Type")</span></span><!--
--><span class="column-vnc"><span>$_("VNC")</span></span><!--
- --><span class="column-processors"><span>$_("Processors Used")</span></span><!--
+ --><span class="column-processors"><span>$_("Processors Utilization")</span></span><!--
--><span class="column-memory"><span>$_("Memory Utilization")</span></span><!--
--><span class="column-storage"><span>$_("Storage I/O")</span></span><!--
--><span class="column-network"><span>$_("Network I/O")</span></span><!--
diff --git a/ui/pages/tabs/templates.html.tmpl b/ui/pages/tabs/templates.html.tmpl
index d62a8c3..7e92a37 100644
--- a/ui/pages/tabs/templates.html.tmpl
+++ b/ui/pages/tabs/templates.html.tmpl
@@ -127,7 +127,7 @@
--><span class="item-hidden column-type os-type-filter">$_("OS")</span><!--
--><span class='column-version os-version-filter font-bold' val="{os_version}">{os_version}</span><!--
--><span class="item-hidden column-version os-version-filter">$_("Version")</span><!--
- --><span class='column-processors cpus-filter' val="{cpus}"><strong>{cpus}</strong> $_("cores")</span><!--
+ --><span class='column-processors cpus-filter' val="{cpu_info.vcpus}"><strong>{cpu_info.vcpus}</strong> $_("cores")</span><!--
--><span class="item-hidden column-processors cpus-filter">$_("CPUs")</span><!--
--><span class='column-memory memory-filter' val="{memory.current}"><strong>{memory.current}</strong> $_("M")</span><!--
--><span class="item-hidden column-memory memory-filter">$_("Memory")</span>
--
2.1.0
8 years, 8 months