<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 10/24/2014 11:07 AM, Wen Wang wrote:<br>
    </div>
    <blockquote
      cite="mid:1414120057-26695-1-git-send-email-wenwang@linux.vnet.ibm.com"
      type="cite">
      <pre wrap="">From: Wen Wang <a class="moz-txt-link-rfc2396E" href="mailto:wenwang@linux.vnet.ibm.com">&lt;wenwang@linux.vnet.ibm.com&gt;</a>

V1 -&gt; V2:
Enable CDROM hot plug including detaching.

Enable users add and detach disk when vm is running.

Signed-off-by: Wen Wang <a class="moz-txt-link-rfc2396E" href="mailto:wenwang@linux.vnet.ibm.com">&lt;wenwang@linux.vnet.ibm.com&gt;</a>
---
 ui/js/src/kimchi.guest_edit_main.js |   29 +++++++++++------------------
 1 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/ui/js/src/kimchi.guest_edit_main.js b/ui/js/src/kimchi.guest_edit_main.js
index 030e112..82aeeb6 100644
--- a/ui/js/src/kimchi.guest_edit_main.js
+++ b/ui/js/src/kimchi.guest_edit_main.js
@@ -57,17 +57,12 @@ kimchi.guest_edit_main = function() {
                 text: false
             });

-            if(kimchi.thisVMState != "running") {
-                $('.detach', container).button({
-                    icons: {
-                        primary: 'ui-icon-trash'
-                    },
-                    text: false
-                });
-
-            } else {
-                $('.detach', container).remove();
-            }
+            $('.detach', container).button({
+                icons: {
+                    primary: 'ui-icon-trash'
+                },
+                text: false
+            });

             $('.save', container).button({
                 icons: {
@@ -443,14 +438,8 @@ kimchi.guest_edit_main = function() {
         guest['icon'] = guest['icon'] || 'images/icon-vm.png';
         $('#form-guest-edit-general').fillWithObject(guest);
         kimchi.thisVMState = guest['state'];
-
         refreshCDROMs();
-        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({
+        $('#guest-edit-attach-cdrom-button').button({
                 icons: {
                     primary: "ui-icon-plusthick"
                 },
@@ -459,6 +448,10 @@ kimchi.guest_edit_main = function() {
                 event.preventDefault();
                 kimchi.window.open("guest-storage-add.html");
             });
+        if(kimchi.thisVMState === "running") {
+            $("#form-guest-edit-general input").prop("disabled", "disabled");</pre>
    </blockquote>
    'disabled' is a boolean type.<br>
    <br>
    <a class="moz-txt-link-freetext" href="http://api.jquery.com/prop/">http://api.jquery.com/prop/</a><br>
    <img src="cid:part1.03030704.06000403@linux.vnet.ibm.com" alt=""><br>
    <blockquote
      cite="mid:1414120057-26695-1-git-send-email-wenwang@linux.vnet.ibm.com"
      type="cite">
      <pre wrap="">
+            $("#form-guest-edit-interface .header button").remove();
+        } else {
             $("#action-button-container").removeClass("hidden");
         }

</pre>
    </blockquote>
    <br>
  </body>
</html>