1 <%page expression_filter="h"/>
2 <%inherit file="skeleton.mako" />
12 <%def name="createForm()">
16 <h2>Create a new VM</h2>
18 <p class="error">We had a problem with your request:</p>
20 <p>Congratulations! You successfully created a new VM called ${new_machine}.</p>
22 <form action="create" method="POST">
23 <input type="hidden" name="back" value="list"/>
25 ${self.fn.errorRow('create', err)}
28 <td><input type="text" name="name" value="${defaults.name}"/>.${config.dns.domains[0]}</td>
30 ${self.fn.errorRow('name', err)}
33 <td><textarea name="description" rows="4" cols="60">${defaults.description}</textarea></td>
35 ${self.fn.errorRow('description', err)}
38 <td><input type="text" name="memory" value="${defaults.memory}" size=3/> MiB (${max_memory} max)</td>
40 ${self.fn.errorRow('memory', err)}
43 <td><input type="text" name="disksize" value="${defaults.disk}" size=3/> GiB (${"%0.1f" % (max_disk-0.05)} max)</td>
45 ${self.fn.errorRow('disk', err)}
47 <td>HVM/ParaVM${self.fn.helppopup('HVM/ParaVM')}</td>
49 ${self.fn.vmTypeList(defaults.type)}
52 ${self.fn.errorRow('vmtype', err)}
53 ${self.fn.errorRow('autoinstall', err)}
55 <td>Autoinstall${self.fn.helppopup('Autoinstalls')}</td>
56 <td><input type="radio" name="cd_or_auto" id="cd_or_auto_auto"
57 onchange="\$('cdromlist').value = ''; \$('vmtype-linux').checked = true">
58 ${self.fn.autoList(defaults.cdrom, "$('cd_or_auto_auto').checked = true;$('cdromlist').value = '';$('vmtype-linux').checked = true")}
59 (experimental; 2-3 minutes, and you have a machine with empty root password.)
64 <td><input type="radio" name="cd_or_auto" id="cd_or_auto_cd" checked="checked"
65 onchange="\$('autoinstalllist').value = ''; \$('vmtype-linux-hvm').checked = true">
66 ${self.fn.cdromList(defaults.cdrom, "$('cd_or_auto_cd').checked = true;$('autoinstalllist').value = '';$('vmtype-linux-hvm').checked = true")}
70 ${self.fn.errorRow('cdrom', err)}
71 ${self.fn.errorRow('cdrom', err)}
74 <td><input type="text" name="owner" value="${defaults.owner}"/></td>
76 ${self.fn.errorRow('owner', err)}
78 <input type="submit" class="button" value="Create it!"/><br />
79 Windows notes: ${self.fn.helppopup('Windows')}
84 <%def name="machineRow(machine)">
87 % if machine.uptime and installing[machine]:
88 <img src="static/power_installing.png" alt="Installing..." />
90 <form action="machine/${machine.machine_id}/command/${'shutdown' if machine.uptime else 'create'}" method="post">
91 <input type="hidden" name="back" value="list"/>
92 <input type="hidden" name="machine_id"
93 value="${machine.machine_id}"/>
94 <input type="submit" class="power ${'on' if machine.uptime else 'off'}" name="action" value="${'Shutdown' if machine.uptime else 'Power on'}"\
96 onclick="return confirm('Are you sure you want to power off this VM?');"
102 <td><a href="machine/${machine.machine_id}">${machine.name}</a></td>
103 <td>${machine.memory}M</td>
104 <td>${machine.owner}</td>
105 <td>${machine.administrator}</td>
107 <td>${', '.join(nic.ip for nic in machine.nics)}</td>
113 ${datetime.timedelta(seconds=int(machine.uptime))}\
117 % if has_vnc[machine] == True:
118 <a href="machine/${machine.machine_id}/vnc">Console</a>\
119 % elif has_vnc[machine] == 'ParaVM':
120 ParaVM${self.fn.helppopup("ParaVM Console")}
121 % elif has_vnc[machine] != 'Off':
127 <td colspan="7" style="padding-left: 1em; color: #666">${machine.description|self.fn.module.nl2br}</td>
131 <%def name="machineList(machines)">
132 <table cellspacing="0" cellpadding="2">
137 <th>Owner${self.fn.helppopup('Owner')}</th>
138 <th>Administrator${self.fn.helppopup('Administrator')}</th>
143 % for machine in machines:
144 ${machineRow(machine)}
147 <script type="text/javascript" src="/static/stripe.js"></script>
148 <script type="text/javascript">
149 document.observe("dom:loaded", function() {
150 stripe(\$('machinelist').getElementsByTagName('table')[0],
156 <p style="font-size: 125%;"><a href="http://${config.web.hostname}">What is XVM?</a></p>
158 <p>You don't currently control any VMs.</p>
160 <p><a href="list">refresh</a></p>
161 <div id="machinelist">
162 ${machineList(machines)}