[Kimchi-devel] [PATCH v2] Does not list non-bootable images
Ramon Medeiros
ramonn at linux.vnet.ibm.com
Fri May 29 14:13:49 UTC 2015
Also fix tests that were using non-bootable isos.
Signed-off-by: Ramon Medeiros <ramonn at linux.vnet.ibm.com>
Changes
v2:
Fix tests that were listing non-bootable isos
---
src/kimchi/model/storagevolumes.py | 2 +-
tests/test_rest.py | 16 ++++++++--------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/kimchi/model/storagevolumes.py b/src/kimchi/model/storagevolumes.py
index dc807e4..e88c2cb 100644
--- a/src/kimchi/model/storagevolumes.py
+++ b/src/kimchi/model/storagevolumes.py
@@ -530,7 +530,7 @@ class IsoVolumesModel(object):
for volume in volumes:
res = self.storagevolume.lookup(pool_name,
volume.decode("utf-8"))
- if res['format'] == 'iso':
+ if res['format'] == 'iso' and res['bootable']:
res['name'] = '%s' % volume
iso_volumes.append(res)
return iso_volumes
diff --git a/tests/test_rest.py b/tests/test_rest.py
index 914b602..9e5988b 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -61,13 +61,14 @@ def setUpModule():
# Create fake ISO to do the tests
iso_gen.construct_fake_iso(fake_iso, True, '12.04', 'ubuntu')
-
+ iso_gen.construct_fake_iso("/var/lib/libvirt/images/fedora.iso", True,
+ "17", "fedora")
def tearDownModule():
test_server.stop()
os.unlink('/tmp/obj-store-test')
os.unlink(fake_iso)
-
+ os.unlink("/var/lib/libvirt/images/fedora.iso")
class RestTests(unittest.TestCase):
def _async_op(self, cb, opaque):
@@ -926,9 +927,9 @@ class RestTests(unittest.TestCase):
storagevolume['path'])
self.assertEquals(1073741824, storagevolume['capacity']) # 1 GiB
self.assertEquals(0, storagevolume['allocation'])
- self.assertEquals('unknown', storagevolume['os_version'])
- self.assertEquals('unknown', storagevolume['os_distro'])
- self.assertEquals(False, storagevolume['bootable'])
+ self.assertEquals('17', storagevolume['os_version'])
+ self.assertEquals('fedora', storagevolume['os_distro'])
+ self.assertEquals(True, storagevolume['bootable'])
# Create a template
# In real model os distro/version can be omitted
@@ -943,8 +944,8 @@ class RestTests(unittest.TestCase):
# Verify the template
t = json.loads(self.request('/templates/test').read())
self.assertEquals('test', t['name'])
- self.assertEquals('unknown', t['os_distro'])
- self.assertEquals('unknown', t['os_version'])
+ self.assertEquals('fedora', t['os_distro'])
+ self.assertEquals('17', t['os_version'])
self.assertEquals(get_template_default('old', 'memory'), t['memory'])
# Deactivate or destroy scan pool return 405
@@ -1187,7 +1188,6 @@ class RestTests(unittest.TestCase):
resp = self.request('%s/fedora-fake' % base_uri, '{}', 'DELETE')
self.assertEquals(204, resp.status)
-
class HttpsRestTests(RestTests):
"""
Run all of the same tests as above, but use https instead
--
2.1.0
More information about the Kimchi-devel
mailing list