1 <%page expression_filter="h"/>
2 <%inherit file="skeleton.mako" />
12 %if os.path.exists("/etc/invirt/motd.html"):
14 <p class="error">${open('/etc/invirt/motd.html').read()|n}</p>
18 <%def name="createForm()">
22 <h2>Create a new VM</h2>
24 <p class="error">We had a problem with your request:</p>
26 <p>Congratulations! You successfully created a new VM called ${new_machine}.</p>
29 <form action="create" method="POST">
30 <input type="hidden" name="back" value="list"/>
32 ${self.fn.errorRow('create', err)}
35 <td><input type="text" name="name" value="${defaults.name}"/>.${config.dns.domains[0]}</td>
37 ${self.fn.errorRow('name', err)}
40 <td><textarea name="description" rows="4" cols="60">${defaults.description}</textarea></td>
42 ${self.fn.errorRow('description', err)}
45 <td><input type="text" name="memory" value="${defaults.memory}" size=3/> MiB (${max_memory} max)</td>
47 ${self.fn.errorRow('memory', err)}
50 <td><input type="text" name="disksize" value="${defaults.disk}" size=3/> GiB (${"%0.1f" % (max_disk-0.05)} max)</td>
52 ${self.fn.errorRow('disk', err)}
54 <td>Network Device${self.fn.helppopup('Network Device')}</td>
56 ${self.fn.nicTypeList(defaults.nic)}
59 ${self.fn.errorRow('nictype', err)}
62 <td>HVM/ParaVM${self.fn.helppopup('HVM/ParaVM')}</td>
64 ${self.fn.vmTypeList(defaults.type)}
67 ${self.fn.errorRow('vmtype', err)}
68 ${self.fn.errorRow('autoinstall', err)}
70 <td>Autoinstall${self.fn.helppopup('Autoinstalls')}</td>
71 <td><label><input type="radio" name="cd_or_auto" id="cd_or_auto_auto"
72 onchange="$('cdromlist').value = ''; $('vmtype-linux').checked = true" />
73 ${self.fn.autoList(defaults.cdrom, "$('cd_or_auto_auto').checked = true;$('cdromlist').value = '';$('vmtype-linux').checked = true")}
74 (experimental; 2-3 minutes, and you have a machine with empty root password.)
79 <td><label><input type="radio" name="cd_or_auto" id="cd_or_auto_cd" checked="checked"
80 onchange="$('autoinstalllist').value = ''; $('vmtype-linux-hvm').checked = true" />
81 ${self.fn.cdromList(defaults.cdrom, "$('cd_or_auto_cd').checked = true;$('autoinstalllist').value = '';$('vmtype-linux-hvm').checked = true")}
84 ${self.fn.errorRow('cdrom', err)}
85 ${self.fn.errorRow('cdrom', err)}
88 <td><input type="text" name="owner" value="${defaults.owner}"/></td>
90 ${self.fn.errorRow('owner', err)}
92 <input type="submit" class="button" value="Create it!" \
93 % if disable_creation:
97 % if disable_creation:
98 <span style="color:red;">VM creation is currently disabled due to lack of disk space.</span> \
101 Windows notes: ${self.fn.helppopup('Windows')}
106 <%def name="machineRow(machine, dark)">
108 on = (machine.uptime is not None)
116 % if on and installing[machine]:
117 <img src="static/power_installing.png" alt="Installing..." />
119 <form action="machine/${machine.machine_id}/command/${'shutdown' if on else 'create'}" method="post">
120 <input type="hidden" name="back" value="list"/>
121 <input type="submit" class="power ${'on' if on else 'off'}" name="action" value="${'Shutdown' if on else 'Power on'}"\
123 onclick="return confirm('Are you sure you want to power off this VM?');"
129 <td><a href="machine/${machine.machine_id}">${machine.name}</a></td>
130 <td>${machine.memory}M</td>
131 <td>${machine.owner}</td>
132 <td>${machine.administrator}</td>
134 <td>${', '.join(nic.ip for nic in machine.nics)}</td>
140 ${datetime.timedelta(seconds=int(machine.uptime))}\
144 % if has_vnc[machine] == True:
145 <a href="machine/${machine.machine_id}/vnc">Console</a>\
146 % elif has_vnc[machine] == 'ParaVM':
147 ParaVM${self.fn.helppopup("ParaVM Console")}
148 % elif has_vnc[machine] != 'Off':
158 <td colspan="7" style="padding-left: 1em; color: #666">${machine.description|self.fn.module.nl2br}</td>
162 <%def name="machineList(machines)">
163 <table cellspacing="0" cellpadding="2">
168 <th>Owner${self.fn.helppopup('Owner')}</th>
169 <th>Administrator${self.fn.helppopup('Administrator')}</th>
174 % for n, machine in enumerate(machines):
175 ${machineRow(machine, (n%2)==0)}
180 <p style="font-size: 125%;"><a href="http://${config.web.hostname}">What is XVM?</a></p>
182 <p>You don't currently control any VMs.</p>
184 <p><a href="list">refresh</a></p>
185 <div id="machinelist">
186 ${machineList(machines)}