1 <%page expression_filter="h"/>
2 <%inherit file="skeleton.mako" />
4 from invirt.config import structs as config
13 <%def name="createForm()">
17 <h2>Create a new VM</h2>
19 <p class="error">We had a problem with your request:</p>
21 <p>Congratulations! You successfully created a new VM called ${new_machine}.</p>
23 <form action="create" method="POST">
24 <input type="hidden" name="back" value="list"/>
26 ${self.fn.errorRow('create', err)}
29 <td><input type="text" name="name" value="${defaults.name}"/>.${config.dns.domains[0]}</td>
31 ${self.fn.errorRow('name', err)}
34 <td><textarea name="description" rows="4" cols="60">${defaults.description}</textarea></td>
36 ${self.fn.errorRow('description', err)}
39 <td><input type="text" name="memory" value="${defaults.memory}" size=3/> MiB (${max_memory} max)</td>
41 ${self.fn.errorRow('memory', err)}
44 <td><input type="text" name="disksize" value="${defaults.disk}" size=3/> GiB (${"%0.1f" % (max_disk-0.05)} max)</td>
46 ${self.fn.errorRow('disk', err)}
48 <td>HVM/ParaVM${self.fn.helppopup('HVM/ParaVM')}</td>
50 ${self.fn.vmTypeList(defaults.type)}
53 ${self.fn.errorRow('vmtype', err)}
54 ${self.fn.errorRow('autoinstall', err)}
56 <td>Autoinstall${self.fn.helppopup('Autoinstalls')}</td>
57 <td><input type="radio" name="cd_or_auto" id="cd_or_auto_auto"
58 onchange="\$('cdromlist').value = ''; \$('vmtype-linux').checked = true">
59 ${self.fn.autoList(defaults.cdrom, "$('cd_or_auto_auto').checked = true;$('cdromlist').value = '';$('vmtype-linux').checked = true")}
60 (experimental; 2-3 minutes, and you have a machine with empty root password.)
65 <td><input type="radio" name="cd_or_auto" id="cd_or_auto_cd" checked="checked"
66 onchange="\$('autoinstalllist').value = ''; \$('vmtype-linux-hvm').checked = true">
67 ${self.fn.cdromList(defaults.cdrom, "$('cd_or_auto_cd').checked = true;$('autoinstalllist').value = '';$('vmtype-linux-hvm').checked = true")}
71 ${self.fn.errorRow('cdrom', err)}
72 ${self.fn.errorRow('cdrom', err)}
75 <td><input type="text" name="owner" value="${defaults.owner}"/></td>
77 ${self.fn.errorRow('owner', err)}
79 <input type="submit" class="button" value="Create it!"/><br />
80 Windows notes: ${self.fn.helppopup('Windows')}
85 <%def name="machineRow(machine)">
88 <form action="command" method="post">
89 <input type="hidden" name="back" value="list"/>
90 <input type="hidden" name="machine_id"
91 value="${machine.machine_id}"/>
92 <input type="submit" class="power ${'on' if machine.uptime else 'off'}" name="action" value="${'Power off' if machine.uptime else 'Power on'}"\
94 onclick="return confirm('Are you sure you want to power off this VM?');"
99 <td><a href="info?machine_id=${machine.machine_id}">${machine.name}</a></td>
100 <td>${machine.memory}M</td>
101 <td>${machine.owner}</td>
102 <td>${machine.administrator}</td>
104 <td>${', '.join(map(lambda x: x.ip, machine.nics))}</td>
110 ${datetime.timedelta(seconds=int(machine.uptime))}\
114 % if has_vnc[machine] == True:
115 <a href="vnc?machine_id=${machine.machine_id}">Console</a>\
116 % elif has_vnc[machine] != 'Off':
122 <td colspan="7" style="padding-left: 1em; color: #666">${machine.description}</td>
126 <%def name="machineList(machines)">
127 <table cellspacing="0" cellpadding="2">
132 <th>Owner${self.fn.helppopup('Owner')}</th>
133 <th>Administrator${self.fn.helppopup('Administrator')}</th>
138 % for machine in machines:
139 ${machineRow(machine)}
142 <script type="text/javascript" src="/static/stripe.js"></script>
143 <script type="text/javascript">
144 document.observe("dom:loaded", function() {
145 stripe(\$('machinelist').getElementsByTagName('table')[0],
151 <p style="font-size: 125%;"><a href="http://${config.web.hostname}">What is XVM?</a></p>
153 <p>You don't currently control any VMs.</p>
155 <p><a href="list">refresh</a></p>
156 <div id="machinelist">
157 ${machineList(machines)}