1 <%page expression_filter="h"/>
2 <%inherit file="skeleton.mako" />
12 %if os.path.exists("/etc/invirt/message"):
14 <p class="error">${open('/etc/invirt/message').read()}</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>HVM/ParaVM${self.fn.helppopup('HVM/ParaVM')}</td>
56 ${self.fn.vmTypeList(defaults.type)}
59 ${self.fn.errorRow('vmtype', err)}
60 ${self.fn.errorRow('autoinstall', err)}
62 <td>Autoinstall${self.fn.helppopup('Autoinstalls')}</td>
63 <td><label><input type="radio" name="cd_or_auto" id="cd_or_auto_auto"
64 onchange="$('cdromlist').value = ''; $('vmtype-linux').checked = true" />
65 ${self.fn.autoList(defaults.cdrom, "$('cd_or_auto_auto').checked = true;$('cdromlist').value = '';$('vmtype-linux').checked = true")}
66 (experimental; 2-3 minutes, and you have a machine with empty root password.)
71 <td><label><input type="radio" name="cd_or_auto" id="cd_or_auto_cd" checked="checked"
72 onchange="$('autoinstalllist').value = ''; $('vmtype-linux-hvm').checked = true" />
73 ${self.fn.cdromList(defaults.cdrom, "$('cd_or_auto_cd').checked = true;$('autoinstalllist').value = '';$('vmtype-linux-hvm').checked = true")}
76 ${self.fn.errorRow('cdrom', err)}
77 ${self.fn.errorRow('cdrom', err)}
80 <td><input type="text" name="owner" value="${defaults.owner}"/></td>
82 ${self.fn.errorRow('owner', err)}
84 <input type="submit" class="button" value="Create it!"/><br />
85 Windows notes: ${self.fn.helppopup('Windows')}
90 <%def name="machineRow(machine, dark)">
97 % if machine.uptime and installing[machine]:
98 <img src="static/power_installing.png" alt="Installing..." />
100 <form action="machine/${machine.machine_id}/command/${'shutdown' if machine.uptime else 'create'}" method="post">
101 <input type="hidden" name="back" value="list"/>
102 <input type="hidden" name="machine_id"
103 value="${machine.machine_id}"/>
104 <input type="submit" class="power ${'on' if machine.uptime else 'off'}" name="action" value="${'Shutdown' if machine.uptime else 'Power on'}"\
106 onclick="return confirm('Are you sure you want to power off this VM?');"
112 <td><a href="machine/${machine.machine_id}">${machine.name}</a></td>
113 <td>${machine.memory}M</td>
114 <td>${machine.owner}</td>
115 <td>${machine.administrator}</td>
117 <td>${', '.join(nic.ip for nic in machine.nics)}</td>
123 ${datetime.timedelta(seconds=int(machine.uptime))}\
127 % if has_vnc[machine] == True:
128 <a href="machine/${machine.machine_id}/vnc">Console</a>\
129 % elif has_vnc[machine] == 'ParaVM':
130 ParaVM${self.fn.helppopup("ParaVM Console")}
131 % elif has_vnc[machine] != 'Off':
141 <td colspan="7" style="padding-left: 1em; color: #666">${machine.description|self.fn.module.nl2br}</td>
145 <%def name="machineList(machines)">
146 <table cellspacing="0" cellpadding="2">
151 <th>Owner${self.fn.helppopup('Owner')}</th>
152 <th>Administrator${self.fn.helppopup('Administrator')}</th>
157 % for n, machine in enumerate(machines):
158 ${machineRow(machine, (n%2)==0)}
163 <p style="font-size: 125%;"><a href="http://${config.web.hostname}">What is XVM?</a></p>
165 <p>You don't currently control any VMs.</p>
167 <p><a href="list">refresh</a></p>
168 <div id="machinelist">
169 ${machineList(machines)}