Disable image cloning when ice3 is booted - this should work as a locking
authorEvan Broder <broder@mit.edu>
Sat, 31 May 2008 05:18:40 +0000 (01:18 -0400)
committerEvan Broder <broder@mit.edu>
Sat, 31 May 2008 05:18:40 +0000 (01:18 -0400)
mechanism

svn path=/trunk/packages/sipb-xen-www/; revision=540

code/main.py
code/templates/list.tmpl

index ce523cb..60c2818 100755 (executable)
@@ -203,6 +203,7 @@ def getListDict(user):
     has_vnc = {}
     xmlist = g.xmlist
     checkpoint.checkpoint('Got uptimes')
+    can_clone = (controls.getList([Machine.get_by(name='ice3')])) == {}
     for m in machines:
         if m not in xmlist:
             has_vnc[m] = 'Off'
@@ -232,7 +233,8 @@ def getListDict(user):
              max_disk=max_disk,
              defaults=defaults,
              machines=machines,
-             has_vnc=has_vnc)
+             has_vnc=has_vnc,
+             can_clone=can_clone)
     return d
 
 def listVms(user, fields):
index c55261c..5c6f2c5 100644 (file)
@@ -61,9 +61,13 @@ $errorRow('vmtype', $err)
 #end filter
         <tr>
           <td>Clone image?</td>
+#if $can_clone
           <td><input type="checkbox" name="clone_from" id="clone_from" value="ice3" onchange="onclone(event)"/>
               (experimental; 1-2 minutes, and you have an etch machine; root pw is 'password'.)
               <script type='text/javascript'>function onclone(e){ document.getElementById('cdromlist').value = ''; }</script></td>
+#else
+         <td><input type="checkbox" name="clone_from" id="clone_from" value="ice3" disabled="disabled"/> Image cloning is currently disabled for maintenence</td>
+#end if
         </tr>
 #filter None
 $errorRow('autoinstall', $err)