OSDN Git Service

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