1 #from skeleton import skeleton
2 #from invirt.config import structs as config
15 <h2>Create a new VM</h2>
17 <p class="error">We had a problem with your request:</p>
18 #else if $varExists('new_machine')
19 <p>Congratulations! You successfully created a new VM called $new_machine.</p>
21 <form action="create" method="POST">
22 <input type="hidden" name="back" value="list"/>
25 $errorRow('create', $err)
29 <td><input type="text" name="name" value="$defaults.name"/>.${config.dns.domains[0]}</td>
32 $errorRow('name', $err)
36 <td><textarea name="description" rows="4" cols="60">$defaults.description</textarea></td>
39 $errorRow('description', $err)
43 <td><input type="text" name="memory" value="$defaults.memory" size=3/> MiB ($max_memory max)</td>
46 $errorRow('memory', $err)
50 <td><input type="text" name="disksize" value="$defaults.disk" size=3/> GiB (${"%0.1f" % ($max_disk-0.05)} max)</td>
53 $errorRow('disk', $err)
58 $helppopup('HVM/ParaVM')#slurp
63 $vmTypeList($defaults.type)
68 $errorRow('vmtype', $err)
71 $errorRow('autoinstall', $err)
76 $helppopup('Autoinstalls')#slurp
79 <td><input type="radio" name="cd_or_auto" id="cd_or_auto_auto"
80 onchange="\$('cdromlist').value = ''; \$('vmtype-linux').checked = true">
82 $autoList($defaults.cdrom, "$('cd_or_auto_auto').checked = true;$('cdromlist').value = '';$('vmtype-linux').checked = true")
83 (experimental; 2-3 minutes, and you have a machine with empty root password.)
89 <td><input type="radio" name="cd_or_auto" id="cd_or_auto_cd" checked="checked"
90 onchange="\$('autoinstalllist').value = ''; \$('vmtype-linux-hvm').checked = true">
92 $cdromList($defaults.cdrom, "$('cd_or_auto_cd').checked = true;$('autoinstalllist').value = '';$('vmtype-linux-hvm').checked = true")
97 $errorRow('cdrom', $err)
98 $errorRow('cdrom', $err)
101 <td><input type="text" name="owner" value="$defaults.owner"/></td>
104 $errorRow('owner', $err)
107 <input type="submit" class="button" value="Create it!"/><br />
108 Windows notes: #slurp
110 $helppopup('Windows')#slurp
116 #def machineRow($machine)
119 <form action="command" method="post">
120 <input type="hidden" name="back" value="list"/>
121 <input type="hidden" name="machine_id"
122 value="$machine.machine_id"/>
123 <input type="submit" class="power #slurp
124 #if $machine.uptime then 'on' else 'off'
125 " name="action" value="#slurp
126 #if $machine.uptime then 'Power off' else 'Power on'
129 onclick="return confirm('Are you sure you want to power off this VM?');"
134 <td><a href="info?machine_id=$machine.machine_id">$machine.name</a></td>
135 <td>${machine.memory}M</td>
136 <td>$machine.owner</td>
137 <td>$machine.administrator</td>
139 #set $nic = $machine.nics[0]
146 ${datetime.timedelta(seconds=int(machine.uptime))}#slurp
150 #if $has_vnc[$machine] == True
151 <a href="vnc?machine_id=$machine.machine_id">Console</a>#slurp
152 #else if $has_vnc[$machine] != 'Off'
160 <td colspan="7" style="padding-left: 1em; color: #666">$machine.description</td>
164 #def machineList($machines)
165 <table cellspacing="0" cellpadding="2">
172 $helppopup('Owner')#slurp
175 <th>Administrator#slurp
177 $helppopup('Administrator')#slurp
184 #for $machine in $machines:
186 $machineRow($machine)
190 <script type="text/javascript" src="/static/stripe.js"></script>
191 <script type="text/javascript">
192 document.observe("dom:loaded", function() {
193 stripe(\$('machinelist').getElementsByTagName('table')[0],
201 <p style="font-size: 125%;"><a href="http://${config.web.hostname}">What is XVM?</a></p>
203 <p>You don't currently control any VMs.</p>
205 <p><a href="list">refresh</a></p>
206 <div id="machinelist">
208 $machineList($machines)