[Kimchi-devel] [PATCH] issue #312: Check volume group exists while creating a logical pool

Aline Manera alinefm at linux.vnet.ibm.com
Fri Mar 7 01:15:02 UTC 2014


On 03/06/2014 04:33 AM, Royce Lv wrote:
> Reviewed-by: Royce Lv<lvroyce at linux.vnet.ibm.com>
>
> When I go through the patch, I notice we don't support a scenario:
>
>     Instead of constructing some PV to VG, import an existent VG and 
> make it a storage pool,
> this is a common scenario when we want to move a LVM from one host to 
> another.
>     libvirt steps:
>     http://ailoo.net/2011/02/use-a-lvm-volume-group-with-libvirt/
>

Yes, Royce!
I've already noticed it.
I added it to the backlog so we can address it for next release.
Thanks

> On 2014年03月06日 05:04, Aline Manera wrote:
>> From: Aline Manera <alinefm at 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 at br.ibm.com>
>> Signed-off-by: Royce Lv <lvroyce at 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 at 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 at ADDRESS>\n"
>>   "Language-Team: LANGUAGE <LL at 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 at linux.vnet.ibm.com>\n"
>>   "Language-Team: Aline Manera <alinefm at 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 at linux.vnet.ibm.com>\n"
>>   "Language-Team: ShaoHe Feng <shaohef at 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 = {}
>




More information about the Kimchi-devel mailing list