[PATCH V2 0/2] Allow admin user change settings when VM is running

Changes: V1 -> V2: 1) Have the "ui/css/theme-default/guest-media.css" deleted 2) Have the "edit" button in interface tab deleted when VM is running 1) Have the "Manage Media" function deleted from "Action" list 2) Enable "Edit" whether VM is running or off 3) Disable edit function of "General", "Storage", "Interface" except "replace" of the cdrom under "Storage". Wen Wang (2): UI: Delete Manage Media function from action list Allow admin user change permission settings when VM is running ui/css/theme-default/guest-media.css | 42 ------------------------- ui/js/src/kimchi.guest_edit_main.js | 56 ++++++++++++++++++++++----------- ui/js/src/kimchi.guest_main.js | 14 -------- ui/pages/guest-edit.html.tmpl | 2 +- ui/pages/guest-media.html.tmpl | 57 ---------------------------------- ui/pages/guest.html.tmpl | 1 - 6 files changed, 39 insertions(+), 133 deletions(-) delete mode 100644 ui/css/theme-default/guest-media.css delete mode 100644 ui/pages/guest-media.html.tmpl

V1 -> V2: Have the "ui/css/theme-default/guest-media.css" deleted Have the "Manage Media" function deleted from "Action" list Signed-off-by: Wen Wang <wenwang@linux.vnet.ibm.com> --- ui/css/theme-default/guest-media.css | 42 ------------------------- ui/js/src/kimchi.guest_main.js | 13 -------- ui/pages/guest-media.html.tmpl | 57 ---------------------------------- ui/pages/guest.html.tmpl | 1 - 4 files changed, 0 insertions(+), 113 deletions(-) delete mode 100644 ui/css/theme-default/guest-media.css delete mode 100644 ui/pages/guest-media.html.tmpl diff --git a/ui/css/theme-default/guest-media.css b/ui/css/theme-default/guest-media.css deleted file mode 100644 index 29b1893..0000000 --- a/ui/css/theme-default/guest-media.css +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Project Kimchi - * - * Copyright IBM, Corp. 2014 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#guest-media-window { - font-size: 14px; - height: 320px; - width: 570px; -} - -#form-guest-media { - padding: 1em; -} - -#guest-media-window .guest-media-fieldset { - padding-right: 0; -} - -#form-guest-media .guest-edit-wrapper-label { - width: 30px; -} - -#form-guest-media .guest-edit-wrapper-controls { - width: 480px; -} - -#form-guest-media .guest-edit-cdrom-row-container input[type="text"] { - width: 437px; -} diff --git a/ui/js/src/kimchi.guest_main.js b/ui/js/src/kimchi.guest_main.js index ff6f2e1..320847e 100644 --- a/ui/js/src/kimchi.guest_main.js +++ b/ui/js/src/kimchi.guest_main.js @@ -123,18 +123,6 @@ kimchi.vmdelete = function(event) { }); }; -kimchi.vmmedia = function(event) { - var vm = $(this).closest('li[name=guest]'); - var vm_id = vm.attr('id'); - kimchi.selectedGuest = vm_id; - kimchi.window.open({ - url: 'guest-media.html', - close: function() { - kimchi.clearGuestMedia(); - } - }); -}; - kimchi.vmedit = function(event) { var vm = $(this).closest('li[name=guest]'); var vm_id=vm.attr("id"); @@ -293,7 +281,6 @@ kimchi.createGuestLi = function(vmObject, prevScreenImage, openMenu) { if (vmRunningBool) { //If the guest is not running, do not enable shutdown guestActions.find("[name=vm-shutdown]").on({click : kimchi.vmshutdown}); } - guestActions.find("[name=vm-media]").on({click : kimchi.vmmedia}); guestActions.find("[name=vm-edit]").on({click : kimchi.vmedit}); guestActions.find("[name=vm-delete]").on({click : kimchi.vmdelete}); diff --git a/ui/pages/guest-media.html.tmpl b/ui/pages/guest-media.html.tmpl deleted file mode 100644 index 5435f52..0000000 --- a/ui/pages/guest-media.html.tmpl +++ /dev/null @@ -1,57 +0,0 @@ -#* - * Project Kimchi - * - * Copyright IBM, Corp. 2014 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *# -#unicode UTF-8 -#import gettext -#silent t = gettext.translation($lang.domain, $lang.localedir, languages=$lang.lang) -#silent _ = t.gettext -#silent _t = t.gettext - -<div id="guest-media-window" class="window"> - <header> - <h1 class="title">$_("Manage Media")</h1> - <div class="close">X</div> - </header> - <div class="content"> - <form id="form-guest-media"> - <fieldset - id="guest-edit-cdrom-row-container" - class="guest-edit-fieldset guest-edit-cdrom-row-container"> - </fieldset> - </form> - </div> -</div> -<script id="cdrom-row-tmpl" type="text/html"> - <div> - <div class="guest-edit-wrapper-label"> - <label for="cdrom-{dev}">{dev}</label> - </div> - <div class="guest-edit-wrapper-controls"> - <input id="cdrom-{dev}" name="cdrom" type="text" - data-vm="{vm}" data-dev="{dev}" - value="{path}" readonly="readonly" /> - <button class="guest-edit-cdrom-button replace" - data-vm="{vm}" data-dev="{dev}" - title="$_("Replace")"> - </button> - </div> - </div> -</script> - -<script type="text/javascript"> - kimchi.guest_media_main(); -</script> diff --git a/ui/pages/guest.html.tmpl b/ui/pages/guest.html.tmpl index d67ef3e..43fb350 100644 --- a/ui/pages/guest.html.tmpl +++ b/ui/pages/guest.html.tmpl @@ -56,7 +56,6 @@ <span class="text">$_("Actions")</span><span class="arrow"></span> <div class="popover actionsheet right-side" style="width: 250px"> <button class="button-big shutoff-disabled" name="vm-console" ><span class="text">$_("Connect")</span></button> - <button class="button-big shutoff-disabled" name="vm-media"><span class="text">$_("Manage Media")</span></button> <button class="button-big running-disabled" name="vm-edit"><span class="text">$_("Edit")</span></button> <button class="button-big shutoff-hidden" name="vm-reset"><span class="text">$_("Reset")</span></button> <button class="button-big shutoff-hidden" name="vm-shutdown"><span class="text">$_("Shut Down")</span></button> -- 1.7.1

V1 -> V2: Have the "edit" button in interface tab deleted when VM is running Functions changed: 1) Enable "Edit" whether VM is running or off 2) Disable edit function of "General", "Storage", "Interface" except "replace" of the cdrom under "Storage". Signed-off-by: Wen Wang <wenwang@linux.vnet.ibm.com> --- ui/js/src/kimchi.guest_edit_main.js | 56 +++++++++++++++++++++++----------- ui/js/src/kimchi.guest_main.js | 1 - ui/pages/guest-edit.html.tmpl | 2 +- 3 files changed, 39 insertions(+), 20 deletions(-) diff --git a/ui/js/src/kimchi.guest_edit_main.js b/ui/js/src/kimchi.guest_edit_main.js index 01d8045..fdd7944 100644 --- a/ui/js/src/kimchi.guest_edit_main.js +++ b/ui/js/src/kimchi.guest_edit_main.js @@ -19,7 +19,12 @@ kimchi.guest_edit_main = function() { var buttonContainer = $('#action-button-container'); $('#guest-edit-tabs').tabs({ beforeActivate: function(event, ui) { - var display_list = ['form-guest-edit-general', 'form-guest-edit-permission'] + var display_list = null; + if(kimchi.thisVMState === "running") { + display_list = ['form-guest-edit-permission']; + } else { + display_list = ['form-guest-edit-general', 'form-guest-edit-permission']; + } $(buttonContainer).addClass('hidden'); var deactivated = ui['newPanel']; if(display_list.indexOf($(deactivated).attr('id')) >= 0) { @@ -52,12 +57,17 @@ kimchi.guest_edit_main = function() { text: false }); - $('.detach', container).button({ - icons: { - primary: 'ui-icon-trash' - }, - text: false - }); + if(kimchi.thisVMState != "running") { + $('.detach', container).button({ + icons: { + primary: 'ui-icon-trash' + }, + text: false + }); + + } else { + $('.detach', container).remove(); + } $('.save', container).button({ icons: { @@ -170,6 +180,10 @@ kimchi.guest_edit_main = function() { var itemNode = $.parseHTML(kimchi.substitute($('#interface-tmpl').html(),data)); $(".body", "#form-guest-edit-interface").append(itemNode); $("select", itemNode).append(networkOptions); + if(kimchi.thisVMState === "running") { + $("#form-guest-edit-interface .delete").remove(); + $("#form-guest-edit-interface .edit").remove(); + } if(data.network!==""){ $("select", itemNode).val(data.network); } @@ -340,18 +354,25 @@ kimchi.guest_edit_main = function() { var initContent = function(guest) { guest['icon'] = guest['icon'] || 'images/icon-vm.png'; $('#form-guest-edit-general').fillWithObject(guest); + kimchi.thisVMState = guest['state']; refreshCDROMs(); - - $('#guest-edit-attach-cdrom-button').button({ - icons: { - primary: "ui-icon-plusthick" - }, - text: false - }).click(function(event) { - event.preventDefault(); - kimchi.window.open("guest-storage-add.html"); - }); + if(kimchi.thisVMState === "running") { + $("#form-guest-edit-general input").prop("disabled", "disabled"); + $("#guest-edit-attach-cdrom-button").remove(); + $("#form-guest-edit-interface .header button").remove(); + } else { + $('#guest-edit-attach-cdrom-button').button({ + icons: { + primary: "ui-icon-plusthick" + }, + text: false + }).click(function(event) { + event.preventDefault(); + kimchi.window.open("guest-storage-add.html"); + }); + $("#action-button-container").removeClass("hidden"); + } var onAttached = function(params) { refreshCDROMs(); @@ -364,7 +385,6 @@ kimchi.guest_edit_main = function() { }; initStorageListeners(); - setupInterface(); setupPermission(); diff --git a/ui/js/src/kimchi.guest_main.js b/ui/js/src/kimchi.guest_main.js index 320847e..5cbdb40 100644 --- a/ui/js/src/kimchi.guest_main.js +++ b/ui/js/src/kimchi.guest_main.js @@ -253,7 +253,6 @@ kimchi.createGuestLi = function(vmObject, prevScreenImage, openMenu) { //Setup the VM Actions var guestActions=result.find("div[name=guest-actions]"); guestActions.find(".shutoff-disabled").prop('disabled', !vmRunningBool ); - guestActions.find(".running-disabled").prop('disabled', vmRunningBool ); if (vmRunningBool) { guestActions.find(".running-hidden").hide(); diff --git a/ui/pages/guest-edit.html.tmpl b/ui/pages/guest-edit.html.tmpl index ed7ddeb..47615be 100644 --- a/ui/pages/guest-edit.html.tmpl +++ b/ui/pages/guest-edit.html.tmpl @@ -145,7 +145,7 @@ </div> </div> <footer> - <div id="action-button-container" class="btn-group"> + <div id="action-button-container" class="btn-group hidden"> <button id="guest-edit-button-save" class="btn-normal"> <span class="text">$_("Save")</span> </button> -- 1.7.1

Hi Aline, "Manage Media" under "Edit" -> "Storage" does not work well. There are two issues that are related to the back-end: 1) Edit cdrom media fail when VM is running, error are presented below: |{ || "reason":"KCHVMSTOR0009E: Error while updating storage device: internal error unable to execute QEMU|| command 'change': Could not open '/home/wangwen/Downloads/CentOS-7.0-1406-x86_64-DVD.iso': Permission|| denied", || "code":"500 Internal Server Error" ||}| 2) Cannot change media to location except for /var/lib/libvirt/, which means the iso file only work under that directory, otherwise kimchi will popup error as below: |{ || "reason":"KCHVM0019E: Unable to start virtual machine 2c057a8e-f521-4076-9a49-5e8bca8ca113-vm-1. Details||: internal error process exited while connecting to monitor: qemu-kvm: -drive file=/home/wangwen/Downloads||/CentOS-7.0-1406-x86_64-DVD.iso,if=none,media=cdrom,id=drive-ide0-1-0,readonly=on, format=raw: could not|| open disk image /home/wangwen/Downloads/CentOS-7.0-1406-x86_64-DVD.iso: Permission denied\n", || "code":"500 Internal Server Error" ||} Could you please take a look at this? Best Regards Wang Wen| On 8/22/2014 2:11 PM, Wen Wang wrote:
Changes: V1 -> V2: 1) Have the "ui/css/theme-default/guest-media.css" deleted 2) Have the "edit" button in interface tab deleted when VM is running
1) Have the "Manage Media" function deleted from "Action" list 2) Enable "Edit" whether VM is running or off 3) Disable edit function of "General", "Storage", "Interface" except "replace" of the cdrom under "Storage".
Wen Wang (2): UI: Delete Manage Media function from action list Allow admin user change permission settings when VM is running
ui/css/theme-default/guest-media.css | 42 ------------------------- ui/js/src/kimchi.guest_edit_main.js | 56 ++++++++++++++++++++++----------- ui/js/src/kimchi.guest_main.js | 14 -------- ui/pages/guest-edit.html.tmpl | 2 +- ui/pages/guest-media.html.tmpl | 57 ---------------------------------- ui/pages/guest.html.tmpl | 1 - 6 files changed, 39 insertions(+), 133 deletions(-) delete mode 100644 ui/css/theme-default/guest-media.css delete mode 100644 ui/pages/guest-media.html.tmpl

On 08/22/2014 05:02 AM, Wen Wang wrote:
Hi Aline,
"Manage Media" under "Edit" -> "Storage" does not work well. There are two issues that are related to the back-end:
1) Edit cdrom media fail when VM is running, error are presented below: |{ || "reason":"KCHVMSTOR0009E: Error while updating storage device: internal error unable to execute QEMU|| command 'change': Could not open '/home/wangwen/Downloads/CentOS-7.0-1406-x86_64-DVD.iso': Permission|| denied", || "code":"500 Internal Server Error" ||}|
2) Cannot change media to location except for /var/lib/libvirt/, which means the iso file only work under that directory, otherwise kimchi will popup error as below: |{ || "reason":"KCHVM0019E: Unable to start virtual machine 2c057a8e-f521-4076-9a49-5e8bca8ca113-vm-1. Details||: internal error process exited while connecting to monitor: qemu-kvm: -drive file=/home/wangwen/Downloads||/CentOS-7.0-1406-x86_64-DVD.iso,if=none,media=cdrom,id=drive-ide0-1-0,readonly=on, format=raw: could not|| open disk image /home/wangwen/Downloads/CentOS-7.0-1406-x86_64-DVD.iso: Permission denied\n", || "code":"500 Internal Server Error" ||}
Could you please take a look at this?|
Thanks for reporting it, Wen Wang! Those are known-issues and related to the backend code. I will check it and provide a patch soon.
|
Best Regards Wang Wen|
On 8/22/2014 2:11 PM, Wen Wang wrote:
Changes: V1 -> V2: 1) Have the "ui/css/theme-default/guest-media.css" deleted 2) Have the "edit" button in interface tab deleted when VM is running
1) Have the "Manage Media" function deleted from "Action" list 2) Enable "Edit" whether VM is running or off 3) Disable edit function of "General", "Storage", "Interface" except "replace" of the cdrom under "Storage".
Wen Wang (2): UI: Delete Manage Media function from action list Allow admin user change permission settings when VM is running
ui/css/theme-default/guest-media.css | 42 ------------------------- ui/js/src/kimchi.guest_edit_main.js | 56 ++++++++++++++++++++++----------- ui/js/src/kimchi.guest_main.js | 14 -------- ui/pages/guest-edit.html.tmpl | 2 +- ui/pages/guest-media.html.tmpl | 57 ---------------------------------- ui/pages/guest.html.tmpl | 1 - 6 files changed, 39 insertions(+), 133 deletions(-) delete mode 100644 ui/css/theme-default/guest-media.css delete mode 100644 ui/pages/guest-media.html.tmpl

On 8/22/2014 10:00 PM, Aline Manera wrote:
On 08/22/2014 05:02 AM, Wen Wang wrote:
Hi Aline,
"Manage Media" under "Edit" -> "Storage" does not work well. There are two issues that are related to the back-end:
1) Edit cdrom media fail when VM is running, error are presented below: |{ || "reason":"KCHVMSTOR0009E: Error while updating storage device: internal error unable to execute QEMU|| command 'change': Could not open '/home/wangwen/Downloads/CentOS-7.0-1406-x86_64-DVD.iso': Permission|| denied", || "code":"500 Internal Server Error" ||}|
2) Cannot change media to location except for /var/lib/libvirt/, which means the iso file only work under that directory, otherwise kimchi will popup error as below: |{ || "reason":"KCHVM0019E: Unable to start virtual machine 2c057a8e-f521-4076-9a49-5e8bca8ca113-vm-1. Details||: internal error process exited while connecting to monitor: qemu-kvm: -drive file=/home/wangwen/Downloads||/CentOS-7.0-1406-x86_64-DVD.iso,if=none,media=cdrom,id=drive-ide0-1-0,readonly=on, format=raw: could not|| open disk image /home/wangwen/Downloads/CentOS-7.0-1406-x86_64-DVD.iso: Permission denied\n", || "code":"500 Internal Server Error" ||}
Could you please take a look at this?|
Thanks for reporting it, Wen Wang!
Those are known-issues and related to the backend code. I will check it and provide a patch soon.
Thanks Aline, really appreciated.
|
Best Regards Wang Wen|
On 8/22/2014 2:11 PM, Wen Wang wrote:
Changes: V1 -> V2: 1) Have the "ui/css/theme-default/guest-media.css" deleted 2) Have the "edit" button in interface tab deleted when VM is running
1) Have the "Manage Media" function deleted from "Action" list 2) Enable "Edit" whether VM is running or off 3) Disable edit function of "General", "Storage", "Interface" except "replace" of the cdrom under "Storage".
Wen Wang (2): UI: Delete Manage Media function from action list Allow admin user change permission settings when VM is running
ui/css/theme-default/guest-media.css | 42 ------------------------- ui/js/src/kimchi.guest_edit_main.js | 56 ++++++++++++++++++++++----------- ui/js/src/kimchi.guest_main.js | 14 -------- ui/pages/guest-edit.html.tmpl | 2 +- ui/pages/guest-media.html.tmpl | 57 ---------------------------------- ui/pages/guest.html.tmpl | 1 - 6 files changed, 39 insertions(+), 133 deletions(-) delete mode 100644 ui/css/theme-default/guest-media.css delete mode 100644 ui/pages/guest-media.html.tmpl

Reviewed-by: Aline Manera <alinefm@linux.vnet.ibm.com> Tested-by: Aline Manera <alinefm@linux.vnet.ibm.com> On 08/22/2014 03:11 AM, Wen Wang wrote:
Changes: V1 -> V2: 1) Have the "ui/css/theme-default/guest-media.css" deleted 2) Have the "edit" button in interface tab deleted when VM is running
1) Have the "Manage Media" function deleted from "Action" list 2) Enable "Edit" whether VM is running or off 3) Disable edit function of "General", "Storage", "Interface" except "replace" of the cdrom under "Storage".
Wen Wang (2): UI: Delete Manage Media function from action list Allow admin user change permission settings when VM is running
ui/css/theme-default/guest-media.css | 42 ------------------------- ui/js/src/kimchi.guest_edit_main.js | 56 ++++++++++++++++++++++----------- ui/js/src/kimchi.guest_main.js | 14 -------- ui/pages/guest-edit.html.tmpl | 2 +- ui/pages/guest-media.html.tmpl | 57 ---------------------------------- ui/pages/guest.html.tmpl | 1 - 6 files changed, 39 insertions(+), 133 deletions(-) delete mode 100644 ui/css/theme-default/guest-media.css delete mode 100644 ui/pages/guest-media.html.tmpl
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel
participants (2)
-
Aline Manera
-
Wen Wang