config_show.html 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708
  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%;" onclick="delete_ip_pool(this);">删除</button>\n' +
  295. ' </div>\n' +
  296. ' </div>\n' +
  297. ' </div>\n' +
  298. ' </form>\n' +
  299. ' </div>\n' +
  300. '</div>';
  301. }
  302. function get_ip_pools_html() {
  303. var html = '<div class="row" style="padding: 10px 10px 10px 0; width: 100%;">\n' +
  304. ' <div class="col-sm-12" style="padding-right: 0;">\n' +
  305. ' <div class="pull-right">\n' +
  306. ' <button class="btn btn-default" onclick="window.location.reload();" style="border-radius: 0;"><span class="glyph-icon icon-elusive-arrows-cw"></span></button>\n' +
  307. ' <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' +
  308. ' </div>\n' +
  309. ' </div>\n' +
  310. '</div>';
  311. $.ajax({
  312. url : '/api/ip_pools',
  313. type : 'GET',
  314. contentType: "application/json; charset=utf-8",
  315. dataType: 'json',
  316. async: false,
  317. error : function() {
  318. },
  319. success : function(data, textStatus, xhr) {
  320. $.each(data.data, function(k, v) {
  321. html += exchange_ip_pool_for_panel(v);
  322. });
  323. }
  324. });
  325. return html
  326. }
  327. function refresh_ip_pools() {
  328. var html = get_ip_pools_html();
  329. $('#ip_pool').append(html);
  330. }
  331. function get_ip_pool_field_value(me, name) {
  332. return $(me).parent().parent().parent().parent().serializeArray().filter(
  333. function(field) {return field.name == name})[0].value;
  334. }
  335. function update_ip_pool(me) {
  336. var id = get_ip_pool_field_value(me, 'id');
  337. var start_ip = get_ip_pool_field_value(me, 'start_ip');
  338. var end_ip = get_ip_pool_field_value(me, 'end_ip');
  339. var netmask = get_ip_pool_field_value(me, 'netmask');
  340. var gateway = get_ip_pool_field_value(me, 'gateway');
  341. var dns1 = get_ip_pool_field_value(me, 'dns1');
  342. var dns2 = get_ip_pool_field_value(me, 'dns2');
  343. var name = get_ip_pool_field_value(me, 'name');
  344. var description = get_ip_pool_field_value(me, 'description');
  345. var data = {
  346. start_ip: start_ip,
  347. end_ip: end_ip,
  348. netmask: netmask,
  349. gateway: gateway,
  350. dns1: dns1,
  351. dns2: dns2,
  352. name: name,
  353. description: description
  354. };
  355. $.ajax({
  356. url : '/api/ip_pools/' + String(id),
  357. type : 'PATCH',
  358. contentType: "application/json; charset=utf-8",
  359. async: false,
  360. dataType: "json",
  361. data : JSON.stringify(data),
  362. error : function(data, textStatus, xhr) {
  363. alter_danger(data.responseText);
  364. alter_warning('更新 IP 池失败!');
  365. },
  366. success : function(data, textStatus, xhr) {
  367. alter_success('更新 IP 池成功!');
  368. }
  369. });
  370. setTimeout(function() {
  371. window.location.reload();
  372. }, 3000);
  373. }
  374. function create_ip_pool(me) {
  375. $('#add_ip_pool_modal').modal('hide');
  376. var start_ip = get_ip_pool_field_value(me, 'start_ip');
  377. var end_ip = get_ip_pool_field_value(me, 'end_ip');
  378. var netmask = get_ip_pool_field_value(me, 'netmask');
  379. var gateway = get_ip_pool_field_value(me, 'gateway');
  380. var dns1 = get_ip_pool_field_value(me, 'dns1');
  381. var dns2 = get_ip_pool_field_value(me, 'dns2');
  382. var name = get_ip_pool_field_value(me, 'name');
  383. var description = get_ip_pool_field_value(me, 'description');
  384. var activity = $('#activity').prop('checked');
  385. var data = {
  386. start_ip: start_ip,
  387. end_ip: end_ip,
  388. netmask: netmask,
  389. gateway: gateway,
  390. dns1: dns1,
  391. dns2: dns2,
  392. name: name,
  393. description: description,
  394. activity: activity
  395. };
  396. $.ajax({
  397. url : '/api/ip_pool',
  398. type : 'POST',
  399. contentType: "application/json; charset=utf-8",
  400. async: false,
  401. dataType: "json",
  402. data : JSON.stringify(data),
  403. error : function(data, textStatus, xhr) {
  404. alter_danger(data.responseText);
  405. alter_warning('添加 IP 池失败!');
  406. },
  407. success : function(data, textStatus, xhr) {
  408. alter_success('您所提交的 IP 池已创建。页面将在3秒钟后自动跳转到 IP 池列表页面!');
  409. }
  410. });
  411. setTimeout(function() {
  412. window.location.reload();
  413. }, 3000);
  414. }
  415. function put_ip_pool_activity(id) {
  416. $.ajax({
  417. url : '/api/ip_pool/' + String(id),
  418. type : 'PUT',
  419. async: false,
  420. dataType: "json",
  421. error : function(data, textStatus, xhr) {
  422. alter_danger(data.responseText);
  423. alter_warning('IP 池激活失败!');
  424. },
  425. success : function(data, textStatus, xhr) {
  426. alter_success('IP 池激活成功!');
  427. }
  428. });
  429. setTimeout(function() {
  430. window.location.reload();
  431. }, 3000);
  432. }
  433. </script>
  434. <div class="panel">
  435. <div class="panel-body">
  436. <ul class="nav nav-tabs mrg25B">
  437. <li class="active"><a href="javascript:;" onclick="select_this(this);" id="jimv_system_config_label">JimV 系统配置</a></li>
  438. <li><a href="javascript:;" onclick="select_this(this);" id="ip_pool_label">IP 池</a></li>
  439. <li><a href="javascript:;" onclick="select_this(this);" id="quota_label">性能配额</a></li>
  440. <li><a href="javascript:;" onclick="select_this(this);" id="auxiliary_label">辅助</a></li>
  441. </ul>
  442. <div id="jimv_system_config" class="example-box-wrapper">
  443. <form class="form-horizontal bordered-row" style="padding-left: 8%;">
  444. <div class="form-group">
  445. <label class="col-sm-2 control-label">网桥(业务网络)</label>
  446. <div class="col-sm-3">
  447. <input title="Guest 业务网络" class="form-control" name="vm_network" type="text" disabled value="{{ config.vm_network }}">
  448. </div>
  449. <label class="col-sm-2 control-label">网桥(管理网络)</label>
  450. <div class="col-sm-3">
  451. <input title="Guest 管理网络" class="form-control" name="vm_manage_network" type="text" disabled value="{{ config.vm_manage_network }}">
  452. </div>
  453. </div>
  454. <div class="form-group">
  455. <label class="col-sm-2 control-label">虚拟机磁盘存储模式</label>
  456. <div class="col-sm-3">
  457. <select id="storage_mode" title="虚拟机磁盘存储模式" class="selectpicker" name="storage_mode" data-width="100%" disabled>
  458. <option {% if config.storage_mode == 0 %}selected{% endif %} value="0">本地存储</option>
  459. <option {% if config.storage_mode == 1 %}selected{% endif %} value="1" data-subtext="NFS">挂载共享</option>
  460. <option {% if config.storage_mode == 2 %}selected{% endif %} value="2">Ceph</option>
  461. <option {% if config.storage_mode == 3 %}selected{% endif %} value="3">GlusterFS</option>
  462. </select>
  463. </div>
  464. <label id="dfs_volume_label" class="col-sm-2 control-label" style="display: {% if config.storage_mode in [3] %}unset{% else %}none{% endif %};">分布式文件系统存储卷</label>
  465. <div class="col-sm-3">
  466. <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 }}">
  467. </div>
  468. </div>
  469. <div class="form-group">
  470. <label class="col-sm-2 control-label">虚拟机磁盘存放路径</label>
  471. <div class="col-sm-3">
  472. <input title="虚拟机磁盘存放路径" class="form-control" name="storage_path" type="text" disabled value="{{ config.storage_path }}">
  473. </div>
  474. </div>
  475. </form>
  476. </div>
  477. <div id="quota" class="example-box-wrapper" style="display: none;">
  478. <form class="form-horizontal bordered-row" style="padding-left: 8%;">
  479. <div class="form-group" style="margin-bottom: 0;">
  480. <label class="col-sm-2 control-label">
  481. <span class="glyph-icon icon-exchange" style="transform: rotate(90deg); display: inline-flex;"></span>
  482. &nbsp;&nbsp;IOPS 基准值
  483. </label>
  484. <div class="col-sm-3">
  485. <input id="iops_base" title="IOPS 基准值" class="form-control" type="text" value="{{ config.iops_base }}" name="iops_base">
  486. </div>
  487. <span class="col-sm-1"></span>
  488. <label class="col-sm-2 control-label"><span class="glyph-icon icon-openid"></span>&nbsp;&nbsp;BPS 基准值</label>
  489. <div class="col-sm-3">
  490. <input id="bps_base" title="BPS 基准值" class="form-control" type="text" value="{{ (config.bps_base / 1024 / 1024) | int }}" name="bps_base">
  491. </div>
  492. <span class="col-sm-1"></span>
  493. </div>
  494. <div class="form-group" style="margin-bottom: 0;">
  495. <label class="col-sm-2 control-label">
  496. <span class="glyph-icon icon-exchange" style="transform: rotate(90deg); display: inline-flex;"></span>
  497. &nbsp;&nbsp;IOPS/GiB 增益
  498. </label>
  499. <div class="col-sm-3">
  500. <input id="iops_pre_unit" title="IOPS/GiB 增益" class="form-control" type="text" value="{{ config.iops_pre_unit }}" name="iops_pre_unit">
  501. </div>
  502. <span class="col-sm-1"></span>
  503. <label class="col-sm-2 control-label"><span class="glyph-icon icon-openid"></span>&nbsp;&nbsp;BPS/GiB 增益</label>
  504. <div class="col-sm-3">
  505. <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">
  506. </div>
  507. <span class="col-sm-1"></span>
  508. </div>
  509. <div class="form-group" style="margin-bottom: 0;">
  510. <label class="col-sm-2 control-label">
  511. <span class="glyph-icon icon-exchange" style="transform: rotate(90deg); display: inline-flex;"></span>
  512. &nbsp;&nbsp;IOPS 增益上限
  513. </label>
  514. <div class="col-sm-3">
  515. <input id="iops_cap" title="IOPS 增益上限" class="form-control" type="text" value="{{ config.iops_cap }}" name="iops_cap">
  516. </div>
  517. <span class="col-sm-1"></span>
  518. <label class="col-sm-2 control-label"><span class="glyph-icon icon-openid"></span>&nbsp;&nbsp;BPS 增益上限</label>
  519. <div class="col-sm-3">
  520. <input id="bps_cap" title="BPS 增益上限 (MiB)" class="form-control" type="text" value="{{ (config.bps_cap / 1024 / 1024) | int }}" name="bps_cap">
  521. </div>
  522. <span class="col-sm-1"></span>
  523. </div>
  524. <div class="form-group" style="margin-bottom: 0;">
  525. <label class="col-sm-2 control-label">
  526. <span class="glyph-icon icon-exchange" style="transform: rotate(90deg); display: inline-flex;"></span>
  527. <span class="glyph-icon icon-bitbucket" style="margin-left: -4px;"></span>
  528. &nbsp;&nbsp;IOPS 桶宽
  529. </label>
  530. <div class="col-sm-3">
  531. <input id="iops_max" title="IOPS 桶宽" class="form-control" type="text" value="{{ config.iops_max }}" name="iops_max">
  532. </div>
  533. <span class="col-sm-1"></span>
  534. <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>
  535. <div class="col-sm-3">
  536. <input id="bps_max" title="BPS 桶宽 (MiB)" class="form-control" type="text" value="{{ (config.bps_max / 1024 / 1024) | int }}" name="bps_max">
  537. </div>
  538. <span class="col-sm-1"></span>
  539. </div>
  540. <div class="form-group" style="margin-bottom: 0;">
  541. <label class="col-sm-2 control-label">
  542. <span class="glyph-icon icon-exchange" style="transform: rotate(90deg); display: inline-flex;"></span>
  543. <span class="glyph-icon icon-bitbucket" style="margin-left: -4px;"></span>
  544. &nbsp;&nbsp;IOPS 桶高
  545. </label>
  546. <div class="col-sm-3">
  547. <input id="iops_max_length" title="IOPS 桶高 (秒)" class="form-control" type="text" value="{{ config.iops_max_length }}" name="iops_max_length">
  548. </div>
  549. <span class="col-sm-1"></span>
  550. <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>
  551. <div class="col-sm-3">
  552. <input id="bps_max_length" title="BPS 桶高 (秒)" class="form-control" type="text" value="{{ config.bps_max_length }}" name="bps_max_length">
  553. </div>
  554. <span class="col-sm-1"></span>
  555. </div>
  556. <div class="form-group" style="margin-bottom: 0;">
  557. <div class="col-sm-6">
  558. <label>
  559. <input id="influence_current_guest" type="checkbox" name="influence_current_guest">
  560. 同时更新已存在的实例
  561. </label>
  562. </div>
  563. <div class="col-sm-6">
  564. <div style="padding: 0; text-align: right;">
  565. <button type="button" class="btn btn-sm btn-primary" style="right: 10%;" onclick="update_quota();">更新</button>
  566. </div>
  567. </div>
  568. </div>
  569. </form>
  570. </div>
  571. <div id="ip_pool" class="example-box-wrapper" style="display: none;">
  572. </div>
  573. <div id="auxiliary" class="example-box-wrapper" style="display: none;">
  574. <form class="form-horizontal bordered-row" style="padding-left: 8%;">
  575. <div class="form-group" style="margin-bottom: 0;">
  576. <div class="col-sm-3">
  577. <button type="button" class="btn btn-primary" onclick="refresh_guest_state();">刷新虚拟机状态</button>
  578. </div>
  579. </div>
  580. </form>
  581. </div>
  582. </div>
  583. </div>
  584. <div class="modal" id="add_ip_pool_modal" tabindex="-1" role="dialog" style="margin-top: 100px;">
  585. <div class="modal-dialog modal-lg">
  586. <div class="modal-content">
  587. <div class="modal-header">
  588. <h4 class="modal-title">添加 IP 池:</h4>
  589. </div>
  590. <div class="panel">
  591. <div class="panel-body">
  592. <form class="form-horizontal bordered-row" style="padding-left: 16%;">
  593. <div class="form-group">
  594. <label class="col-sm-2 control-label">起始 IP</label>
  595. <div class="col-sm-3">
  596. <input title="起始 IP" class="form-control" name="start_ip" type="text">
  597. </div>
  598. <label class="col-sm-2 control-label">截止 IP</label>
  599. <div class="col-sm-3">
  600. <input title="截止 IP" class="form-control" name="end_ip" type="text">
  601. </div>
  602. </div>
  603. <div class="form-group">
  604. <label class="col-sm-2 control-label">子网掩码</label>
  605. <div class="col-sm-3">
  606. <input title="子网掩码" class="form-control" name="netmask" type="text">
  607. </div>
  608. <label class="col-sm-2 control-label">网关</label>
  609. <div class="col-sm-3">
  610. <input title="网关" class="form-control" name="gateway" type="text">
  611. </div>
  612. </div>
  613. <div class="form-group">
  614. <label class="col-sm-2 control-label">DNS1</label>
  615. <div class="col-sm-3">
  616. <input title="DNS1" class="form-control" name="dns1" type="text">
  617. </div>
  618. <label class="col-sm-2 control-label">DNS2</label>
  619. <div class="col-sm-3">
  620. <input title="DNS2" class="form-control" name="dns2" type="text">
  621. </div>
  622. </div>
  623. <div class="form-group">
  624. <label class="col-sm-2 control-label">名称</label>
  625. <div class="col-sm-3">
  626. <input title="名称" class="form-control" name="name" type="text">
  627. </div>
  628. <label class="col-sm-2 control-label">备注</label>
  629. <div class="col-sm-3">
  630. <textarea title="备注" class="form-control" name="description"></textarea>
  631. </div>
  632. </div>
  633. <div class="form-group" style="margin-bottom: 0;">
  634. <div class="col-sm-6">
  635. <div class="checkbox checkbox-info">
  636. <label>
  637. <input id="activity" name="activity" type="checkbox" checked class="custom-checkbox">
  638. 设为默认
  639. </label>
  640. </div>
  641. </div>
  642. <div class="col-sm-6">
  643. <div style="padding: 0; text-align: right;">
  644. <button type="button" class="btn btn-sm btn-primary" style="right: 20%;" onclick="create_ip_pool(this);">创建</button>
  645. <button type="button" class="btn btn-sm btn-default" style="right: 10%;" data-dismiss="modal">取消</button>
  646. </div>
  647. </div>
  648. </div>
  649. </form>
  650. </div>
  651. </div>
  652. </div>
  653. </div>
  654. </div>
  655. {% endblock content %}