[PATCH] Increase memory size for vm template on ppc platform
by Mark Wu
The minimum memory size required by graphics installer is 1280. So
to allow user install vm in graphics, this patch increases it to
1280.
Signed-off-by: Mark Wu <wudxw(a)linux.vnet.ibm.com>
---
src/kimchi/osinfo.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/kimchi/osinfo.py b/src/kimchi/osinfo.py
index a50daae..106cc0e 100644
--- a/src/kimchi/osinfo.py
+++ b/src/kimchi/osinfo.py
@@ -42,11 +42,12 @@ template_specs = {'x86': {'old': dict(common_spec, disk_bus='ide',
sound_model= 'ich6')},
'power': {'old': dict(common_spec, disk_bus='scsi',
nic_model='spapr-vlan', cdrom_bus='scsi',
- kbd_bus='usb', mouse_bus='usb'),
+ kbd_bus='usb', mouse_bus='usb',
+ memory=1280),
'modern': dict(common_spec, disk_bus='virtio',
nic_model='virtio',
cdrom_bus='scsi', kbd_bus='usb',
- mouse_bus='usb')}}
+ mouse_bus='usb', memory=1280)}}
modern_version_bases = {'x86': {'debian': '6.0', 'ubuntu': '7.10',
--
1.8.4.2
10 years, 9 months
[PATCH 1/3] Fix issue #339: Enable backend to handle not persistent pools
by Rodrigo Trujillo
This patch changes the error message when storage pool is not found and
adds the isPersistent checkings, in order to return correctly from
deactivate function.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
src/kimchi/control/storagepools.py | 3 ++-
src/kimchi/model/storagepools.py | 11 +++++++++--
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/kimchi/control/storagepools.py b/src/kimchi/control/storagepools.py
index 62f9525..b75bca0 100644
--- a/src/kimchi/control/storagepools.py
+++ b/src/kimchi/control/storagepools.py
@@ -90,7 +90,8 @@ class StoragePool(Resource):
'source': self.info['source'],
'type': self.info['type'],
'nr_volumes': self.info['nr_volumes'],
- 'autostart': self.info['autostart']}
+ 'autostart': self.info['autostart'],
+ 'persistent': self.info['persistent']}
val = self.info.get('task_id')
if val:
diff --git a/src/kimchi/model/storagepools.py b/src/kimchi/model/storagepools.py
index fe70fa1..fea19f6 100644
--- a/src/kimchi/model/storagepools.py
+++ b/src/kimchi/model/storagepools.py
@@ -175,7 +175,7 @@ class StoragePoolModel(object):
return conn.storagePoolLookupByName(name.encode("utf-8"))
except libvirt.libvirtError as e:
if e.get_error_code() == libvirt.VIR_ERR_NO_STORAGE_POOL:
- raise NotFoundError("KCHTMPL0002E", {'name': name})
+ raise NotFoundError("KCHPOOL0002E", {'name': name})
else:
raise
@@ -229,6 +229,7 @@ class StoragePoolModel(object):
pool = self.get_storagepool(name, self.conn)
info = pool.info()
autostart = True if pool.autostart() else False
+ persistent = True if pool.isPersistent() else False
xml = pool.XMLDesc(0)
path = xmlutils.xpath_get_text(xml, "/pool/target/path")[0]
pool_type = xmlutils.xpath_get_text(xml, "/pool/@type")[0]
@@ -254,7 +255,8 @@ class StoragePoolModel(object):
'capacity': info[1],
'allocated': info[2],
'available': info[3],
- 'nr_volumes': nr_volumes}
+ 'nr_volumes': nr_volumes,
+ 'persistent': persistent}
if not pool.isPersistent():
# Deal with deep scan generated pool
@@ -354,10 +356,15 @@ class StoragePoolModel(object):
{'name': name, 'server': source['addr']})
return
try:
+ persistent = pool.isPersistent()
pool.destroy()
except libvirt.libvirtError as e:
raise OperationFailed("KCHPOOL0010E",
{'name': name, 'err': e.get_error_message()})
+ # If pool was not persistent, then it was erased by destroy() and
+ # must return nothing here, to trigger _redirect() and avoid errors
+ if not persistent:
+ return ""
def delete(self, name):
if self._pool_used_by_template(name):
--
1.8.5.3
10 years, 9 months
[PATCH] Fix rollback order
by Rodrigo Trujillo
This patch changes the order of two rollback calls, avoiding the chance of
tests left a test file or a test vm in the system.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
tests/test_model.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/test_model.py b/tests/test_model.py
index f849039..1fa40fa 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -179,10 +179,10 @@ class ModelTests(unittest.TestCase):
iso_path = '/tmp/existent.iso'
iso_path2 = '/tmp/existent2.iso'
open(iso_path, 'w').close()
- open(iso_path2, 'w').close()
- wrong_iso_path = '/nonexistent.iso'
rollback.prependDefer(os.remove, iso_path)
+ open(iso_path2, 'w').close()
rollback.prependDefer(os.remove, iso_path2)
+ wrong_iso_path = '/nonexistent.iso'
# Create a cdrom
cdrom_args = {"type": "cdrom",
@@ -546,9 +546,9 @@ class ModelTests(unittest.TestCase):
params_1 = {'name': 'kimchi-vm1', 'template': '/templates/test'}
params_2 = {'name': 'kimchi-vm2', 'template': '/templates/test'}
inst.vms_create(params_1)
- inst.vms_create(params_2)
rollback.prependDefer(self._rollback_wrapper, inst.vm_delete,
'kimchi-vm1')
+ inst.vms_create(params_2)
rollback.prependDefer(self._rollback_wrapper, inst.vm_delete,
'kimchi-vm2')
--
1.8.5.3
10 years, 9 months
[PATCH] bug fix: Set default flags for virDomain.state() function
by Aline Manera
From: Aline Manera <alinefm(a)br.ibm.com>
Some libvirt versions do not set the default value for flags, so we need to
explicity set it.
libvirt.virDomain.state = state(self, flags) unbound libvirt.virDomain method
Otherwise, the following error will be raised
[06/Mar/2014:23:40:05] HTTP Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 656, in respond
response.body = self.handler()
File "/usr/lib/python2.7/dist-packages/cherrypy/lib/encoding.py", line 188, in __call__
self.body = self.oldhandler(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/cherrypy/_cpdispatch.py", line 34, in __call__
return self.callable(*self.args, **self.kwargs)
File "/home/alinefm/kimchi/src/kimchi/control/base.py", line 71, in wrapper
ident = fn(*model_args)
File "/home/alinefm/kimchi/src/kimchi/model/networks.py", line 214, in deactivate
if self._get_vms_attach_to_a_network(name, "running"):
File "/home/alinefm/kimchi/src/kimchi/model/networks.py", line 199, in _get_vms_attach_to_a_network
state == dom.state()[0]):
File "/home/alinefm/kimchi/src/kimchi/model/libvirtconnection.py", line 62, in wrapper
ret = f(*args, **kwargs)
TypeError: state() takes exactly 2 arguments (1 given)
Signed-off-by: Aline Manera <alinefm(a)br.ibm.com>
---
src/kimchi/model/networks.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/kimchi/model/networks.py b/src/kimchi/model/networks.py
index f032875..0d6ccec 100644
--- a/src/kimchi/model/networks.py
+++ b/src/kimchi/model/networks.py
@@ -196,7 +196,7 @@ class NetworkModel(object):
for dom in conn.listAllDomains(0):
networks = self._vm_get_networks(dom)
if network in networks and (state is None or
- state == dom.state()[0]):
+ state == dom.state(0)[0]):
vms.append(dom.name())
return vms
--
1.7.10.4
10 years, 9 months
[PATCH] Issue #222: add python-xml to suse require list
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
check on suse
xml.etree module is from python-xml on suse.
need to add python-xml to require list
This is different from fedora distro.
xml.etree module is from python standlib python-libs on fedora
issue:
https://github.com/kimchi-project/kimchi/issues/222
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
contrib/kimchi.spec.suse.in | 1 +
docs/README.md | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/contrib/kimchi.spec.suse.in b/contrib/kimchi.spec.suse.in
index 99b4fea..beddada 100644
--- a/contrib/kimchi.spec.suse.in
+++ b/contrib/kimchi.spec.suse.in
@@ -21,6 +21,7 @@ Requires: python-jsonschema >= 1.3.0
Requires: python-ethtool
Requires: python-ipaddr
Requires: python-lxml
+Requires: python-xml
Requires: nfs-client
Requires: open-iscsi
BuildRequires: libxslt-tools
diff --git a/docs/README.md b/docs/README.md
index fcf53c5..5721878 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -89,7 +89,7 @@ for more information on how to configure your system to access this repository.
python-pam python-M2Crypto python-jsonschema \
rpm-build kvm python-psutil python-ethtool \
python-ipaddr python-lxml nfs-client open-iscsi \
- libxslt-tools
+ libxslt-tools python-xml
Packages version requirement:
python-psutil >= 0.6.0
--
1.8.4.2
10 years, 9 months
[PATCH v2] storage volume: fix xml parsing of logical volume format type
by zhshzhou@linux.vnet.ibm.com
From: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
Not all types of libvirt storage volume provide format information.
Particularly, the volume in logical pool doesn't have format information
in the dumped XML description. StorageVolumeModel.lookup assumes there
is a format tag, but for logical pool volumes it does not exist. So an
exception is raised when it lookup a logical volume.
To trigger this problem, firstly create a guest using a logical pool. Then
click the logical pool from the "storage" tab, and it would fail to list
the volumes.
This patch catches the exception when parsing the format tag, and
returns an 'raw' for the format attribute if there is no available format
information in the XML.
v2
Return 'raw' instead of return empty string, because the only supported
volume format of a logical pool is 'raw'.
Signed-off-by: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
---
src/kimchi/model/storagevolumes.py | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/kimchi/model/storagevolumes.py b/src/kimchi/model/storagevolumes.py
index 442ff89..6811e15 100644
--- a/src/kimchi/model/storagevolumes.py
+++ b/src/kimchi/model/storagevolumes.py
@@ -113,7 +113,14 @@ class StorageVolumeModel(object):
path = vol.path()
info = vol.info()
xml = vol.XMLDesc(0)
- fmt = xmlutils.xpath_get_text(xml, "/volume/target/format/@type")[0]
+ try:
+ fmt = xmlutils.xpath_get_text(
+ xml, "/volume/target/format/@type")[0]
+ except IndexError:
+ # Not all types of libvirt storage can provide volume format
+ # infomation. When there is no format information, we assume
+ # it's 'raw'.
+ fmt = 'raw'
res = dict(type=VOLUME_TYPE_MAP[info[0]],
capacity=info[1],
allocation=info[2],
--
1.8.5.3
10 years, 9 months
[PATCH] issue #330: Make sure exception argument is a string to convert it to unicode
by Aline Manera
From: Aline Manera <alinefm(a)br.ibm.com>
The unicode() operation is only available for strings.
So make sure the exception argument is a string before converting it to
unicode.
Signed-off-by: Aline Manera <alinefm(a)br.ibm.com>
---
src/kimchi/exception.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/kimchi/exception.py b/src/kimchi/exception.py
index 71a4d11..74134be 100644
--- a/src/kimchi/exception.py
+++ b/src/kimchi/exception.py
@@ -51,7 +51,7 @@ class KimchiException(Exception):
for key, value in args.iteritems():
if not isinstance(value, unicode):
- args[key] = unicode(value, 'utf-8')
+ args[key] = unicode(str(value), 'utf-8')
return unicode(translation.gettext(text), 'utf-8') % args
--
1.7.10.4
10 years, 9 months
[PATCH] issue #312: Check volume group exists while creating a logical pool
by Aline Manera
From: Aline Manera <alinefm(a)br.ibm.com>
When creating a logical storage pool, a volume group is created with the same
name.
And when deleting the storage pool the volume group keeps on the system. Which
is the correct behavior as the storage pool is only a concept and deleting it
should not affect the file system.
To avoid problems while creating a pool with an existent volume group name,
verify if a volume group exists with the given pool name and if so, warn the
user about it.
Also convert an error message parameter to string instead of virStoragePool
instance and update the po files as new messages were added.
Signed-off-by: Aline Manera <alinefm(a)br.ibm.com>
Signed-off-by: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
---
po/en_US.po | 12 +++++++++++-
po/kimchi.pot | 12 +++++++++++-
po/pt_BR.po | 12 +++++++++++-
po/zh_CN.po | 12 +++++++++++-
src/kimchi/i18n.py | 2 +-
src/kimchi/model/storagepools.py | 19 ++++++++++++++++++-
6 files changed, 63 insertions(+), 6 deletions(-)
diff --git a/po/en_US.po b/po/en_US.po
index d9df56d..23881da 100644
--- a/po/en_US.po
+++ b/po/en_US.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: kimchi 0.1\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-03-03 17:18-0300\n"
+"POT-Creation-Date: 2014-03-05 17:45-0300\n"
"PO-Revision-Date: 2013-07-11 17:32-0400\n"
"Last-Translator: Crístian Viana <vianac(a)linux.vnet.ibm.com>\n"
"Language-Team: English\n"
@@ -985,6 +985,12 @@ msgid "Unable to delete pool %(name)s as it is associated with some templates"
msgstr ""
#, python-format
+msgid ""
+"A volume group named '%(name)s' already exists. Please, choose another name "
+"to create the logical pool."
+msgstr ""
+
+#, python-format
msgid "Storage volume %(name)s already exists"
msgstr ""
@@ -1037,6 +1043,10 @@ msgid "Unable to resize storage volume %(name)s. Details: %(err)s"
msgstr ""
#, python-format
+msgid "Storage type %(type)s does not support volume create and delete"
+msgstr ""
+
+#, python-format
msgid "Interface %(name)s does not exist"
msgstr ""
diff --git a/po/kimchi.pot b/po/kimchi.pot
index df89712..06236d2 100755
--- a/po/kimchi.pot
+++ b/po/kimchi.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-03-03 17:18-0300\n"
+"POT-Creation-Date: 2014-03-05 17:45-0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL(a)li.org>\n"
@@ -972,6 +972,12 @@ msgid "Unable to delete pool %(name)s as it is associated with some templates"
msgstr ""
#, python-format
+msgid ""
+"A volume group named '%(name)s' already exists. Please, choose another name "
+"to create the logical pool."
+msgstr ""
+
+#, python-format
msgid "Storage volume %(name)s already exists"
msgstr ""
@@ -1024,6 +1030,10 @@ msgid "Unable to resize storage volume %(name)s. Details: %(err)s"
msgstr ""
#, python-format
+msgid "Storage type %(type)s does not support volume create and delete"
+msgstr ""
+
+#, python-format
msgid "Interface %(name)s does not exist"
msgstr ""
diff --git a/po/pt_BR.po b/po/pt_BR.po
index f00edd8..06db056 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: kimchi 1.0\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-03-03 17:18-0300\n"
+"POT-Creation-Date: 2014-03-05 17:45-0300\n"
"PO-Revision-Date: 2013-06-27 10:48+0000\n"
"Last-Translator: Crístian Viana <vianac(a)linux.vnet.ibm.com>\n"
"Language-Team: Aline Manera <alinefm(a)br.ibm.com>\n"
@@ -1000,6 +1000,12 @@ msgid "Unable to delete pool %(name)s as it is associated with some templates"
msgstr ""
#, python-format
+msgid ""
+"A volume group named '%(name)s' already exists. Please, choose another name "
+"to create the logical pool."
+msgstr ""
+
+#, python-format
msgid "Storage volume %(name)s already exists"
msgstr ""
@@ -1052,6 +1058,10 @@ msgid "Unable to resize storage volume %(name)s. Details: %(err)s"
msgstr ""
#, python-format
+msgid "Storage type %(type)s does not support volume create and delete"
+msgstr ""
+
+#, python-format
msgid "Interface %(name)s does not exist"
msgstr ""
diff --git a/po/zh_CN.po b/po/zh_CN.po
index 366c6bf..38a3c6c 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: kimchi 0.1\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-03-03 17:18-0300\n"
+"POT-Creation-Date: 2014-03-05 17:45-0300\n"
"PO-Revision-Date: 2013-06-27 10:48+0000\n"
"Last-Translator: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>\n"
"Language-Team: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>\n"
@@ -990,6 +990,12 @@ msgid "Unable to delete pool %(name)s as it is associated with some templates"
msgstr ""
#, python-format
+msgid ""
+"A volume group named '%(name)s' already exists. Please, choose another name "
+"to create the logical pool."
+msgstr ""
+
+#, python-format
msgid "Storage volume %(name)s already exists"
msgstr ""
@@ -1042,6 +1048,10 @@ msgid "Unable to resize storage volume %(name)s. Details: %(err)s"
msgstr ""
#, python-format
+msgid "Storage type %(type)s does not support volume create and delete"
+msgstr ""
+
+#, python-format
msgid "Interface %(name)s does not exist"
msgstr ""
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index 36785e6..cbfcf5d 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -138,7 +138,7 @@ messages = {
"KCHPOOL0033E": _("Unable to deactivate NFS storage pool %(name)s. NFS server %(server)s is unreachable."),
"KCHPOOL0034E": _("Unable to deactivate pool %(name)s as it is associated with some templates"),
"KCHPOOL0035E": _("Unable to delete pool %(name)s as it is associated with some templates"),
-
+ "KCHPOOL0036E": _("A volume group named '%(name)s' already exists. Please, choose another name to create the logical pool."),
"KCHVOL0001E": _("Storage volume %(name)s already exists"),
"KCHVOL0002E": _("Storage volume %(name)s does not exist in storage pool %(pool)s"),
diff --git a/src/kimchi/model/storagepools.py b/src/kimchi/model/storagepools.py
index 8edf62e..3ae62cf 100644
--- a/src/kimchi/model/storagepools.py
+++ b/src/kimchi/model/storagepools.py
@@ -71,6 +71,22 @@ class StoragePoolsModel(object):
if name == ISO_POOL_NAME:
raise InvalidOperation("KCHPOOL0031E")
+ # The user may want to create a logical pool with the same name
+ # used before but a volume group will already exist with this name
+ # So check the volume group does not exist to create the pool
+ if params['type'] == 'logical':
+ vgdisplay_cmd = ['vgdisplay', name]
+ output, error, returncode = run_command(vgdisplay_cmd)
+ # From vgdisplay error codes:
+ # 1 error reading VGDA
+ # 2 volume group doesn't exist
+ # 3 not all physical volumes of volume group online
+ # 4 volume group not found
+ # 5 no volume groups found at all
+ # 6 error reading VGDA from lvmtab
+ if returncode not in [2, 4, 5]:
+ raise InvalidOperation("KCHPOOL0036E", {'name': name})
+
if params['type'] == 'kimchi-iso':
task_id = self._do_deep_scan(params)
@@ -172,7 +188,8 @@ class StoragePoolModel(object):
return 0
except libvirt.libvirtError as e:
raise OperationFailed("KCHPOOL0008E",
- {'name': pool, 'err': e.get_error_message()})
+ {'name': pool.name(),
+ 'err': e.get_error_message()})
def _get_storage_source(self, pool_type, pool_xml):
source = {}
--
1.7.10.4
10 years, 9 months
[PATCH] issue #330: Properly log the error message when login fails
by Aline Manera
From: Aline Manera <alinefm(a)br.ibm.com>
The error message and all its parameters must be string.
So convert error code to string in order to accomplish it.
Signed-off-by: Aline Manera <alinefm(a)br.ibm.com>
---
src/kimchi/auth.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/kimchi/auth.py b/src/kimchi/auth.py
index af3b610..b16f2db 100644
--- a/src/kimchi/auth.py
+++ b/src/kimchi/auth.py
@@ -107,7 +107,7 @@ def authenticate(username, password, service="passwd"):
try:
auth.authenticate()
except PAM.error, (resp, code):
- msg_args = {'userid': username, 'code': code}
+ msg_args = {'userid': username, 'code': str(code)}
raise OperationFailed("KCHAUTH0001E", msg_args)
return True
--
1.7.10.4
10 years, 9 months
[PATCH] Refreshing an inactive pool causes exception
by Shu Ming
When an update request to extend a inactive storagepool is
finished sucessfully, an exception will be raised complaining
the pool is inactive. The exception response to the clinet is
quite misleading for a successful request.
---
src/kimchi/model/storagepools.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/kimchi/model/storagepools.py b/src/kimchi/model/storagepools.py
index 8edf62e..b666209 100644
--- a/src/kimchi/model/storagepools.py
+++ b/src/kimchi/model/storagepools.py
@@ -272,7 +272,8 @@ class StoragePoolModel(object):
'err': error})
# refreshing pool state
pool = self.get_storagepool(pool_name, self.conn)
- pool.refresh(0)
+ if pool.isActive():
+ pool.refresh(0)
def update(self, name, params):
pool = self.get_storagepool(name, self.conn)
--
1.8.1.4
10 years, 9 months