OSDN Git Service

fe516dd380164ce820255e54ecab3c7eee8d28d8
[karesansui/karesansui.git] / karesansui / templates / default / guest / guest.input
1 <%doc>Copyright (C) 2009-2010 HDE, Inc.</%doc>
2 <%inherit file="../include/common.part" />
3 <%! from karesansui.lib.template import view_autounit %>
4
5 <script type="text/javascript">
6 <!--
7 function validates_guest(){
8     var check = true;
9     ERROR_MSG = "";
10
11     check = check_string(
12                 $("#m_name"),
13                 CHECK_EMPTY | CHECK_LENGTH | CHECK_ONLYSPACE,
14                 "${_('Guest Name')}",
15                 null,
16                 MACHINE_NAME_MIN_LENGTH,
17                 MACHINE_NAME_MAX_LENGTH
18             ) && check;
19
20     check = check_string(
21                 $("#note_title"),
22                 CHECK_LENGTH | CHECK_ONLYSPACE,
23                 "${_('Title')}",
24                 null,
25                 NOTE_TITLE_MIN_LENGTH,
26                 NOTE_TITLE_MAX_LENGTH
27             ) && check;
28
29     check = check_string(
30                 $("#note_value"),
31                 CHECK_ONLYSPACE,
32                 "${_('Note')}",
33                 null,
34                 null,
35                 null
36             ) && check;
37
38     if($("#tags").val()){
39         var form_tmp = $("#tags").val();
40         var tags = $("#tags").val().split(",");
41         var tag_check = true;
42
43         for (var idx in tags){
44             $("#tags").val(tags[idx]);
45             tag_check = check_string(
46                         $("#tags"),
47                         CHECK_LENGTH | CHECK_ONLYSPACE,
48                         "${_('Tag')}",
49                         null,
50                         TAG_MIN_LENGTH,
51                         TAG_MAX_LENGTH
52                     ) && tag_check;
53             if(tag_check == false){
54                 break;
55             }
56         }
57         $("#tags").val(form_tmp);
58         check = check && tag_check;
59     }
60
61     check = check_string(
62                 $("#domain_name"),
63                 CHECK_EMPTY | CHECK_LENGTH | CHECK_VALID | CHECK_ONLYSPACE,
64                 "${_('Domain ID')}",
65                 /[^-_.0-9a-zA-Z]+/,
66                 DOMAIN_ID_MIN_LENGTH,
67                 DOMAIN_ID_MAX_LENGTH
68             ) && check;
69     check = check_number(
70                 $("#vm_mem_size"),
71                 CHECK_VALID | CHECK_MIN | CHECK_EMPTY,
72                 "${_('Memory Size (MB)')}",
73                 MEMORY_MIN_SIZE
74             ) && check;
75
76     check = check_number(
77                 $("#vm_disk_size"),
78                 CHECK_VALID | CHECK_MIN | CHECK_EMPTY,
79                 "${_('Disk Size (MB)')}",
80                 DISK_MIN_SIZE
81             ) && check;
82
83    boot_image = $("input:radio[name='boot_image']:checked").val();
84    if(boot_image == "kernel") {
85         check = check_startfile(
86                 $("#vm_kernel"),
87                 CHECK_EMPTY | CHECK_VALID,
88                 "${_('Kernel Image')}"
89             ) && check;
90         check = check_startfile(
91                 $("#vm_initrd"),
92                 CHECK_EMPTY | CHECK_VALID,
93                 "${_('Initrd Image')}"
94             ) && check;
95     } else {
96         check = check_startfile(
97                 $("#vm_iso"),
98                 CHECK_EMPTY | CHECK_VALID,
99                 "${_('ISO Image')}"
100             ) && check;
101     }
102
103     check = check_number(
104                 $("#vm_vncport"),
105                 CHECK_EMPTY | CHECK_VALID | CHECK_MIN | CHECK_MAX,
106                 "${_('VNC Port Number')}",
107                 VNC_PORT_MIN_NUMBER,
108                 VNC_PORT_MAX_NUMBER
109             ) && check;
110
111     check = check_macaddr(
112                 $("#vm_mac"),
113                 CHECK_EMPTY | CHECK_VALID,
114                 "${_('MAC Address')}"
115             ) && check;
116
117     if(!check){
118         show_alert_msg("${_('Please input correct value.')}\n" + ERROR_MSG);
119     }
120
121     return check;
122 }
123
124 function setDefaultValue() {
125    hypervisor = $("#m_hypervisor").children(":selected").val();
126    if(hypervisor == 2) { /* kvm */
127      $("#boot_image_iso_html").css("display","block")
128    } else {              /* not kvm as xen */
129      $("#boot_image_iso_html").css("display","none")
130    }
131 % for x in hypervisors.keys():
132    if("${hypervisors[x]}" == hypervisor) {
133      $("#vm_mac").val("${mac_address[x]}");
134
135      keymap_html = '<select id="keymap" name="keymap">'
136      % for y in keymaps[x]:
137        % if y == DEFAULT_KEYMAP:
138          keymap_html += '<option value="${y | h}" selected="selected">${y | h}</option>'
139        % else:
140          keymap_html += '<option value="${y | h}">${y | h}</option>'
141        % endif
142      % endfor
143      keymap_html += '</select>';
144      $("#select_keymap_html").html(keymap_html);
145
146      phydev_html = '<select id="phydev" name="phydev">'
147      % for y in phydev[x]:
148        phydev_html += '<option value="${y | h}">${y | h}</option>'
149      % endfor
150      phydev_html += '</select>';
151      $("#select_phydev_html").html(phydev_html);
152
153      virnet_html = '<select id="virnet" name="virnet">'
154      % for y in virnet[x]:
155        virnet_html += '<option value="${y | h}">${y | h}</option>'
156      % endfor
157      virnet_html += '</select>'
158      $("#select_virnet_html").html(virnet_html)
159    }
160 % endfor
161
162    boot_image = $("input:radio[name='boot_image']:checked").val();
163    if(boot_image == "kernel") {
164      $("#vm_kernel_require_str").css("display","");
165      $("#vm_initrd_require_str").css("display","");
166      $("#vm_iso_require_str").css("display","none");
167      $("#vm_kernel").attr("disabled", "");
168      $("#vm_initrd").attr("disabled", "");
169      $("#vm_iso").attr("disabled", "disabled");
170    } else {
171      $("#vm_kernel_require_str").css("display","none");
172      $("#vm_initrd_require_str").css("display","none");
173      $("#vm_iso_require_str").css("display","");
174      $("#vm_kernel").attr("disabled", "disabled");
175      $("#vm_initrd").attr("disabled", "disabled");
176      $("#vm_iso").attr("disabled", "");
177    }
178 }
179
180 // pool function
181 function show_element(id,flag) {
182     if(flag) {
183         $(id).show();
184     } else {
185         $(id).hide();
186     }
187 }
188
189 $(document).ready(function(){
190     // TODO: ストレージプール毎に最大値等を設定する
191     set_simple_slider("#disk_slider", "#vm_disk_size", 0, ${int(pools_info['default']['available']) / (1024 * 1024)}, ${int(pools_info['default']['available']) / (1024 * 1024)});
192     $("#pool_dir").change(function(){
193         var pool_name = $('option:selected', this).val();
194         var disk_type = $('option:selected', this).parent('optgroup').attr('label');
195         if(disk_type == 'block'){
196             var parts = pool_name.split("_");
197             var vol_name = parts[1];
198
199             var vols_info = new Array();
200 % for pool_name in sorted(pools_vols_info.keys()):
201 %     for vol_name in sorted(pools_vols_info[pool_name].keys()):
202             var vol_info = new Array();
203             vol_info['capacity'] = "${pools_vols_info[pool_name][vol_name]['capacity']}";
204             vols_info["${vol_name}"] = vol_info;
205 %     endfor
206 % endfor
207             var disk_capacity = Math.floor(vols_info[vol_name]['capacity'] / (1024 * 1024));
208             $("#disk_size_box").hide();
209             $("#disk_type_value_box").html(disk_type);
210             $("#disk_available_box").hide();
211             $("#disk_capacity_value_box").html(disk_capacity);
212             $("#disk_format_box").hide();
213         } else { // type is 'dir' or 'fs'
214             var pools_info = new Array();
215 % for pool_name in pools_info.keys():
216             var pool_info = new Array();
217             pool_info['available'] = "${pools_info[pool_name]['available']}";
218             pool_info['capacity'] = "${pools_info[pool_name]['capacity']}";
219             pools_info["${pool_name}"] = pool_info
220 % endfor
221             var disk_available = Math.floor(pools_info[pool_name]['available'] / (1024 * 1024));
222             var disk_capacity = Math.floor(pools_info[pool_name]['capacity'] / (1024 * 1024));
223             $("#disk_size_box").show();
224             set_simple_slider("#disk_slider", "#vm_disk_size", 0, disk_available, disk_available);
225             $("#disk_type_value_box").html(disk_type);
226             $("#disk_available_box").show();
227             $("#disk_available_value_box").html(disk_available);
228             $("#disk_capacity_value_box").html(disk_capacity);
229             $("#disk_format_box").show();
230         } 
231         
232     });
233
234     $("#pool_iscsi_list").tablesorter({
235         widgets: ['zebra', 'select'],
236         headers: {
237             0: {sorter:false}
238         }
239     });
240     setDefaultValue();
241
242     $("#mem_slider").slider({
243         startValue: 128,
244         min: ${min_mem},
245         max: ${max_mem},
246         slide: function(event, ui){
247             $("#vm_mem_size").val(ui.value);
248         }
249     });
250
251     $("#vm_mem_size").change(function(){
252         $("#mem_slider").slider("value",$(this).val());
253     });
254
255     icon_post_event(
256         "#input_guest_icon_form",
257         "${ctx.homepath}/icon",
258         function(){return true;}
259     );
260
261     machine_post_event(
262         "#input_guest_submit",
263         "${ctx.homepath}${ctx.path}",
264         "#input_guest :input",
265         validates_guest
266     );
267
268
269     $("tr[id*='pool_iscsi_row_']").each(function(){
270         $(this).one('click.once', function(){
271             var selc = $(this).attr("id").replace("pool_iscsi_row_", "").split("_");
272             var pool = selc[0];
273             var volume = selc[1];
274
275             $("#iscsi_pool").attr("value", pool);
276             $("#iscsi_volume").attr("value", volume);
277             //selected_row()
278         });
279     });
280
281     //help
282     helptip("#guest_name_help", 
283         "${_('Guest Name')}", 
284         "${_('Name of the guest. This will be used in Karesansui control panel. Any letters, including spaces and symbols are allowed.')}");
285
286     helptip("#guest_domain_name_help", 
287         "${_('Domain Name')}", 
288         "${_(r'VM domain name of the guest. This will be used to distinguish each guests in VM, so it should be unique between all guests  (This is NOT a DNS \"domain\"). Alphabets and some symbols are allowed.')}");
289
290     helptip("#guest_icon_help", 
291         "${_('Guest Icon')}", 
292         "${_('Icon image to be used in Karesansui control panel. Choose the file and click upload button.')}");
293
294     helptip("#guest_memory_help", 
295         "${_('Memory Size')}", 
296         "${_('The amount of RAM for the guest to use (in mega-bytes).')}");
297
298     // TRANSLATORS:
299     // ストレージとは 1系でいうディスクをさします。
300     //ストレージレイアウト
301     // 利用するストレージを設定します。\nストレージ追加\n新規にストレージを作成します。\n\niSCSIストレージ利用\nネットワークストレージを利用します。\n
302     helptip("#disk_layout_help",
303         "${_('Storage Type')}",
304         "${_(r'Create New Disk Image: Create a new storage image. \n\nUse iSCSI: Use iSCSI networked storage.\n')}");
305
306     // TRANSLATORS:
307     //ストレージプール
308     // ストレージプールを選択してください。ストレージプールは、ストレージプール画面から操作することができます。
309     helptip("#guest_disk_storage_name_help",
310         "${_('Storage Pool To Use')}",
311         "${_(r'Select the storage pool to use. You can manupulate storage pools in \"Storage Pool\" tab.')}");
312
313     // TRANSLATORS:
314     //空き容量
315     // そのストレージプールの空き容量です。(MB)
316     helptip("#guest_disk_storage_available_help",
317         "${_('Available')}",
318         "${_('Available space in the storage pool.(MB)')}");
319     // TRANSLATORS:
320     //キャパシティ
321     // ストレージプールの総容量です。(MB)
322     helptip("#guest_disk_storage_capacity_help",
323         "${_('Capacity')}",
324         "${_('Total capacity of the storage pool. (MB)')}");
325
326     // TRANSLATORS:
327     //ディスクサイズ
328     // ゲストOSのストレージ容量を設定します。(MB)
329     helptip("#guest_disk_storage_help",
330         "${_('Disk Size (MB)')}",
331         "${_('Set the storage capacity of the guest OS. (MB)')}");
332
333     // TRANSLATORS:
334     // イメージタイプ
335     /**
336 raw: もっともシンプルなイメージ形式です。(簡単に他のシステムで利用できる利点があります。)
337 vmdk : VMwareのバージョン3と4に対応するイメージ形式です。
338 cow: User Mode Linux利用されるイメージ形式です。
339 qcow: 古いQemuでサポートされているイメージ形式です。(互換性の維持で残されています。)
340 qcow2 : Qemuがサポートする最も一般的なイメージ形式です。
341
342 raw: This is the simplest image format. (Benefits available in other file systems easily.)
343 vmdk: VMware image format corresponding to the version 3 and 4.
344 cow: User Mode Linux is used image format.
345 qcow: Qemu is an older image formats are supported. (We have left in place to maintain compatibility.)
346 qcow2: Qemu is the most common image formats supported.
347
348     **/
349     helptip("#guest_disk_os_image_type_help",
350         "${_('Image Type')}",
351         "${_(r'raw: The simplest image format. High interoperability with other systems.\nvmdk: Format which is used in VMWare 3 or 4.\ncow: Format used in User Mode Linux.\nqcow: Format used in old versions of Qemu. Left for compatibility.\nqcow2: The most common image format supported by Qemu.\n')}");
352
353     // TRANSLATORS:
354     // ストレージプール種別
355     // ストレージプールの種別です。ネットワークストレージ及びストレージプールの画面で設定を行うことができます。
356     helptip("#guest_iscsi_storage_pool_type_help",
357         "${_('Storage Pool Type')}",
358         "${_('The type of storage pool. You can set this in networked storage tab and storage pool tab.')}");
359
360     // TRANSLATORS:
361     // ストレージプール名
362     // ストレージプールの名前です。ストレージプールの設定はストレージプール画面から行うことができます。
363     helptip("#guest_iscsi_storage_pool_help",
364         "${_('Storage Pool Name')}",
365         "${_('The name of the storage. Storage pool settings are available in storage pool tab.')}");
366
367     // TRANSLATORS:
368     // ストレージボリューム
369     // ストレージプール内で実際に使われるボリューム名です。
370     helptip("#guest_iscsi_storage_volume_name_help",
371         "${_('Storage Volume Name')}",
372         "${_('Volume name actually used in the storage pool.')}");
373
374     // TRANSLATORS:
375     // デバイス制御種別
376     // デバイスの制御方法を設定します。準仮想化デバイスとして動作するvirtio(KVM)/xen(Xen)を推奨します。
377     helptip("#guest_bus_type_help",
378         "${_('Bus Type')}",
379         "${_('Set the device controlling method. We recommend virtio (KVM) / xen (Xen), which allows device to act as a para-virtualized device.')}");
380
381     // TRANSLATORS:
382     // VNCキーマップ
383     // VNCで利用するキーマップです。
384     helptip("#device_display_bootup_vnc_keymap_help",
385         "${_('VNC Keymap')}",
386         "${_('Keymap of the keyboard to use with VNC.')}");
387
388     helptip("#guest_disk_help", 
389         "${_('Disk Size')}", 
390         "${_('Size of the disk of the guest (MB)')}");
391
392     helptip("#guest_kernel_help", 
393         "${_('Kernel Image')}", 
394         "${_('Kernel image for the guest. Specify FTP/HTTP URL, or a valid absolute file path.')}");
395     
396     helptip("#guest_initrd_help", 
397         "${_('Initrd Image')}", 
398         "${_('The initrd (bootup RAM disk) image for the guest. Specify FTP/HTTP URL, or a valid absolute file path.')}");
399
400     helptip("#guest_iso_help", 
401         "${_('ISO Image')}", 
402         "${_('The ISO 9660 CD-ROM/DVD-ROM image for the guest. Specify a valid absolute file path.')}");
403
404     helptip("#guest_vnc_port_help", 
405         "${_('VNC Port Number')}", 
406         "${_('(Auto-recommended value displayed below.) TCP port number to access the guest with VNC. Numbers greater than 5900 are allowed. Unique number between all guests are recommended.')}");
407
408     helptip("#guest_interface_type_help", 
409         "${_('Interface Type')}", 
410         "${_(r'Type of the virtual network interface connection. Choose \"Physical Device\" to connect directly to the physical network, or \"Virtual Network\" to connect guest to the virtual network (which are in \"Network\" tab of the host). ')}");
411
412     helptip("#guest_mac_address_help", 
413         "${_('MAC Address')}", 
414         "${_('(Auto-recommended value displayed below.) MAC address of the guest in xx:xx:xx:xx:xx:xx format. Specify an address not used in the network.')}");
415
416     helptip("#guest_option_help", 
417         "${_('Extra Kernel Options')}", 
418         "${_('Kernel parameters to pass to the guest kernel on guest installation.')}");
419
420     helptip("#guest_tag_help", 
421         "${_('Tag')}", 
422         "${_(r'Tag to add to the guest to be used in Karesansui control panel. Can be used to search guests using tags in the \"Guests\" panel. Separate tags with commas to specify two or more tags. Any letters, including spaces and symbols are allowed.')}");
423 });
424 // -->
425 </script>
426
427 <div id="input_guest">
428     <div class="grayout-head">
429         <span class="grayout-title">
430             <a href="#" id="server" class="path-a"><img src="${ctx.homepath}/static/images/settings-title.gif" alt="">${_('Create Guest')}</a>
431         </span>
432         <br style="clear: both;"/>
433     </div>
434     
435     <div class="grayout-contents">
436         <div class="grayout-param">${_('Guest Name')}<span id="guest_name_help"/></div>
437         <div class="grayout-value grayout-form">
438             <input type="text" id="m_name" name="m_name" value="" size="40" maxlength="256" /><span class="require-text">${_('Require')}</span>
439         </div>
440         <div class="grayout-param">${_('Hypervisor')}</div>
441         <div class="grayout-value grayout-form">
442             <select id="m_hypervisor" name="m_hypervisor" onChange="javascript:setDefaultValue()">
443 % for x in hypervisors.keys():
444                 <option value="${hypervisors[x]}">${_(x)}</option>
445 % endfor
446             </select>
447         </div>
448         <div class="grayout-param">${_('Domain Name')}<span id="guest_domain_name_help"/></div>
449         <div class="grayout-value grayout-form">
450             <input type="text" id="domain_name" name="domain_name" value="" size="40" /><span class="require-text">${_('Require')}</span>
451         </div>
452
453
454         <div class="grayout-param">${_('Guest Icon')}<span id="guest_icon_help"/></div>
455         <div class="grayout-value grayout-form">
456             <form action="#" method="post" id="input_guest_icon_form" name="input_guest_icon_form">
457                 <input type="file" id="multi_icon" name="multi_icon" size="40" />
458                 <input type="hidden" id="icon_filename" name="icon_filename" value="" />
459                 <a href="#" name="icon_upload_submit" id="icon_upload_submit" class="button" style="display: inline">
460                     <span class="button-left">&nbsp;</span><span class="button-right">${_('Upload')}</span>
461                 </a>
462                 <a href="#" name="icon_cancel_submit" id="icon_cancel_submit" class="button" style="display: inline">
463                     <span class="button-left">&nbsp;</span><span class="button-right">${_('Cancel')}</span>
464                 </a>
465             </form>
466         </div>
467
468         <div class="grayout-param">${_('Memory Size (MB)')}<span id="guest_memory_help"/></div>
469         <div class="grayout-value grayout-form">
470             <div id="mem_slider"></div>
471             <input type="text" id="vm_mem_size" name="vm_mem_size" value="512" /><span class="require-text">${_('Require')}</span>
472         </div>
473
474         <div class="grayout-param">${_('Storage Type')}<span id="disk_layout_help"/></div>
475         <div class="grayout-value grayout-form">
476 <style type="text/css">
477 .grayout-detail {
478     border: 1px solid #BCBCBC;
479     width: 100%;
480     margin: 5px 0px;
481 }
482 .detail-contents {
483     width: 100%;
484 }
485 .detail-separator{ 
486     height:18px;
487     width:60px;
488 }
489 .detail-space {
490     background:transparent url(${ctx.homepath}/static/images/kugiri-a.gif) repeat scroll 0 0;
491     height:4px;
492     margin-bottom:8px;
493     margin-top:8px;
494     width:100%;
495 }
496 table.detail-contents>tbody>tr>th{ 
497     font-weight: bold;
498     background-color: #FFFFFF;
499     padding:0px 10px;
500     width:20%;
501     text-align: left;
502     white-space: nowrap;
503
504 table.detail-contents>tbody>tr>td{ 
505     background-color: #FFFFFF;
506
507 </style>
508             ${_("Storage Pool Name")}&nbsp;:&nbsp;
509             <select id="pool_dir" name="pool_dir">
510 <!--
511 TODO: iscsiのストレージプールを表示させない。dir, fsのみ表示させる。
512 -->
513 % for group_type in ['dir', 'fs', 'block']:
514                 <optgroup label="${group_type}">
515 %     for name in sorted(pools_info.keys()):
516 %         if group_type == 'dir' and pools_info[name]['type'] == 'dir':
517 %             if pools_info[name]['name'] == 'default':
518                     <option value="${name}" selected>${name}</option>
519 %             else:
520                     <option value="${name}">${name}</option>
521 %             endif
522 %         endif
523
524 %         if group_type == 'fs' and pools_info[name]['type'] == 'fs':
525                     <option value="${name}">${name}</option>
526 %         endif
527
528 %         if group_type == 'block' and pools_info[name]['type'] == 'iscsi':
529 %             for vol_name in sorted(pools_vols_info[name].keys()):
530                     <option value="${name}_${vol_name}">${name}/${vol_name}</option>
531 %             endfor
532 %         endif
533 %     endfor
534                 </optgroup>
535 % endfor
536             </select>
537             <div class="grayout-detail">
538                 <input type="hidden" id="iscsi_pool" name="iscsi_pool" value="" />
539                 <input type="hidden" id="iscsi_volume" name="iscsi_volume" value="" />
540                 <table class="detail-contents">
541                     <tr id="disk_type_box">
542                         <th>${_('Storage Pool Type')}</th>
543                         <td class="detail-separator"><img src="${ctx.homepath}/static/images/table-space.gif" alt="" /></td>
544                         <td id="disk_type_value_box">${pools_info['default']['type'] | h}</td>
545                     </tr>
546                     <tr id="disk_size_box">
547                         <th>${_('Disk Size (MB)')}</th>
548                         <td class="detail-separator"><img src="${ctx.homepath}/static/images/table-space.gif" alt="" /></td>
549                         <td id="disk_size_value_box">
550                             <div id="disk_slider"></div>
551                             <input type="text" id="vm_disk_size" name="vm_disk_size" value="0" /><span class="require-text">${_('Require')}</span>
552                         </td>
553                     </tr>
554                     <tr id="disk_available_box">
555                         <th>${_('Available (MB)')}</th>
556                         <td class="detail-separator"><img src="${ctx.homepath}/static/images/table-space.gif" alt="" /></td>
557                         <td id="disk_available_value_box">${int(pools_info['default']['available']) / (1024 * 1024)}</td>
558                     </tr>
559                     <tr id="disk_capacity_box">
560                         <th>${_('Capacity (MB)')}</th>
561                         <td class="detail-separator"><img src="${ctx.homepath}/static/images/table-space.gif" alt="" /></td>
562                         <td id="disk_capacity_value_box">${int(pools_info['default']['capacity']) / (1024 * 1024)}</td>
563                     </tr>
564                     <tr id="disk_format_box">
565                         <th>${_('OS Image Type')}</th>
566                         <td class="detail-separator"><img src="${ctx.homepath}/static/images/table-space.gif" alt="" /></td>
567                         <td id="disk_format_value_box">
568                             <select id="select_disk_format" name="disk_format">
569 % if "KVM" in hypervisors.keys():
570 %   for x in DISK_QEMU_FORMAT.values():
571 %       if x == "qcow2":
572                                 <option value="${x}" selected>${x}</option>
573 %       else:
574                                 <option value="${x}">${x}</option>
575 %       endif
576 %   endfor
577 % else:
578 %   for x in DISK_NON_QEMU_FORMAT.values():
579                                 <option value="${x}">${x}</option>
580 %   endfor
581 % endif
582                             </select>
583                         </td>
584                     </tr>
585                 </table>
586             </div>
587         </div>
588
589         <div class="grayout-param">${_('Bus Type')}<span id="guest_bus_type_help"/></div>
590         <div class="grayout-value grayout-form">
591             <select name="bus_type">
592 % if "KVM" in hypervisors.keys():
593 %   for x in bus_types:
594 %       if x == "virtio":
595                 <option value="${x}" selected>${x}</option>
596 %       else:
597                 <option value="${x}">${x}</option>
598 %       endif
599 %   endfor
600 % else:
601 %   for x in bus_types:
602 %       if x == "xen":
603                 <option value="${x}" selected>${x}</option>
604 %       else:
605                 <option value="${x}">${x}</option>
606 %       endif
607 %   endfor
608 % endif
609             </select>
610         </div>
611
612         <div class="grayout-param">${_('Boot Image')}<span id="guest_boot_image_help"/></div>
613         <div class="grayout-value grayout-form">
614           <table width="100%">
615             <tr>
616               <td>
617               <input type="radio" name="boot_image" id="boot_image_kernel" value="kernel" checked  onChange="javascript:setDefaultValue()"/>
618               </td>
619               <td>
620               <table>
621                 <tr>
622                 <div class="grayout-value grayout-form" style="width:150px;">
623                 ${_('Kernel Image')}<span id="guest_kernel_help"/>
624                 </div>
625                 <td>
626                 <input type="text" id="vm_kernel" name="vm_kernel" value="" size="60" /><span class="require-text" id="vm_kernel_require_str">${_('Require')}</span>
627                 </td>
628                 </tr>
629                 <tr>
630                 <div class="grayout-value grayout-form" style="width:150px;">
631                 ${_('Initrd Image')}<span id="guest_initrd_help"/>
632                 </div>
633                 <td>
634                 <input type="text" id="vm_initrd" name="vm_initrd" value="" size="60" /><span class="require-text" id="vm_initrd_require_str">${_('Require')}</span>
635                 </td>
636                 </tr>
637               </table>
638               </td>
639             </tr>
640           </table>
641         </div>
642
643         <div id="boot_image_iso_html">
644         <div class="grayout-value grayout-form">
645           <table width="100%">
646             <tr>
647               <td>
648               <input type="radio" name="boot_image" id="boot_image_iso" value="iso"  onChange="javascript:setDefaultValue()"/>
649               </td>
650               <td>
651               <table>
652                 <tr>
653                 <div class="grayout-value grayout-form" style="width:150px;">
654                 ${_('ISO Image')}<span id="guest_iso_help"/>
655                 </div>
656                 <td>
657                 <input type="text" id="vm_iso" name="vm_iso" value="/git/iso/CentOS-5.4-x86_64-bin-DVD.iso" size="60" /><span class="require-text" id="vm_iso_require_str">${_('Require')}</span>
658                 </td>
659                 </tr>
660               </table>
661               </td>
662             </tr>
663           </table>
664         </div>
665         </div>
666
667         <div class="grayout-param">${_('VNC Keymap')}<span id="device_display_bootup_vnc_keymap_help" /></div>
668         <div class="grayout-value grayout-form">
669             <div id="select_keymap_html"></div>
670         </div>
671
672         <div class="grayout-param">${_('VNC Port Number')}<span id="guest_vnc_port_help"/></div>
673         <div class="grayout-value grayout-form">
674             <input type="text" id="vm_vncport" name="vm_vncport" value="${vnc_port | h}" size="6" maxlength="5" /><span class="require-text">${_('Require')}</span>
675         </div>
676
677         <div class="grayout-param">${_('Interface Type')}<span id="guest_interface_type_help" /></div>
678
679
680         <div class="grayout-value grayout-form">
681           <table width="100%">
682             <tr>
683               <td>
684               <input type="radio" name="nic_type" id="nic_type_phy" value="phydev" checked />
685               </td>
686               <td>
687               <table>
688                 <tr>
689                 <div class="grayout-value grayout-form" style="width:150px;">
690                 ${_('Physical Device')}<span id="guest_iso_help"/>
691                 </div>
692                 <td>
693                 <div id="select_phydev_html"></div>
694                 </td>
695                 </tr>
696               </table>
697               </td>
698             </tr>
699
700             <tr>
701               <td>
702               <input type="radio" name="nic_type" id="nic_type_vir" value="virnet" />
703               </td>
704               <td>
705               <table>
706                 <tr>
707                 <div class="grayout-value grayout-form" style="width:150px;">
708                 ${_('Virtual Network')}<span id="guest_iso_help"/>
709                 </div>
710                 <td>
711                 <div id="select_virnet_html"></div>
712                 </td>
713                 </tr>
714               </table>
715               </td>
716             </tr>
717
718           </table>
719         </div>
720
721         <div class="grayout-param">${_('MAC Address')}<span id="guest_mac_address_help"/></div>
722         <div class="grayout-value grayout-form">
723             <input type="text" id="vm_mac" name="vm_mac" value="" size="20" maxlength="17" /><span class="require-text">${_('Require')}</span>
724         </div>
725         <div class="grayout-param">${_('Extra Kernel Options')}<span id="guest_option_help"/></div>
726         <div class="grayout-value grayout-form">
727             <input type="text" id="vm_extra" name="vm_extra" value="" size="40" />
728         </div>
729         <div class="grayout-param">${_('Notebook')}</div>
730         <div class="grayout-value grayout-form">
731             <p>${_('Title')}</p>
732                 <input type="text" id="note_title" name="note_title" value="" size="40" maxlength="64" />
733             <p>${_('Note')}</p>
734                 <textarea id="note_value" name="note_value" cols="50" rows="5"></textarea>
735         </div>
736         <div class="grayout-param">${_('Tag')}<span id="guest_tag_help"/></div>
737         <div class="grayout-value grayout-form">
738             <input type="text" id="tags" name="tags" value="" size="40" />
739         </div>
740
741         <div class="grayout-footer">
742             <a href="#" name="input_guest_submit" id="input_guest_submit" class="button">
743                 <span class="button-left">&nbsp;</span><span class="button-right">${_('Create')}</span>
744             </a>
745             <br style="clear: both;"/>
746         </div>
747         <br style="clear: both;"/>
748     </div>
749 </div> 
750