[PATCH 0/2] Bug fix #318 Kimchi fails creating new network v2
by Ramon Medeiros
Changes:
v2:
Fix typo
Ramon Medeiros (2):
Bug fix #318 Kimchi fails creating new network
Add one more case to network tests
src/kimchi/model/networks.py | 14 +++++++-------
tests/test_model.py | 36 ++++++++++++++++++++++++++++++++----
2 files changed, 39 insertions(+), 11 deletions(-)
--
1.8.3.1
10 years, 10 months
[PATCH] Bug fix: methods signature in storagetargets.py
by Daniel Barboza
From: Daniel Henrique Barboza <danielhb(a)linux.vnet.ibm.com>
The lack of the 'self' keyword was causing bugs when trying to
create a nfs pool.
Signed-off-by: Daniel Henrique Barboza <danielhb(a)linux.vnet.ibm.com>
---
src/kimchi/model/storagetargets.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/kimchi/model/storagetargets.py b/src/kimchi/model/storagetargets.py
index be7cdaf..01cdaf8 100644
--- a/src/kimchi/model/storagetargets.py
+++ b/src/kimchi/model/storagetargets.py
@@ -62,7 +62,7 @@ class StorageTargetsModel(object):
target_list.extend(targets)
return target_list
- def _get_storage_server_spec(**kwargs):
+ def _get_storage_server_spec(self, **kwargs):
# Required parameters:
# server:
# target_type:
@@ -73,7 +73,7 @@ class StorageTargetsModel(object):
xml = ET.tostring(obj)
return xml
- def _parse_target_source_result(target_type, xml_str):
+ def _parse_target_source_result(self, target_type, xml_str):
root = objectify.fromstring(xml_str)
ret = []
for source in root.getchildren():
--
1.8.3.1
10 years, 10 months
[PATCH] bug fix: Properly check if there running vms before rebooting system
by Aline Manera
From: Aline Manera <alinefm(a)br.ibm.com>
The user only can reboot or shutdown the host if there is no running
virtual machine.
During the model refactoring it kept using the function vms_get_list()
which does not exist in the host view.
So fix it.
Signed-off-by: Aline Manera <alinefm(a)br.ibm.com>
---
src/kimchi/model/host.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/kimchi/model/host.py b/src/kimchi/model/host.py
index fc4f386..759f13e 100644
--- a/src/kimchi/model/host.py
+++ b/src/kimchi/model/host.py
@@ -45,6 +45,7 @@ HOST_STATS_INTERVAL = 1
class HostModel(object):
def __init__(self, **kargs):
+ self.conn = kargs['conn']
self.host_info = self._get_host_info()
def _get_host_info(self):
@@ -100,9 +101,13 @@ class HostModel(object):
os.system('reboot')
def _get_vms_list_by_state(self, state):
+ conn = self.conn.get()
+ names = [dom.name().decode('utf-8') for dom in conn.listAllDomains(0)]
+
ret_list = []
- for name in self.vms_get_list():
- info = self._get_vm(name).info()
+ for name in names:
+ dom = conn.lookupByName(name.encode("utf-8"))
+ info = dom.info()
if (DOM_STATE_MAP[info[0]]) == state:
ret_list.append(name)
return ret_list
--
1.7.10.4
10 years, 10 months
[PATCH] Add software update action to Host resource
by Aline Manera
From: Aline Manera <alinefm(a)br.ibm.com>
Instead of handling the update packages action in
PackagesUpdate(Collection) move it to Host(Resource) to avoid
misunderstanding about the URI.
>From /packagesupdate/update URI the "update" can be understood as the
resource item instead of the action.
So use /host/swupdate to update the packages marked to be updated.
Signed-off-by: Aline Manera <alinefm(a)br.ibm.com>
---
docs/API.md | 9 ++-------
src/kimchi/control/host.py | 18 +++++++++---------
src/kimchi/mockmodel.py | 2 +-
src/kimchi/model/host.py | 34 ++++++++++++++++++----------------
tests/test_mockmodel.py | 2 +-
tests/test_rest.py | 2 +-
6 files changed, 32 insertions(+), 35 deletions(-)
diff --git a/docs/API.md b/docs/API.md
index 7f5e4d6..fff740d 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -709,6 +709,8 @@ Contains information of host.
Only allowed if there is not vm running.
* shutdown: Power off the host machine.
Only allowed if there is not vm running.
+* swupdate: Start the update of packages in background and return a Task resource
+ * task resource. * See Resource: Task *
### Resource: HostStats
@@ -813,13 +815,6 @@ Contains the information and action of packages update in the host.
* **GET**: Retrieves a list of all packages to be updated in the host:
-* **POST**: *See Software Update Actions*
-
-**Actions (POST):**
-
-* update: Start the update of packages in background and return a Task resource
- * task resource. * See Resource: Task *
-
### Resource: Host Package Update
**URI:** /host/packagesupdate/*:name*
diff --git a/src/kimchi/control/host.py b/src/kimchi/control/host.py
index a705f59..70b549c 100644
--- a/src/kimchi/control/host.py
+++ b/src/kimchi/control/host.py
@@ -43,6 +43,15 @@ class Host(Resource):
self.devices = Devices(self.model)
self.packagesupdate = PackagesUpdate(self.model)
+ @cherrypy.expose
+ def swupdate(self):
+ try:
+ task = self.model.host_swupdate()
+ cherrypy.response.status = 202
+ return render("Task", task)
+ except OperationFailed, e:
+ raise cherrypy.HTTPError(500, e.message)
+
@property
def data(self):
return self.info
@@ -89,15 +98,6 @@ class PackagesUpdate(Collection):
super(PackagesUpdate, self).__init__(model)
self.resource = PackageUpdate
- @cherrypy.expose
- def update(self):
- try:
- task = self.model.packagesupdate_update()
- cherrypy.response.status = 202
- return render("Task", task)
- except OperationFailed, e:
- raise cherrypy.HTTPError(500, e.message)
-
class PackageUpdate(Resource):
def __init__(self, model, id=None):
diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py
index 0c2da8a..a0e5120 100644
--- a/src/kimchi/mockmodel.py
+++ b/src/kimchi/mockmodel.py
@@ -799,7 +799,7 @@ class MockModel(object):
def packageupdate_lookup(self, pkg_name):
return self._mock_swupdate.getUpdate(pkg_name)
- def packagesupdate_update(self, args=None):
+ def host_swupdate(self, args=None):
task_id = self.add_task('', self._mock_swupdate.doUpdate, None)
return self.task_lookup(task_id)
diff --git a/src/kimchi/model/host.py b/src/kimchi/model/host.py
index ef40879..92121f6 100644
--- a/src/kimchi/model/host.py
+++ b/src/kimchi/model/host.py
@@ -67,6 +67,24 @@ class HostModel(object):
def lookup(self, *name):
return self.host_info
+ def swupdate(self, *name):
+ try:
+ swupdate = SoftwareUpdate()
+ except:
+ raise OperationFailed('KCHPKGUPD0004E')
+
+ try:
+ pkgs = swupdate.getNumOfUpdates()
+ except OperationFailed, e:
+ raise e
+
+ if pkgs == 0:
+ raise OperationFailed('KCHPKGUPD0001E')
+
+ kimchi_log.debug('Host is going to be updated.')
+ taskid = add_task('', swupdate.doUpdate, self.objstore, None)
+ return self.task.lookup(taskid)
+
def shutdown(self, args=None):
# Check for running vms before shutdown
running_vms = self._get_vms_list_by_state('running')
@@ -275,22 +293,6 @@ class PackagesUpdateModel(object):
return self.host_swupdate.getUpdates()
- def update(self, **kargs):
- if self.host_swupdate is None:
- raise OperationFailed('KCHPKGUPD0004E')
-
- try:
- pkgs = self.host_swupdate.getNumOfUpdates()
- except OperationFailed, e:
- raise e
-
- if pkgs == 0:
- raise OperationFailed('KCHPKGUPD0001E')
-
- kimchi_log.debug('Host is going to be updated.')
- taskid = add_task('', self.host_swupdate.doUpdate, self.objstore, None)
- return self.task.lookup(taskid)
-
class PackageUpdateModel(object):
def __init__(self, **kargs):
diff --git a/tests/test_mockmodel.py b/tests/test_mockmodel.py
index b985fe0..4ac08dd 100644
--- a/tests/test_mockmodel.py
+++ b/tests/test_mockmodel.py
@@ -164,6 +164,6 @@ class MockModelTests(unittest.TestCase):
self.assertIn('arch', pkgupdate.keys())
self.assertIn('version', pkgupdate.keys())
- task = model.packagesupdate_update()
+ task = model.host_swupdate()
task_params = [u'id', u'message', u'status', u'target_uri']
self.assertEquals(sorted(task_params), sorted(task.keys()))
diff --git a/tests/test_rest.py b/tests/test_rest.py
index 5aac211..26078d6 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -1467,7 +1467,7 @@ class RestTests(unittest.TestCase):
self.assertIn('arch', info.keys())
self.assertIn('version', info.keys())
- resp = self.request('/host/packagesupdate/update', '{}', 'POST')
+ resp = self.request('/host/swupdate', '{}', 'POST')
task = json.loads(resp.read())
task_params = [u'id', u'message', u'status', u'target_uri']
self.assertEquals(sorted(task_params), sorted(task.keys()))
--
1.7.10.4
10 years, 10 months
[PATCH V3] Add software update action to Host resource
by Aline Manera
From: Aline Manera <alinefm(a)br.ibm.com>
V2 - V3:
- Remove useless try/except block
V1 - V2:
- Make sure it is a POST method while updating system packages
Aline Manera (1):
Add software update action to Host resource
docs/API.md | 9 ++-------
src/kimchi/control/host.py | 21 +++++++++++----------
src/kimchi/mockmodel.py | 2 +-
src/kimchi/model/host.py | 30 ++++++++++++++----------------
tests/test_mockmodel.py | 2 +-
tests/test_rest.py | 2 +-
6 files changed, 30 insertions(+), 36 deletions(-)
--
1.7.10.4
10 years, 10 months
[RFC][PATCH] Implement integrity verification: verify template integrity
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
Sometimes, user creat a template, but networks, cdrom, disks or
storagepool will change later.
So users can not create a vm from this template successfully.
It is necessary to check some paramenters of template.
This patch will check the follow paramenters of template.
networks: check networks exists.
cdrom: check cdrom is available.
disks: check the volume is available.
This patch does not check the storagepool exists. waiting for royce's
disks patch.
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
docs/API.md | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/docs/API.md b/docs/API.md
index 7f5e4d6..c9874fe 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -249,6 +249,10 @@ A interface represents available network interface on VM.
Independent Computing Environments
* null: Graphics is disabled or type not supported
* listen: The network which the vnc/spice server listens on.
+ * invalids: A dict indicates which paramenters of this template are invalid.
+ * networks *(optional)*: A list of invalid networks name.
+ * cdrom *(optional)*: A dict with "True" value.
+ * disks *(optional)*: A list of invalid volumes names.
* **DELETE**: Remove the Template
* **POST**: *See Template Actions*
--
1.8.4.2
10 years, 10 months
[PATCH 1/2] Remove unused vms reference in VMModel
by lvroyce@linux.vnet.ibm.com
From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
VMModel has unused vms reference, remove it.
Signed-off-by: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
---
src/kimchi/model/vms.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/kimchi/model/vms.py b/src/kimchi/model/vms.py
index 2585082..b482e80 100644
--- a/src/kimchi/model/vms.py
+++ b/src/kimchi/model/vms.py
@@ -236,7 +236,6 @@ class VMModel(object):
def __init__(self, **kargs):
self.conn = kargs['conn']
self.objstore = kargs['objstore']
- self.vms = VMsModel(**kargs)
self.vmscreenshot = VMScreenshotModel(**kargs)
def update(self, name, params):
--
1.8.1.2
10 years, 10 months
[PATCH] Fix encode and decode in storagevolumes.py
by lvroyce@linux.vnet.ibm.com
From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
Storage volume list return value and lookup parameter is not properly
encode and decode, fix it.
Signed-off-by: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
src/kimchi/model/storagevolumes.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/kimchi/model/storagevolumes.py b/src/kimchi/model/storagevolumes.py
index e3f00ca..20c65b9 100644
--- a/src/kimchi/model/storagevolumes.py
+++ b/src/kimchi/model/storagevolumes.py
@@ -79,7 +79,7 @@ class StorageVolumesModel(object):
raise InvalidOperation("KCHVOL0006E", {'pool': pool_name})
try:
pool.refresh(0)
- return pool.listVolumes()
+ return sorted(map(lambda x: x.decode('utf-8'), pool.listVolumes()))
except libvirt.libvirtError as e:
raise OperationFailed("KCHVOL0008E",
{'pool': pool_name,
@@ -95,7 +95,7 @@ class StorageVolumeModel(object):
if not pool.isActive():
raise InvalidOperation("KCHVOL0006E", {'name': pool})
try:
- return pool.storageVolLookupByName(name)
+ return pool.storageVolLookupByName(name.encode("utf-8"))
except libvirt.libvirtError as e:
if e.get_error_code() == libvirt.VIR_ERR_NO_STORAGE_VOL:
raise NotFoundError("KCHVOL0002E", {'name': name,
--
1.8.1.2
10 years, 10 months
[PATCH] ui: Add tooltip when hovering long names
by Crístian Viana
If the storage pool or network names are very long strings, they are
trimmed (e.g. "myverylongnetworkname" becomes something like "myverylo...").
If multiple names have the same prefixes, the user will not be able to
distinguish them.
Add tooltips displaying the full names when hovering storage pool and
network names.
Signed-off-by: Crístian Viana <vianac(a)linux.vnet.ibm.com>
---
ui/pages/tabs/network.html.tmpl | 2 +-
ui/pages/tabs/storage.html.tmpl | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/ui/pages/tabs/network.html.tmpl b/ui/pages/tabs/network.html.tmpl
index 81c1566..83c1d7e 100644
--- a/ui/pages/tabs/network.html.tmpl
+++ b/ui/pages/tabs/network.html.tmpl
@@ -87,7 +87,7 @@
</div>
<script id="networkItem" type="text/html">
<div id='{name}' class='item'>
- <span class='column column-name cell'>{name}</span><!--
+ <span class='column column-name cell' title="{name}">{name}</span><!--
--><span class='column column-state cell'><span class='network-state {state}'></span></span><!--
--><span class='column column-type cell'>{type}</span><!--
--><span class='column column-interface cell'>{interface}</span><!--
diff --git a/ui/pages/tabs/storage.html.tmpl b/ui/pages/tabs/storage.html.tmpl
index b38eb63..6930c22 100644
--- a/ui/pages/tabs/storage.html.tmpl
+++ b/ui/pages/tabs/storage.html.tmpl
@@ -48,7 +48,7 @@
<li id="{name}">
<div class="storage-li in" data-name="{name}" data-stat="{state}">
<div class="storage-name">
- <span class="storage-title">{name}</span>
+ <span class="storage-title" title="{name}">{name}</span>
<span class="storage-title usage">{usage}%</span>
</div>
<div class="storage-state">
--
1.8.5.3
10 years, 10 months