config_show.html 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751
  1. {% extends theme("layout.html") %}
  2. {% block head %}
  3. {{ super() }}
  4. <style type="text/css">
  5. @media (min-width: 768px) {
  6. .form-horizontal .control-label {
  7. text-align: left;
  8. }
  9. }
  10. label>span {
  11. color: deepskyblue;
  12. }
  13. #batch_change_disk_quota_form label {
  14. padding-left: 0;
  15. padding-right: 0;
  16. }
  17. .btn,
  18. .form-group>div>div,
  19. .form-control {
  20. border-radius: 0;
  21. }
  22. .bootstrap-switch-handle-on {
  23. border-top-left-radius: 0 !important;
  24. border-bottom-left-radius: 0 !important;
  25. }
  26. </style>
  27. {% endblock head %}
  28. {% block content %}
  29. <script>
  30. $(document).ready(function() {
  31. $('body').addClass('add-transition');
  32. $('.add-page-transition').on('click', function(){
  33. var transAttr = $(this).attr('data-transition');
  34. $('.add-transition').attr('class', 'add-transition');
  35. $('.add-transition').addClass(transAttr);
  36. });
  37. $('#storage_mode').on('changed.bs.select', function (me) {
  38. if ($('#storage_mode').val() == '2' || $('#storage_mode').val() == '3') {
  39. $('#dfs_volume_label').css('display', 'unset');
  40. $('#dfs_volume').css('display', 'unset');
  41. } else {
  42. $('#dfs_volume_label').css('display', 'none');
  43. $('#dfs_volume').css('display', 'none');
  44. }
  45. });
  46. register_iops_bps_event();
  47. refresh_ip_pools();
  48. $('input.input-switch[name="activity"]').on('switchChange.bootstrapSwitch', function(event, state) {
  49. console.log(this); // DOM element
  50. console.log(event); // jQuery event
  51. console.log(state); // true | false
  52. if (state) {
  53. put_ip_pool_activity($(this).data('id'));
  54. }
  55. });
  56. });
  57. function refresh() {
  58. window.location.reload();
  59. }
  60. function select_this(me) {
  61. $(me).parent().parent().children().removeClass('active');
  62. $(me).parent().addClass('active');
  63. $('#jimv_system_config, #quota, #ip_pool, #auxiliary').css('display', 'none');
  64. if (me.id === 'quota_label') {
  65. $('#quota').css('display', 'unset');
  66. } else if (me.id === 'ip_pool_label') {
  67. $('#ip_pool').css('display', 'unset');
  68. } else if (me.id === 'auxiliary_label') {
  69. $('#auxiliary').css('display', 'unset');
  70. } else {
  71. $('#jimv_system_config').css('display', 'unset');
  72. }
  73. }
  74. $(function() { "use strict";
  75. $("#iops_base").TouchSpin({
  76. max: 10000,
  77. min: 0,
  78. verticalbuttons: true,
  79. verticalupclass: 'glyph-icon icon-plus',
  80. verticaldownclass: 'glyph-icon icon-minus'
  81. });
  82. });
  83. $(function() { "use strict";
  84. $("#iops_pre_unit").TouchSpin({
  85. max: 100,
  86. min: 0,
  87. verticalbuttons: true,
  88. verticalupclass: 'glyph-icon icon-plus',
  89. verticaldownclass: 'glyph-icon icon-minus'
  90. });
  91. });
  92. $(function() { "use strict";
  93. $("#iops_cap").TouchSpin({
  94. max: 100000,
  95. min: 0,
  96. verticalbuttons: true,
  97. verticalupclass: 'glyph-icon icon-plus',
  98. verticaldownclass: 'glyph-icon icon-minus'
  99. });
  100. });
  101. $(function() { "use strict";
  102. $("#iops_max").TouchSpin({
  103. max: 200000,
  104. min: 0,
  105. verticalbuttons: true,
  106. verticalupclass: 'glyph-icon icon-plus',
  107. verticaldownclass: 'glyph-icon icon-minus'
  108. });
  109. });
  110. $(function() { "use strict";
  111. $("#iops_max_length").TouchSpin({
  112. max: 600,
  113. min: 0,
  114. postfix: '秒',
  115. verticalbuttons: true,
  116. verticalupclass: 'glyph-icon icon-plus',
  117. verticaldownclass: 'glyph-icon icon-minus'
  118. });
  119. });
  120. $(function() { "use strict";
  121. $("#bps_base").TouchSpin({
  122. max: 1024,
  123. min: 0,
  124. postfix: 'MiB',
  125. verticalbuttons: true,
  126. verticalupclass: 'glyph-icon icon-plus',
  127. verticaldownclass: 'glyph-icon icon-minus'
  128. });
  129. });
  130. $(function() { "use strict";
  131. $("#bps_pre_unit").TouchSpin({
  132. max: 10,
  133. min: 0,
  134. step: 0.01,
  135. decimals: 2,
  136. postfix: 'MiB',
  137. verticalbuttons: true,
  138. verticalupclass: 'glyph-icon icon-plus',
  139. verticaldownclass: 'glyph-icon icon-minus'
  140. });
  141. });
  142. $(function() { "use strict";
  143. $("#bps_cap").TouchSpin({
  144. max: 1024 * 2,
  145. min: 0,
  146. postfix: 'MiB',
  147. verticalbuttons: true,
  148. verticalupclass: 'glyph-icon icon-plus',
  149. verticaldownclass: 'glyph-icon icon-minus'
  150. });
  151. });
  152. $(function() { "use strict";
  153. $("#bps_max").TouchSpin({
  154. max: 1024 * 10,
  155. min: 0,
  156. postfix: 'MiB',
  157. verticalbuttons: true,
  158. verticalupclass: 'glyph-icon icon-plus',
  159. verticaldownclass: 'glyph-icon icon-minus'
  160. });
  161. });
  162. $(function() { "use strict";
  163. $("#bps_max_length").TouchSpin({
  164. max: 600,
  165. min: 0,
  166. postfix: '秒',
  167. verticalbuttons: true,
  168. verticalupclass: 'glyph-icon icon-plus',
  169. verticaldownclass: 'glyph-icon icon-minus'
  170. });
  171. });
  172. function register_iops_bps_event() {
  173. $('#iops').on('change', function () {
  174. $("#iops_rd").trigger("touchspin.updatesettings", {max: $('#iops').val() - $('#iops_wr').val()});
  175. $("#iops_wr").trigger("touchspin.updatesettings", {max: $('#iops').val() - $('#iops_rd').val()});
  176. });
  177. $('#iops_rd').on('change', function () {
  178. $("#iops_wr").trigger("touchspin.updatesettings", {max: $('#iops').val() - $('#iops_rd').val()});
  179. });
  180. $('#iops_wr').on('change', function () {
  181. $("#iops_rd").trigger("touchspin.updatesettings", {max: $('#iops').val() - $('#iops_wr').val()});
  182. });
  183. $('#bps').on('change', function () {
  184. $("#bps_rd").trigger("touchspin.updatesettings", {max: $('#bps').val() - $('#bps_wr').val()});
  185. $("#bps_wr").trigger("touchspin.updatesettings", {max: $('#bps').val() - $('#bps_rd').val()});
  186. });
  187. $('#bps_rd').on('change', function () {
  188. $("#bps_wr").trigger("touchspin.updatesettings", {max: $('#bps').val() - $('#bps_rd').val()});
  189. });
  190. $('#bps_wr').on('change', function () {
  191. $("#bps_rd").trigger("touchspin.updatesettings", {max: $('#bps').val() - $('#bps_wr').val()});
  192. });
  193. }
  194. function update_quota() {
  195. $.ajax({
  196. url : '/api/config/_quota',
  197. type : 'PATCH',
  198. contentType: "application/json; charset=utf-8",
  199. data : JSON.stringify({
  200. iops_base: parseInt($('#iops_base').val()),
  201. iops_pre_unit: parseInt($('#iops_pre_unit').val()),
  202. iops_cap: parseInt($('#iops_cap').val()),
  203. iops_max: parseInt($('#iops_max').val()),
  204. iops_max_length: parseInt($('#iops_max_length').val()),
  205. bps_base: parseInt($('#bps_base').val()) * 1024 * 1024,
  206. bps_pre_unit: parseFloat($('#bps_pre_unit').val()) * 1024 * 1024,
  207. bps_cap: parseInt($('#bps_cap').val()) * 1024 * 1024,
  208. bps_max: parseInt($('#bps_max').val()) * 1024 * 1024,
  209. bps_max_length: parseInt($('#bps_max_length').val()),
  210. influence_current_guest: $('#influence_current_guest').prop('checked')
  211. }),
  212. error : function() {
  213. alter_danger('性能配额更新失败!');
  214. },
  215. success : function() {
  216. alter_success('性能配额更新成功!');
  217. setTimeout(function() {
  218. refresh();
  219. }, 1000);
  220. }
  221. });
  222. }
  223. function refresh_guest_state() {
  224. $.ajax({
  225. url : '/api/guests/_refresh_guest_state',
  226. type : 'PATCH',
  227. error : function() {
  228. alter_danger('刷新虚拟机状态失败!');
  229. },
  230. success : function() {
  231. alter_success('刷新虚拟机状态成功!');
  232. setTimeout(function() {
  233. refresh();
  234. }, 1000);
  235. }
  236. });
  237. }
  238. function exchange_ip_pool_for_panel(ip_pool) {
  239. var activity_checked = '';
  240. if (ip_pool.activity > 0) {
  241. activity_checked = 'checked';
  242. }
  243. return '<div class="panel">\n' +
  244. ' <div class="panel-body">\n' +
  245. ' <form class="form-horizontal bordered-row" style="padding-left: 8%;">\n' +
  246. ' <input title="IP Pool ID" class="form-control" name="id" type="text" value="' + ip_pool.id + '" hidden>\n' +
  247. ' <div class="form-group">\n' +
  248. ' <label class="col-sm-2 control-label">起始 IP</label>\n' +
  249. ' <div class="col-sm-3">\n' +
  250. ' <input title="起始 IP" class="form-control" name="start_ip" type="text" value="' + ip_pool.start_ip + '">\n' +
  251. ' </div>\n' +
  252. ' <label class="col-sm-2 control-label">截止 IP</label>\n' +
  253. ' <div class="col-sm-3">\n' +
  254. ' <input title="截止 IP" class="form-control" name="end_ip" type="text" value="' + ip_pool.end_ip + '">\n' +
  255. ' </div>\n' +
  256. ' </div>\n' +
  257. ' <div class="form-group">\n' +
  258. ' <label class="col-sm-2 control-label">子网掩码</label>\n' +
  259. ' <div class="col-sm-3">\n' +
  260. ' <input title="子网掩码" class="form-control" name="netmask" type="text" value="' + ip_pool.netmask + '">\n' +
  261. ' </div>\n' +
  262. ' <label class="col-sm-2 control-label">网关</label>\n' +
  263. ' <div class="col-sm-3">\n' +
  264. ' <input title="网关" class="form-control" name="gateway" type="text" value="' + ip_pool.gateway + '">\n' +
  265. ' </div>\n' +
  266. ' </div>\n' +
  267. ' <div class="form-group">\n' +
  268. ' <label class="col-sm-2 control-label">DNS1</label>\n' +
  269. ' <div class="col-sm-3">\n' +
  270. ' <input title="DNS1" class="form-control" name="dns1" type="text" value="' + ip_pool.dns1 + '">\n' +
  271. ' </div>\n' +
  272. ' <label class="col-sm-2 control-label">DNS2</label>\n' +
  273. ' <div class="col-sm-3">\n' +
  274. ' <input title="DNS2" class="form-control" name="dns2" type="text" value="' + ip_pool.dns2 + '">\n' +
  275. ' </div>\n' +
  276. ' </div>\n' +
  277. ' <div class="form-group">\n' +
  278. ' <label class="col-sm-2 control-label">名称</label>\n' +
  279. ' <div class="col-sm-3">\n' +
  280. ' <input title="名称" class="form-control" name="name" type="text" value="' + ip_pool.name + '">\n' +
  281. ' </div>\n' +
  282. ' <label class="col-sm-2 control-label">备注</label>\n' +
  283. ' <div class="col-sm-3">\n' +
  284. ' <textarea title="备注" class="form-control" name="description">'+ip_pool.description+'</textarea>\n' +
  285. ' </div>\n' +
  286. ' </div>\n' +
  287. ' <div class="form-group" style="margin-bottom: 0;">\n' +
  288. ' <div class="col-sm-6">\n' +
  289. ' <input type="checkbox" name="activity" data-on-color="info" class="input-switch" data-id="' + ip_pool.id + '" ' + activity_checked + ' data-size="medium" data-on-text="活跃" data-off-text="非活跃">\n' +
  290. ' </div>\n' +
  291. ' <div class="col-sm-6">\n' +
  292. ' <div style="padding: 0; text-align: right;">\n' +
  293. ' <button type="button" class="btn btn-sm btn-primary" style="right: 10%;" data-id="' + ip_pool.id + '" onclick="update_ip_pool(this);">更新</button>\n' +
  294. ' <button type="button" class="btn btn-sm btn-danger" style="right: 4%;" data-toggle="modal" data-target="#ip_pool_delete_modal" onclick="$(\'#ip_pool_id\').val(get_ip_pool_field_value(this, \'id\'));\n' +
  295. ' $(\'#delete_instance_desc\').text(get_ip_pool_field_value(this, \'name\'))">删除</button>\n' +
  296. ' </div>\n' +
  297. ' </div>\n' +
  298. ' </div>\n' +
  299. ' </form>\n' +
  300. ' </div>\n' +
  301. '</div>';
  302. }
  303. function get_ip_pools_html() {
  304. var html = '<div class="row" style="padding: 10px 10px 10px 0; width: 100%;">\n' +
  305. ' <div class="col-sm-12" style="padding-right: 0;">\n' +
  306. ' <div class="pull-right">\n' +
  307. ' <button class="btn btn-default" onclick="window.location.reload();" style="border-radius: 0;"><span class="glyph-icon icon-elusive-arrows-cw"></span></button>\n' +
  308. ' <a class="btn btn-info" href="javascript:;" data-toggle="modal" data-target="#add_ip_pool_modal" style="border-radius: 0; padding-left: 40px; padding-right: 40px;">添加 IP 池</a>\n' +
  309. ' </div>\n' +
  310. ' </div>\n' +
  311. '</div>';
  312. $.ajax({
  313. url : '/api/ip_pools',
  314. type : 'GET',
  315. contentType: "application/json; charset=utf-8",
  316. dataType: 'json',
  317. async: false,
  318. error : function() {
  319. },
  320. success : function(data, textStatus, xhr) {
  321. $.each(data.data, function(k, v) {
  322. html += exchange_ip_pool_for_panel(v);
  323. });
  324. }
  325. });
  326. return html
  327. }
  328. function refresh_ip_pools() {
  329. var html = get_ip_pools_html();
  330. $('#ip_pool').append(html);
  331. }
  332. function get_ip_pool_field_value(me, name) {
  333. return $(me).parent().parent().parent().parent().serializeArray().filter(
  334. function(field) {return field.name == name})[0].value;
  335. }
  336. function update_ip_pool(me) {
  337. var id = get_ip_pool_field_value(me, 'id');
  338. var start_ip = get_ip_pool_field_value(me, 'start_ip');
  339. var end_ip = get_ip_pool_field_value(me, 'end_ip');
  340. var netmask = get_ip_pool_field_value(me, 'netmask');
  341. var gateway = get_ip_pool_field_value(me, 'gateway');
  342. var dns1 = get_ip_pool_field_value(me, 'dns1');
  343. var dns2 = get_ip_pool_field_value(me, 'dns2');
  344. var name = get_ip_pool_field_value(me, 'name');
  345. var description = get_ip_pool_field_value(me, 'description');
  346. var data = {
  347. start_ip: start_ip,
  348. end_ip: end_ip,
  349. netmask: netmask,
  350. gateway: gateway,
  351. dns1: dns1,
  352. dns2: dns2,
  353. name: name,
  354. description: description
  355. };
  356. $.ajax({
  357. url : '/api/ip_pools/' + String(id),
  358. type : 'PATCH',
  359. contentType: "application/json; charset=utf-8",
  360. async: false,
  361. dataType: "json",
  362. data : JSON.stringify(data),
  363. error : function(data, textStatus, xhr) {
  364. alter_danger(data.responseText);
  365. alter_warning('更新 IP 池失败!');
  366. },
  367. success : function(data, textStatus, xhr) {
  368. alter_success('更新 IP 池成功!');
  369. }
  370. });
  371. setTimeout(function() {
  372. window.location.reload();
  373. }, 3000);
  374. }
  375. function create_ip_pool(me) {
  376. $('#add_ip_pool_modal').modal('hide');
  377. var start_ip = get_ip_pool_field_value(me, 'start_ip');
  378. var end_ip = get_ip_pool_field_value(me, 'end_ip');
  379. var netmask = get_ip_pool_field_value(me, 'netmask');
  380. var gateway = get_ip_pool_field_value(me, 'gateway');
  381. var dns1 = get_ip_pool_field_value(me, 'dns1');
  382. var dns2 = get_ip_pool_field_value(me, 'dns2');
  383. var name = get_ip_pool_field_value(me, 'name');
  384. var description = get_ip_pool_field_value(me, 'description');
  385. var activity = $('#activity').prop('checked');
  386. var data = {
  387. start_ip: start_ip,
  388. end_ip: end_ip,
  389. netmask: netmask,
  390. gateway: gateway,
  391. dns1: dns1,
  392. dns2: dns2,
  393. name: name,
  394. description: description,
  395. activity: activity
  396. };
  397. $.ajax({
  398. url : '/api/ip_pool',
  399. type : 'POST',
  400. contentType: "application/json; charset=utf-8",
  401. async: false,
  402. dataType: "json",
  403. data : JSON.stringify(data),
  404. error : function(data, textStatus, xhr) {
  405. alter_danger(data.responseText);
  406. alter_warning('添加 IP 池失败!');
  407. },
  408. success : function(data, textStatus, xhr) {
  409. alter_success('您所提交的 IP 池已创建。页面将在3秒钟后自动跳转到 IP 池列表页面!');
  410. }
  411. });
  412. setTimeout(function() {
  413. window.location.reload();
  414. }, 3000);
  415. }
  416. function put_ip_pool_activity(id) {
  417. $.ajax({
  418. url : '/api/ip_pool/' + String(id),
  419. type : 'PUT',
  420. async: false,
  421. dataType: "json",
  422. error : function(data, textStatus, xhr) {
  423. alter_danger(data.responseText);
  424. alter_warning('IP 池激活失败!');
  425. },
  426. success : function(data, textStatus, xhr) {
  427. alter_success('IP 池激活成功!');
  428. }
  429. });
  430. setTimeout(function() {
  431. window.location.reload();
  432. }, 3000);
  433. }
  434. function ip_pool_delete_at(me) {
  435. var ip_pool_id = $('#ip_pool_id').val();
  436. ip_pool_remove(ip_pool_id);
  437. $('#ip_pool_delete_modal').modal('hide');
  438. }
  439. function ip_pool_remove(id) {
  440. $.ajax({
  441. url : '/api/ip_pools/' + id,
  442. type : 'DELETE',
  443. contentType: "application/json; charset=utf-8",
  444. error : function() {
  445. alter_danger('IP 池删除指令发送失败!');
  446. },
  447. success : function() {
  448. alter_success('IP 池删除指令发送成功!');
  449. setTimeout(function() {
  450. refresh();
  451. }, 1000);
  452. }
  453. });
  454. }
  455. </script>
  456. <div class="panel">
  457. <div class="panel-body">
  458. <ul class="nav nav-tabs mrg25B">
  459. <li class="active"><a href="javascript:;" onclick="select_this(this);" id="jimv_system_config_label">JimV 系统配置</a></li>
  460. <li><a href="javascript:;" onclick="select_this(this);" id="ip_pool_label">IP 池</a></li>
  461. <li><a href="javascript:;" onclick="select_this(this);" id="quota_label">性能配额</a></li>
  462. <li><a href="javascript:;" onclick="select_this(this);" id="auxiliary_label">辅助</a></li>
  463. </ul>
  464. <div id="jimv_system_config" class="example-box-wrapper">
  465. <form class="form-horizontal bordered-row" style="padding-left: 8%;">
  466. <div class="form-group">
  467. <label class="col-sm-2 control-label">网桥(业务网络)</label>
  468. <div class="col-sm-3">
  469. <input title="Guest 业务网络" class="form-control" name="vm_network" type="text" disabled value="{{ config.vm_network }}">
  470. </div>
  471. <label class="col-sm-2 control-label">网桥(管理网络)</label>
  472. <div class="col-sm-3">
  473. <input title="Guest 管理网络" class="form-control" name="vm_manage_network" type="text" disabled value="{{ config.vm_manage_network }}">
  474. </div>
  475. </div>
  476. <div class="form-group">
  477. <label class="col-sm-2 control-label">虚拟机磁盘存储模式</label>
  478. <div class="col-sm-3">
  479. <select id="storage_mode" title="虚拟机磁盘存储模式" class="selectpicker" name="storage_mode" data-width="100%" disabled>
  480. <option {% if config.storage_mode == 0 %}selected{% endif %} value="0">本地存储</option>
  481. <option {% if config.storage_mode == 1 %}selected{% endif %} value="1" data-subtext="NFS">挂载共享</option>
  482. <option {% if config.storage_mode == 2 %}selected{% endif %} value="2">Ceph</option>
  483. <option {% if config.storage_mode == 3 %}selected{% endif %} value="3">GlusterFS</option>
  484. </select>
  485. </div>
  486. <label id="dfs_volume_label" class="col-sm-2 control-label" style="display: {% if config.storage_mode in [3] %}unset{% else %}none{% endif %};">分布式文件系统存储卷</label>
  487. <div class="col-sm-3">
  488. <input id="dfs_volume" title="分布式文件系统存储卷" class="form-control" name="dfs_volume" type="text" style="display: {% if config.storage_mode in [3] %}unset{% else %}none{% endif %};" disabled value="{{ config.dfs_volume }}">
  489. </div>
  490. </div>
  491. <div class="form-group">
  492. <label class="col-sm-2 control-label">虚拟机磁盘存放路径</label>
  493. <div class="col-sm-3">
  494. <input title="虚拟机磁盘存放路径" class="form-control" name="storage_path" type="text" disabled value="{{ config.storage_path }}">
  495. </div>
  496. </div>
  497. </form>
  498. </div>
  499. <div id="quota" class="example-box-wrapper" style="display: none;">
  500. <form class="form-horizontal bordered-row" style="padding-left: 8%;">
  501. <div class="form-group" style="margin-bottom: 0;">
  502. <label class="col-sm-2 control-label">
  503. <span class="glyph-icon icon-exchange" style="transform: rotate(90deg); display: inline-flex;"></span>
  504. &nbsp;&nbsp;IOPS 基准值
  505. </label>
  506. <div class="col-sm-3">
  507. <input id="iops_base" title="IOPS 基准值" class="form-control" type="text" value="{{ config.iops_base }}" name="iops_base">
  508. </div>
  509. <span class="col-sm-1"></span>
  510. <label class="col-sm-2 control-label"><span class="glyph-icon icon-openid"></span>&nbsp;&nbsp;BPS 基准值</label>
  511. <div class="col-sm-3">
  512. <input id="bps_base" title="BPS 基准值" class="form-control" type="text" value="{{ (config.bps_base / 1024 / 1024) | int }}" name="bps_base">
  513. </div>
  514. <span class="col-sm-1"></span>
  515. </div>
  516. <div class="form-group" style="margin-bottom: 0;">
  517. <label class="col-sm-2 control-label">
  518. <span class="glyph-icon icon-exchange" style="transform: rotate(90deg); display: inline-flex;"></span>
  519. &nbsp;&nbsp;IOPS/GiB 增益
  520. </label>
  521. <div class="col-sm-3">
  522. <input id="iops_pre_unit" title="IOPS/GiB 增益" class="form-control" type="text" value="{{ config.iops_pre_unit }}" name="iops_pre_unit">
  523. </div>
  524. <span class="col-sm-1"></span>
  525. <label class="col-sm-2 control-label"><span class="glyph-icon icon-openid"></span>&nbsp;&nbsp;BPS/GiB 增益</label>
  526. <div class="col-sm-3">
  527. <input id="bps_pre_unit" title="BPS/GiB 增益 (MiB)" class="form-control" type="text" value="{{ '%0.2f'|format(config.bps_pre_unit / 1024 / 1024) }}" name="bps_pre_unit">
  528. </div>
  529. <span class="col-sm-1"></span>
  530. </div>
  531. <div class="form-group" style="margin-bottom: 0;">
  532. <label class="col-sm-2 control-label">
  533. <span class="glyph-icon icon-exchange" style="transform: rotate(90deg); display: inline-flex;"></span>
  534. &nbsp;&nbsp;IOPS 增益上限
  535. </label>
  536. <div class="col-sm-3">
  537. <input id="iops_cap" title="IOPS 增益上限" class="form-control" type="text" value="{{ config.iops_cap }}" name="iops_cap">
  538. </div>
  539. <span class="col-sm-1"></span>
  540. <label class="col-sm-2 control-label"><span class="glyph-icon icon-openid"></span>&nbsp;&nbsp;BPS 增益上限</label>
  541. <div class="col-sm-3">
  542. <input id="bps_cap" title="BPS 增益上限 (MiB)" class="form-control" type="text" value="{{ (config.bps_cap / 1024 / 1024) | int }}" name="bps_cap">
  543. </div>
  544. <span class="col-sm-1"></span>
  545. </div>
  546. <div class="form-group" style="margin-bottom: 0;">
  547. <label class="col-sm-2 control-label">
  548. <span class="glyph-icon icon-exchange" style="transform: rotate(90deg); display: inline-flex;"></span>
  549. <span class="glyph-icon icon-bitbucket" style="margin-left: -4px;"></span>
  550. &nbsp;&nbsp;IOPS 桶宽
  551. </label>
  552. <div class="col-sm-3">
  553. <input id="iops_max" title="IOPS 桶宽" class="form-control" type="text" value="{{ config.iops_max }}" name="iops_max">
  554. </div>
  555. <span class="col-sm-1"></span>
  556. <label class="col-sm-2 control-label"><span class="glyph-icon icon-openid"></span><span class="glyph-icon icon-bitbucket"></span>&nbsp;&nbsp;BPS 桶宽</label>
  557. <div class="col-sm-3">
  558. <input id="bps_max" title="BPS 桶宽 (MiB)" class="form-control" type="text" value="{{ (config.bps_max / 1024 / 1024) | int }}" name="bps_max">
  559. </div>
  560. <span class="col-sm-1"></span>
  561. </div>
  562. <div class="form-group" style="margin-bottom: 0;">
  563. <label class="col-sm-2 control-label">
  564. <span class="glyph-icon icon-exchange" style="transform: rotate(90deg); display: inline-flex;"></span>
  565. <span class="glyph-icon icon-bitbucket" style="margin-left: -4px;"></span>
  566. &nbsp;&nbsp;IOPS 桶高
  567. </label>
  568. <div class="col-sm-3">
  569. <input id="iops_max_length" title="IOPS 桶高 (秒)" class="form-control" type="text" value="{{ config.iops_max_length }}" name="iops_max_length">
  570. </div>
  571. <span class="col-sm-1"></span>
  572. <label class="col-sm-2 control-label"><span class="glyph-icon icon-openid"></span><span class="glyph-icon icon-bitbucket"></span>&nbsp;&nbsp;BPS 桶高</label>
  573. <div class="col-sm-3">
  574. <input id="bps_max_length" title="BPS 桶高 (秒)" class="form-control" type="text" value="{{ config.bps_max_length }}" name="bps_max_length">
  575. </div>
  576. <span class="col-sm-1"></span>
  577. </div>
  578. <div class="form-group" style="margin-bottom: 0;">
  579. <div class="col-sm-6">
  580. <label>
  581. <input id="influence_current_guest" type="checkbox" name="influence_current_guest">
  582. 同时更新已存在的实例
  583. </label>
  584. </div>
  585. <div class="col-sm-6">
  586. <div style="padding: 0; text-align: right;">
  587. <button type="button" class="btn btn-sm btn-primary" style="right: 10%;" onclick="update_quota();">更新</button>
  588. </div>
  589. </div>
  590. </div>
  591. </form>
  592. </div>
  593. <div id="ip_pool" class="example-box-wrapper" style="display: none;">
  594. </div>
  595. <div id="auxiliary" class="example-box-wrapper" style="display: none;">
  596. <form class="form-horizontal bordered-row" style="padding-left: 8%;">
  597. <div class="form-group" style="margin-bottom: 0;">
  598. <div class="col-sm-3">
  599. <button type="button" class="btn btn-primary" onclick="refresh_guest_state();">刷新虚拟机状态</button>
  600. </div>
  601. </div>
  602. </form>
  603. </div>
  604. </div>
  605. </div>
  606. <input id="ip_pool_id" title="IP Pool ID" class="form-control" name="ip_pool_id" hidden>
  607. <div class="modal" id="add_ip_pool_modal" tabindex="-1" role="dialog" style="margin-top: 100px;">
  608. <div class="modal-dialog modal-lg">
  609. <div class="modal-content">
  610. <div class="modal-header">
  611. <h4 class="modal-title">添加 IP 池:</h4>
  612. </div>
  613. <div class="panel">
  614. <div class="panel-body">
  615. <form class="form-horizontal bordered-row" style="padding-left: 16%;">
  616. <div class="form-group">
  617. <label class="col-sm-2 control-label">起始 IP</label>
  618. <div class="col-sm-3">
  619. <input title="起始 IP" class="form-control" name="start_ip" type="text">
  620. </div>
  621. <label class="col-sm-2 control-label">截止 IP</label>
  622. <div class="col-sm-3">
  623. <input title="截止 IP" class="form-control" name="end_ip" type="text">
  624. </div>
  625. </div>
  626. <div class="form-group">
  627. <label class="col-sm-2 control-label">子网掩码</label>
  628. <div class="col-sm-3">
  629. <input title="子网掩码" class="form-control" name="netmask" type="text">
  630. </div>
  631. <label class="col-sm-2 control-label">网关</label>
  632. <div class="col-sm-3">
  633. <input title="网关" class="form-control" name="gateway" type="text">
  634. </div>
  635. </div>
  636. <div class="form-group">
  637. <label class="col-sm-2 control-label">DNS1</label>
  638. <div class="col-sm-3">
  639. <input title="DNS1" class="form-control" name="dns1" type="text">
  640. </div>
  641. <label class="col-sm-2 control-label">DNS2</label>
  642. <div class="col-sm-3">
  643. <input title="DNS2" class="form-control" name="dns2" type="text">
  644. </div>
  645. </div>
  646. <div class="form-group">
  647. <label class="col-sm-2 control-label">名称</label>
  648. <div class="col-sm-3">
  649. <input title="名称" class="form-control" name="name" type="text">
  650. </div>
  651. <label class="col-sm-2 control-label">备注</label>
  652. <div class="col-sm-3">
  653. <textarea title="备注" class="form-control" name="description"></textarea>
  654. </div>
  655. </div>
  656. <div class="form-group" style="margin-bottom: 0;">
  657. <div class="col-sm-6">
  658. <div class="checkbox checkbox-info">
  659. <label>
  660. <input id="activity" name="activity" type="checkbox" checked class="custom-checkbox">
  661. 设为默认
  662. </label>
  663. </div>
  664. </div>
  665. <div class="col-sm-6">
  666. <div style="padding: 0; text-align: right;">
  667. <button type="button" class="btn btn-sm btn-primary" style="right: 20%;" onclick="create_ip_pool(this);">创建</button>
  668. <button type="button" class="btn btn-sm btn-default" style="right: 10%;" data-dismiss="modal">取消</button>
  669. </div>
  670. </div>
  671. </div>
  672. </form>
  673. </div>
  674. </div>
  675. </div>
  676. </div>
  677. </div>
  678. <div class="modal" id="ip_pool_delete_modal" tabindex="-1" role="dialog" style="margin-top: 100px;">
  679. <div class="modal-dialog">
  680. <div class="modal-content">
  681. <div class="modal-header">
  682. <h4 class="modal-title">删除 IP 池:</h4>
  683. </div>
  684. <div class="modal-body">
  685. <p>您确定要删除该 IP 池吗?</p>
  686. <h3 style="color: orangered;" id="delete_instance_desc"></h3>
  687. </div>
  688. <div class="modal-footer">
  689. <button type="button" class="btn btn-sm btn-primary" onclick="ip_pool_delete_at();">确定</button>
  690. <button type="button" class="btn btn-sm btn-default" data-dismiss="modal">取消</button>
  691. </div>
  692. </div>
  693. </div>
  694. </div>
  695. {% endblock content %}