[Kimchi-devel] [PATCH 2/2] Display appropriate warning for Power Off of non-persistent VM

Aline Manera alinefm at linux.vnet.ibm.com
Thu Aug 21 14:44:30 UTC 2014


On 08/20/2014 07:43 PM, Christy Perez wrote:
> Add a check in the UI to check the new 'persistent' flag for a VM.
> If the VM is non-persistent, report the danger of using Power Off.
> If the VM is not, warn that data may be lost (the current warning).

We provide to user 2 options to shutdown the VM: shutdown and power off.
 From my understating, in both cases the VM will be deleted if it is not 
persistent. So we need to handle both.


> Signed-off-by: Christy Perez <christy at linux.vnet.ibm.com>
> ---
>   po/en_US.po                    | 3 +++
>   po/pt_BR.po                    | 3 +++
>   po/zh_CN.po                    | 3 +++
>   ui/js/src/kimchi.guest_main.js | 6 +++++-
>   ui/pages/i18n.json.tmpl        | 1 +
>   5 files changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/po/en_US.po b/po/en_US.po
> index a34da3a..387c748 100644
> --- a/po/en_US.po
> +++ b/po/en_US.po
> @@ -1371,6 +1371,9 @@ msgstr ""
>   "This action may produce undesirable results, for example unflushed disk "
>   "cache in the guest. Would you like to continue?"
>   
> +msgid "This VM is not persistent. Power Off will destroy it. Continue?"
> +msgstr "This VM is not persistent. Power Off will destroy it. Continue?"
> +

... Power Off will delete it, Do you want to continue?

(I think "delete" is more human being than "destroy" hehe)

>   msgid "Reset Confirmation"
>   msgstr "Reset Confirmation"
>   
> diff --git a/po/pt_BR.po b/po/pt_BR.po
> index 452e778..f5b7958 100644
> --- a/po/pt_BR.po
> +++ b/po/pt_BR.po
> @@ -1434,6 +1434,9 @@ msgstr ""
>   "Essa ação pode produzir resultados não desejáveis, como por exemplo cache de "
>   "disco não atualizado no guest. Deseja continuar?"
>   
> +msgid "This VM is not persistent. Power Off will destroy it. Continue?"
> +msgstr "This VM is not persistent. Power Off will destroy it. Continue?"

A máquina virtual não é persistente. Desligá-la irá removê-la. Deseja 
continuar?

> +
>   msgid "Reset Confirmation"
>   msgstr "Confirmação de reinicialização"
>   
> diff --git a/po/zh_CN.po b/po/zh_CN.po
> index 83c7018..5b6ed6e 100644
> --- a/po/zh_CN.po
> +++ b/po/zh_CN.po
> @@ -1318,6 +1318,9 @@ msgid ""
>   "cache in the guest. Would you like to continue?"
>   msgstr "这样做可能导致不良后果,比如客户机磁盘缓存未刷新,确认要继续吗?"
>   
> +msgid "This VM is not persistent. Power Off will destroy it. Continue?"
> +msgstr "This VM is not persistent. Power Off will destroy it. Continue?"
> +
>   msgid "Reset Confirmation"
>   msgstr "重置确认"
>   
> diff --git a/ui/js/src/kimchi.guest_main.js b/ui/js/src/kimchi.guest_main.js
> index ff6f2e1..ff66744 100644
> --- a/ui/js/src/kimchi.guest_main.js
> +++ b/ui/js/src/kimchi.guest_main.js
> @@ -43,9 +43,13 @@ kimchi.vmpoweroff = function(event) {
>           button.addClass('loading');
>           var vm=button.closest('li[name=guest]');
>           var vm_id=vm.attr("id");
> +        var vmObject=vm.data();
> +        var vm_persistent=vmObject.persistent == true;
> +        var content_msg = vm_persistent ? i18n['KCHVM6003M'] :
> +            i18n['KCHVM6009M'];
>           var settings = {
>               title : i18n['KCHVM6002M'],
> -            content : i18n['KCHVM6003M'],
> +            content : content_msg,
>               confirm : i18n['KCHAPI6002M'],
>               cancel : i18n['KCHAPI6003M']
>           };
> diff --git a/ui/pages/i18n.json.tmpl b/ui/pages/i18n.json.tmpl
> index ccfb081..aa41bf0 100644
> --- a/ui/pages/i18n.json.tmpl
> +++ b/ui/pages/i18n.json.tmpl
> @@ -126,6 +126,7 @@
>       "KCHVM6006M": "$_("Shut Down Confirmation")",
>       "KCHVM6007M": "$_("Note the guest OS may ignore this request. Would you like to continue?")",
>       "KCHVM6008M": "$_("VM Delete Confirmation")",
> +    "KCHVM6009M": "$_("This VM is not persistent. Power Off will destroy it. Continue?")",
>   
>       "KCHVMCD6001M": "$_("This CDROM will be detached permanently and you can re-attach it. Continue to detach it?")",
>       "KCHVMCD6002M": "$_("Attach")",




More information about the Kimchi-devel mailing list