[Kimchi-devel] [PATCH] Fix issue #340: Show error message when server fails to list host partitions

Aline Manera alinefm at linux.vnet.ibm.com
Fri Aug 8 19:14:25 UTC 2014


Add error handlers to kimchi.listHostPartitions() to properly display
error message when an error occurs while trying to list host partitions.
Also update .po files as a new message was added.

Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
---
 po/en_US.po                              | 47 +++++++++++++++++++++---------
 po/kimchi.pot                            | 33 ++++++++++++++-------
 po/pt_BR.po                              | 49 +++++++++++++++++++++++---------
 po/zh_CN.po                              | 45 +++++++++++++++++++++--------
 ui/js/src/kimchi.storage_main.js         |  4 +++
 ui/js/src/kimchi.storagepool_add_main.js |  3 ++
 ui/pages/i18n.json.tmpl                  |  1 +
 7 files changed, 132 insertions(+), 50 deletions(-)

diff --git a/po/en_US.po b/po/en_US.po
index f85d982..a34da3a 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-07-29 15:52-0300\n"
+"POT-Creation-Date: 2014-08-08 15:27-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"
@@ -136,6 +136,16 @@ msgstr ""
 "'%(user)s' to the ISO path group, or (not recommended) 'chmod -R o+x "
 "'path_to_iso'.Details: %(err)s"
 
+msgid "Error occurs when probing image os information."
+msgstr ""
+
+msgid "No OS information found in given image."
+msgstr ""
+
+#, python-format
+msgid "Unable to find/read image file %(filename)s"
+msgstr ""
+
 #, python-format
 msgid "Virtual machine %(name)s already exists"
 msgstr "Virtual machine %(name)s already exists"
@@ -337,8 +347,8 @@ msgstr "Template CDROM must be a local or remote ISO file"
 msgid "Invalid storage pool URI %(value)s specified for template"
 msgstr "Invalid storage pool URI %(value)s specified for template"
 
-msgid "Specify an ISO image as CDROM to create a template"
-msgstr "Specify an ISO image as CDROM to create a template"
+msgid "Specify an ISO image as CDROM or a base image to create a template"
+msgstr ""
 
 msgid "All networks for the template must be specified in a list."
 msgstr "All networks for the template must be specified in a list."
@@ -362,6 +372,13 @@ msgstr "Unable to delete template due error: %(err)s"
 msgid "Disk size must be greater than 1GB."
 msgstr "Disk size must be greater than 1GB."
 
+msgid "Template base image must be a valid local image file"
+msgstr ""
+
+#, python-format
+msgid "Cannot identify base image %(path)s format"
+msgstr ""
+
 #, python-format
 msgid "Storage pool %(name)s already exists"
 msgstr "Storage pool %(name)s already exists"
@@ -791,10 +808,6 @@ msgstr "The path '%(value)s' is not valid local/remote path for the device"
 msgid "Device name %(dev_name)s already exists in vm %(vm_name)s"
 msgstr "Device name %(dev_name)s already exists in vm %(vm_name)s"
 
-msgid "Invalid target device bus type, type supported: 'ide', 'scsi', 'virtio'"
-msgstr ""
-"Invalid target device bus type, type supported: 'ide', 'scsi', 'virtio'"
-
 msgid "Just support cdrom path update"
 msgstr "Just support cdrom path update"
 
@@ -1102,9 +1115,6 @@ msgstr "Device Type"
 msgid "The device type. Currently,  \"cdrom\" and \"disk\" are supported."
 msgstr "The device type. Currently,  \"cdrom\" and \"disk\" are supported."
 
-msgid "Device Bus"
-msgstr "Device Bus"
-
 msgid "Storage Pool"
 msgstr "Storage Pool"
 
@@ -1276,9 +1286,6 @@ msgstr "Add"
 msgid "Remove"
 msgstr "Remove"
 
-msgid "Failed."
-msgstr "Failed."
-
 msgid "Enable"
 msgstr "Enable"
 
@@ -1489,6 +1496,9 @@ msgstr ""
 "This storage pool is not persistent. Instead of deactivate, this action will "
 "permanently delete it. Would you like to continue?"
 
+msgid "Unable to retrieve partitions information."
+msgstr ""
+
 msgid "CDROM path need to be a valid local path and cannot be blank."
 msgstr "CDROM path need to be a valid local path and cannot be blank."
 
@@ -1843,3 +1853,14 @@ msgstr "No templates found."
 
 msgid "Clone"
 msgstr "Clone"
+
+#~ msgid ""
+#~ "Invalid target device bus type, type supported: 'ide', 'scsi', 'virtio'"
+#~ msgstr ""
+#~ "Invalid target device bus type, type supported: 'ide', 'scsi', 'virtio'"
+
+#~ msgid "Device Bus"
+#~ msgstr "Device Bus"
+
+#~ msgid "Failed."
+#~ msgstr "Failed."
diff --git a/po/kimchi.pot b/po/kimchi.pot
index e869e3a..d8354fa 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-07-29 15:52-0300\n"
+"POT-Creation-Date: 2014-08-08 15:27-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"
@@ -130,6 +130,16 @@ msgid ""
 "'path_to_iso'.Details: %(err)s"
 msgstr ""
 
+msgid "Error occurs when probing image os information."
+msgstr ""
+
+msgid "No OS information found in given image."
+msgstr ""
+
+#, python-format
+msgid "Unable to find/read image file %(filename)s"
+msgstr ""
+
 #, python-format
 msgid "Virtual machine %(name)s already exists"
 msgstr ""
@@ -324,7 +334,7 @@ msgstr ""
 msgid "Invalid storage pool URI %(value)s specified for template"
 msgstr ""
 
-msgid "Specify an ISO image as CDROM to create a template"
+msgid "Specify an ISO image as CDROM or a base image to create a template"
 msgstr ""
 
 msgid "All networks for the template must be specified in a list."
@@ -348,6 +358,13 @@ msgstr ""
 msgid "Disk size must be greater than 1GB."
 msgstr ""
 
+msgid "Template base image must be a valid local image file"
+msgstr ""
+
+#, python-format
+msgid "Cannot identify base image %(path)s format"
+msgstr ""
+
 #, python-format
 msgid "Storage pool %(name)s already exists"
 msgstr ""
@@ -744,9 +761,6 @@ msgstr ""
 msgid "Device name %(dev_name)s already exists in vm %(vm_name)s"
 msgstr ""
 
-msgid "Invalid target device bus type, type supported: 'ide', 'scsi', 'virtio'"
-msgstr ""
-
 msgid "Just support cdrom path update"
 msgstr ""
 
@@ -1041,9 +1055,6 @@ msgstr ""
 msgid "The device type. Currently,  \"cdrom\" and \"disk\" are supported."
 msgstr ""
 
-msgid "Device Bus"
-msgstr ""
-
 msgid "Storage Pool"
 msgstr ""
 
@@ -1209,9 +1220,6 @@ msgstr ""
 msgid "Remove"
 msgstr ""
 
-msgid "Failed."
-msgstr ""
-
 msgid "Enable"
 msgstr ""
 
@@ -1401,6 +1409,9 @@ msgid ""
 "permanently delete it. Would you like to continue?"
 msgstr ""
 
+msgid "Unable to retrieve partitions information."
+msgstr ""
+
 msgid "CDROM path need to be a valid local path and cannot be blank."
 msgstr ""
 
diff --git a/po/pt_BR.po b/po/pt_BR.po
index b38ff3f..452e778 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-07-29 15:52-0300\n"
+"POT-Creation-Date: 2014-08-08 15:27-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"
@@ -156,6 +156,16 @@ msgstr ""
 "do caminho da ISO, ou (não recomendado) 'chmod -R o+x 'caminho_para_iso'. "
 "Detalhes: %(err)s"
 
+msgid "Error occurs when probing image os information."
+msgstr ""
+
+msgid "No OS information found in given image."
+msgstr ""
+
+#, python-format
+msgid "Unable to find/read image file %(filename)s"
+msgstr ""
+
 #, python-format
 msgid "Virtual machine %(name)s already exists"
 msgstr "Máquina virtual %(name)s já existe"
@@ -367,8 +377,8 @@ msgstr "Modelo do CDROM deve ser um arquivo ISO local ou remoto"
 msgid "Invalid storage pool URI %(value)s specified for template"
 msgstr "Storage pool URI inválido %(value)s especificado para modelo"
 
-msgid "Specify an ISO image as CDROM to create a template"
-msgstr "Especifique uma imagem ISO como CDROM para criar o modelo"
+msgid "Specify an ISO image as CDROM or a base image to create a template"
+msgstr ""
 
 msgid "All networks for the template must be specified in a list."
 msgstr "Todas redes para o modelo devem ser especificadas em lista"
@@ -393,6 +403,13 @@ msgstr "Não foi possível remover o modelo devido a um erro: %(err)s"
 msgid "Disk size must be greater than 1GB."
 msgstr "Tamanho do disco deve ser maior do que 1GB"
 
+msgid "Template base image must be a valid local image file"
+msgstr ""
+
+#, python-format
+msgid "Cannot identify base image %(path)s format"
+msgstr ""
+
 #, python-format
 msgid "Storage pool %(name)s already exists"
 msgstr "Storage pool %(name)s já existe"
@@ -842,11 +859,6 @@ msgid "Device name %(dev_name)s already exists in vm %(vm_name)s"
 msgstr ""
 "Nome do dispositivo %(dev_name)s já existe na máquina virtual %(vm_name)s"
 
-msgid "Invalid target device bus type, type supported: 'ide', 'scsi', 'virtio'"
-msgstr ""
-"Tipo de barramento do dispositivo de destino inválido, tipos suportados: "
-"'ide', 'scsi', 'virtio'"
-
 msgid "Just support cdrom path update"
 msgstr "Apenas a atualização do caminho do CDROM é suportada"
 
@@ -1164,9 +1176,6 @@ msgid "The device type. Currently,  \"cdrom\" and \"disk\" are supported."
 msgstr ""
 "O tipo do dispositivo. Atualmente, \"cdrom\" e \"disco\" são suportados."
 
-msgid "Device Bus"
-msgstr "Barramento do dispositivo"
-
 msgid "Storage Pool"
 msgstr "Nome do Storage Pool"
 
@@ -1340,9 +1349,6 @@ msgstr "Adicionar"
 msgid "Remove"
 msgstr "Remover"
 
-msgid "Failed."
-msgstr "Falhou."
-
 msgid "Enable"
 msgstr "Ativar"
 
@@ -1552,6 +1558,9 @@ msgstr ""
 "O storage pool não é persistente. Ao invés de desativar, essa ação vai "
 "removê-lo permanentemente. Deseja continuar?"
 
+msgid "Unable to retrieve partitions information."
+msgstr ""
+
 msgid "CDROM path need to be a valid local path and cannot be blank."
 msgstr ""
 "Caminho do CDROM precisa ser um caminho local válido e não pode ser vazio."
@@ -1907,3 +1916,15 @@ msgstr "Nenhum modelo encontrado."
 
 msgid "Clone"
 msgstr "Clonar"
+
+#~ msgid ""
+#~ "Invalid target device bus type, type supported: 'ide', 'scsi', 'virtio'"
+#~ msgstr ""
+#~ "Tipo de barramento do dispositivo de destino inválido, tipos suportados: "
+#~ "'ide', 'scsi', 'virtio'"
+
+#~ msgid "Device Bus"
+#~ msgstr "Barramento do dispositivo"
+
+#~ msgid "Failed."
+#~ msgstr "Falhou."
diff --git a/po/zh_CN.po b/po/zh_CN.po
index aa3032a..83c7018 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-07-29 15:52-0300\n"
+"POT-Creation-Date: 2014-08-08 15:27-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"
@@ -149,6 +149,16 @@ msgstr ""
 "录下;或为'%(user)s'用户设置访问权限;或将'%(user)s'用户增加到ISO路径的属组;"
 "或者为所有的用户增加访问权限 'chmod -R o+x '(不推荐)。详情:%(err)s"
 
+msgid "Error occurs when probing image os information."
+msgstr ""
+
+msgid "No OS information found in given image."
+msgstr ""
+
+#, python-format
+msgid "Unable to find/read image file %(filename)s"
+msgstr ""
+
 #, python-format
 msgid "Virtual machine %(name)s already exists"
 msgstr "虚拟机%(name)s已经存在"
@@ -344,8 +354,8 @@ msgstr "模板的CDROM必须是一个本地或者远程的ISO文件"
 msgid "Invalid storage pool URI %(value)s specified for template"
 msgstr "给模板指定了无效的存储池URI %(value)s"
 
-msgid "Specify an ISO image as CDROM to create a template"
-msgstr "为新模版的CDROM指定一个ISO的镜像"
+msgid "Specify an ISO image as CDROM or a base image to create a template"
+msgstr ""
 
 msgid "All networks for the template must be specified in a list."
 msgstr "为模板指定的网络必须在一个列表中"
@@ -368,6 +378,13 @@ msgstr "由于错误:%(err)s,未能删除模板"
 msgid "Disk size must be greater than 1GB."
 msgstr "磁盘大小必须大于1GB。"
 
+msgid "Template base image must be a valid local image file"
+msgstr ""
+
+#, python-format
+msgid "Cannot identify base image %(path)s format"
+msgstr ""
+
 #, python-format
 msgid "Storage pool %(name)s already exists"
 msgstr "存储池%(name)s已经存在"
@@ -764,9 +781,6 @@ msgstr "设备路径'%(value)s'不是一个有效的本地/远程路径"
 msgid "Device name %(dev_name)s already exists in vm %(vm_name)s"
 msgstr "设备%(dev_name)s在vm%(vm_name)s上已存在"
 
-msgid "Invalid target device bus type, type supported: 'ide', 'scsi', 'virtio'"
-msgstr "无效的目标设备总线类型。支持类型为:'ide','scsi','virtio'"
-
 msgid "Just support cdrom path update"
 msgstr "仅支持cdrom路径更新"
 
@@ -1061,9 +1075,6 @@ msgstr "设备类型"
 msgid "The device type. Currently,  \"cdrom\" and \"disk\" are supported."
 msgstr "设备类型。目前支持设备类型:\"cdrom\"和\"disk\"。 "
 
-msgid "Device Bus"
-msgstr "设备总线"
-
 msgid "Storage Pool"
 msgstr "存储池"
 
@@ -1230,9 +1241,6 @@ msgstr "增加"
 msgid "Remove"
 msgstr "删除"
 
-msgid "Failed."
-msgstr "失败"
-
 msgid "Enable"
 msgstr "使能"
 
@@ -1424,6 +1432,9 @@ msgid ""
 "permanently delete it. Would you like to continue?"
 msgstr "对于非持久存储池,这个操作将会永久删除存储池而不是停用。是否继续?"
 
+msgid "Unable to retrieve partitions information."
+msgstr ""
+
 msgid "CDROM path need to be a valid local path and cannot be blank."
 msgstr "CDROM的路径必须是有效本地路径且不能为空"
 
@@ -1773,3 +1784,13 @@ msgstr "没有发现模板"
 
 msgid "Clone"
 msgstr "制作副本"
+
+#~ msgid ""
+#~ "Invalid target device bus type, type supported: 'ide', 'scsi', 'virtio'"
+#~ msgstr "无效的目标设备总线类型。支持类型为:'ide','scsi','virtio'"
+
+#~ msgid "Device Bus"
+#~ msgstr "设备总线"
+
+#~ msgid "Failed."
+#~ msgstr "失败"
diff --git a/ui/js/src/kimchi.storage_main.js b/ui/js/src/kimchi.storage_main.js
index 0ebdd59..ae3f963 100644
--- a/ui/js/src/kimchi.storage_main.js
+++ b/ui/js/src/kimchi.storage_main.js
@@ -223,6 +223,10 @@ kimchi.initLogicalPoolExtend = function() {
                     $('.host-partition').html(i18n['KCHPOOL6011M']);
                     $('.host-partition').addClass('text-help');
                 }
+            }, function(err) {
+                $('#loading-info', '#logicalPoolExtend').addClass('hidden');
+                $('.host-partition').html(i18n['KCHPOOL6013M'] + '<br/>(' + err.responseJSON.reason + ')');
+                $('.host-partition').addClass('text-help');
             });
         },
         beforeClose : function() { $('.host-partition', '#logicalPoolExtend').empty(); },
diff --git a/ui/js/src/kimchi.storagepool_add_main.js b/ui/js/src/kimchi.storagepool_add_main.js
index 629a37b..ecbc682 100644
--- a/ui/js/src/kimchi.storagepool_add_main.js
+++ b/ui/js/src/kimchi.storagepool_add_main.js
@@ -50,6 +50,9 @@ kimchi.initStorageAddPage = function() {
             $('.host-partition').html(i18n['KCHPOOL6011M']);
             $('.host-partition').addClass('text-help');
         }
+    }, function(err) {
+        $('.host-partition').html(i18n['KCHPOOL6013M'] + '<br/>(' + err.responseJSON.reason + ')');
+        $('.host-partition').addClass('text-help');
     });
 
     kimchi.getHostPCIDevices(function(data){
diff --git a/ui/pages/i18n.json.tmpl b/ui/pages/i18n.json.tmpl
index f1478a7..697f946 100644
--- a/ui/pages/i18n.json.tmpl
+++ b/ui/pages/i18n.json.tmpl
@@ -162,6 +162,7 @@
     "KCHPOOL6010M": "$_("Looking for available partitions ...")",
     "KCHPOOL6011M": "$_("No available partitions found.")",
     "KCHPOOL6012M": "$_("This storage pool is not persistent. Instead of deactivate, this action will permanently delete it. Would you like to continue?")",
+    "KCHPOOL6013M": "$_("Unable to retrieve partitions information.")",
 
     "KCHVMSTOR0001E": "$_("CDROM path need to be a valid local path and cannot be blank.")",
     "KCHVMSTOR0002E": "$_("Disk pool or volume cannot be blank.")"
-- 
1.9.3




More information about the Kimchi-devel mailing list