| Line | |
|---|
| 1 | #from skeleton import skeleton |
|---|
| 2 | #extends skeleton |
|---|
| 3 | |
|---|
| 4 | #def title |
|---|
| 5 | List of your VMs |
|---|
| 6 | #end def |
|---|
| 7 | |
|---|
| 8 | #def body |
|---|
| 9 | #if not $machines |
|---|
| 10 | |
|---|
| 11 | #else |
|---|
| 12 | <p>You have the following VMs:</p> |
|---|
| 13 | <table> |
|---|
| 14 | <tr> |
|---|
| 15 | <td>Name</td> |
|---|
| 16 | <td>Memory</td> |
|---|
| 17 | <td>owner</td> |
|---|
| 18 | <td>IP</td> |
|---|
| 19 | <td>MAC Address</td> |
|---|
| 20 | <td>Hostname</td> |
|---|
| 21 | <td>Uptime</td> |
|---|
| 22 | <td>VNC</td> |
|---|
| 23 | <td></td> |
|---|
| 24 | #for $machine in $machines: |
|---|
| 25 | <tr> |
|---|
| 26 | <td><a href="info?machine_id=$machine.machine_id">$machine.name</a></td> |
|---|
| 27 | <td>${machine.memory}M</td> |
|---|
| 28 | <td>$machine.owner</td> |
|---|
| 29 | #if $machine.nics |
|---|
| 30 | #set $nic = $machine.nics[0] |
|---|
| 31 | <td>$nic.ip</td> |
|---|
| 32 | <td>$nic.mac_addr</td> |
|---|
| 33 | <td>$nic.hostname</td> |
|---|
| 34 | #else |
|---|
| 35 | <td></td> |
|---|
| 36 | <td></td> |
|---|
| 37 | <td></td> |
|---|
| 38 | #end if |
|---|
| 39 | <td>#slurp |
|---|
| 40 | #if $uptimes[$machine] |
|---|
| 41 | $uptimes[$machine]#slurp |
|---|
| 42 | #else |
|---|
| 43 | Off#slurp |
|---|
| 44 | #end if |
|---|
| 45 | </td> |
|---|
| 46 | <td>#slurp |
|---|
| 47 | #if $has_vnc[$machine] == True |
|---|
| 48 | <a href="vnc?machine_id=$machine.machine_id">Console</a>#slurp |
|---|
| 49 | #else |
|---|
| 50 | $has_vnc[$machine] |
|---|
| 51 | #end if |
|---|
| 52 | </td> |
|---|
| 53 | <td> |
|---|
| 54 | <form action="command"> |
|---|
| 55 | <input type="hidden" name="machine_id" |
|---|
| 56 | value="$machine.machine_id"/> |
|---|
| 57 | #if $uptimes[$machine] |
|---|
| 58 | <input type="submit" class="button" name="action" value="Shutdown"/> |
|---|
| 59 | #else |
|---|
| 60 | <input type="submit" class="button" name="action" value="Power on"/> |
|---|
| 61 | #end if |
|---|
| 62 | </form> |
|---|
| 63 | </td> |
|---|
| 64 | </tr> |
|---|
| 65 | #end for |
|---|
| 66 | </table> |
|---|
| 67 | #end if |
|---|
| 68 | #if $can_add_vm |
|---|
| 69 | <p>Create a new VM:</p> |
|---|
| 70 | <form action="create" method="POST"> |
|---|
| 71 | <table> |
|---|
| 72 | <tr> |
|---|
| 73 | <td>Name</td> |
|---|
| 74 | <td>${user.username}_<input type="text" name="name" value=""/></td> |
|---|
| 75 | </tr> |
|---|
| 76 | <tr> |
|---|
| 77 | <td>Memory</td> |
|---|
| 78 | <td><input type="text" name="memory" value="$default_mem" size=3/> megabytes ($max_mem max)</td> |
|---|
| 79 | </tr> |
|---|
| 80 | <tr> |
|---|
| 81 | <td>Disk</td> |
|---|
| 82 | <td><input type="text" name="disk" value="$default_disk" size=3/> gigabytes (${"%0.1f" % ($max_disk-0.05)} max)</td> |
|---|
| 83 | </tr> |
|---|
| 84 | <tr> |
|---|
| 85 | <td>HVM/ParaVM$helppopup('hvm_paravm')</td> |
|---|
| 86 | <td> |
|---|
| 87 | <input checked type="radio" name="vmtype" value="hvm">HVM</input> |
|---|
| 88 | <input type="radio" name="vmtype" value="paravm">ParaVM</input> |
|---|
| 89 | </td> |
|---|
| 90 | </tr> |
|---|
| 91 | <tr> |
|---|
| 92 | <td>Boot CD</td> |
|---|
| 93 | <td> |
|---|
| 94 | <select name="cdrom"> |
|---|
| 95 | <option selected value="">None</option> |
|---|
| 96 | #for $cdrom in $cdroms |
|---|
| 97 | <option value="$cdrom.cdrom_id"> |
|---|
| 98 | $cdrom.description |
|---|
| 99 | </option> |
|---|
| 100 | #end for |
|---|
| 101 | </select> |
|---|
| 102 | </td> |
|---|
| 103 | </tr> |
|---|
| 104 | </table> |
|---|
| 105 | <input type="submit" class="button" value="Create it!"/> |
|---|
| 106 | </form> |
|---|
| 107 | #else |
|---|
| 108 | <p>You are at the maximum number of VMs.</p> |
|---|
| 109 | #end if |
|---|
| 110 | #end def |
|---|
Note: See
TracBrowser
for help on using the repository browser.