Skip to content

Commit 2c2acd2

Browse files
v3.7.0
1 parent 74b2a1a commit 2c2acd2

11 files changed

+65
-16
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# v3.7.0
2+
- Set console/exec terminal height to 25 rows because xterm.js defaults to 24 and lxd defaults to 25 there was a single row mismatch
3+
- Added qemu.conf to virtual machine configuration options
4+
- Changed cloud-init user data to use POST method rather than GET
5+
- Merged pull request improving websocket close on exec/console websockets
6+
- Added check for empty storage pool source configuration array item
7+
18
# v3.6.0
29
- Merged pull request adding cloud init user data option for new containers via form
310
- Fixed typo preventing OS version number from showing in remotes-single.php page, under LXD Information

lxd-dashboard/backend/config/about.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
<body class="">
4444
<p>The open source LXD Dashboard is developed by LXDWARE and provides a web-based user interface capable of managing multiple LXD servers from a single location.</p>
4545
<p>
46-
<strong>Version</strong>: <span id="versionNumber">v3.6.0</span> <br />
46+
<strong>Version</strong>: <span id="versionNumber">v3.7.0</span> <br />
4747
<strong>License</strong>: AGPL-3.0 <br />
4848
<strong>URL</strong>: https://lxdware.com <br />
4949
</p>

lxd-dashboard/backend/lxd/containers-single.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -650,10 +650,10 @@
650650
case "establishInstanceWebSocketExecConnection":
651651
$url = $base_url . "/1.0/containers/".$instance."/exec?project=" . $project;
652652
if ($shell == "sh"){
653-
$data = '{ "command": ["/bin/sh"], "wait-for-websocket": true, "environment":{"HOME": "/root", "TERM": "xterm", "USER": "root"}, "interactive": true}';
653+
$data = '{ "command": ["/bin/sh"], "wait-for-websocket": true, "environment":{"HOME": "/root", "TERM": "xterm", "USER": "root"}, "interactive": true, "width": 80, "height": 25}';
654654
}
655655
else {
656-
$data = '{ "command": ["/bin/bash"], "wait-for-websocket": true, "environment":{"HOME": "/root", "TERM": "xterm", "USER": "root"}, "interactive": true}';
656+
$data = '{ "command": ["/bin/bash"], "wait-for-websocket": true, "environment":{"HOME": "/root", "TERM": "xterm", "USER": "root"}, "interactive": true, "width": 80, "height": 25}';
657657
}
658658
$results = sendCurlRequest($action, "POST", $url, $data);
659659

lxd-dashboard/backend/lxd/containers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
$boot_autostart_priority = (isset($_GET['boot_autostart_priority'])) ? filter_var(urldecode($_GET['boot_autostart_priority']), FILTER_SANITIZE_STRING) : "";
5353
$boot_host_shutdown_timeout = (isset($_GET['boot_host_shutdown_timeout'])) ? filter_var(urldecode($_GET['boot_host_shutdown_timeout']), FILTER_SANITIZE_STRING) : "";
5454
$boot_stop_priority = (isset($_GET['boot_stop_priority'])) ? filter_var(urldecode($_GET['boot_stop_priority']), FILTER_SANITIZE_STRING) : "";
55-
$cloud_init_user_data = (isset($_GET['cloud_init_user_data'])) ? filter_var(urldecode($_GET['cloud_init_user_data']), FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES) : "";
5655
$limits_cpu = (isset($_GET['limits_cpu'])) ? filter_var(urldecode($_GET['limits_cpu']), FILTER_SANITIZE_STRING) : "";
5756
$limits_cpu_allowance = (isset($_GET['limits_cpu_allowance'])) ? filter_var(urldecode($_GET['limits_cpu_allowance']), FILTER_SANITIZE_STRING) : "";
5857
$limits_cpu_priority = (isset($_GET['limits_cpu_priority'])) ? filter_var(urldecode($_GET['limits_cpu_priority']), FILTER_SANITIZE_STRING) : "";
@@ -108,6 +107,7 @@
108107

109108
//Declare and instantiate POST variables
110109
$json = (isset($_POST['json'])) ? $_POST['json'] : "";
110+
$cloud_init_user_data = (isset($_POST['cloud_init_user_data'])) ? $_POST['cloud_init_user_data'] : "";
111111

112112
//Require code from lxd-dashboard/backend/config/curl.php
113113
require_once('../config/curl.php');

lxd-dashboard/backend/lxd/storage-pools.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,12 @@
452452
echo '"' . htmlentities($storage_pool['description']) . '",';
453453
echo '"' . htmlentities($storage_pool['driver']) . '",';
454454
echo '"' . htmlentities($storage_pool['status']) . '",';
455-
echo '"' . htmlentities($storage_pool['config']['source']) . '",';
455+
456+
if(array_key_exists('source', $storage_pool['config']))
457+
$storage_pool_source = (isset($storage_pool['config']['source'])) ? $storage_pool['config']['source'] : "N/A";
458+
else
459+
$storage_pool_source = "N/A";
460+
echo '"' . htmlentities($storage_pool_source) . '",';
456461

457462
$storage_pool_size = (isset($storage_pool['config']['size'])) ? $storage_pool['config']['size'] : "N/A";
458463
echo '"' . htmlentities($storage_pool_size) . '",';

lxd-dashboard/backend/lxd/virtual-machines-single.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,10 +599,10 @@
599599
case "establishInstanceWebSocketExecConnection":
600600
$url = $base_url . "/1.0/instances/".$instance."/exec?project=" . $project;
601601
if ($shell == "sh"){
602-
$data = '{ "command": ["/bin/sh"], "wait-for-websocket": true, "environment":{"HOME": "/root", "TERM": "xterm", "USER": "root"}, "interactive": true}';
602+
$data = '{ "command": ["/bin/sh"], "wait-for-websocket": true, "environment":{"HOME": "/root", "TERM": "xterm", "USER": "root"}, "interactive": true, "width": 80, "height": 25}';
603603
}
604604
else {
605-
$data = '{ "command": ["/bin/bash"], "wait-for-websocket": true, "environment":{"HOME": "/root", "TERM": "xterm", "USER": "root"}, "interactive": true}';
605+
$data = '{ "command": ["/bin/bash"], "wait-for-websocket": true, "environment":{"HOME": "/root", "TERM": "xterm", "USER": "root"}, "interactive": true, "width": 80, "height": 25}';
606606
}
607607
$results = sendCurlRequest($action, "POST", $url, $data);
608608

lxd-dashboard/backend/lxd/virtual-machines.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
$migration_stateful = (isset($_GET['migration_stateful'])) ? filter_var(urldecode($_GET['migration_stateful']), FILTER_SANITIZE_STRING) : "";
6262
$raw_apparmor = (isset($_GET['raw_apparmor'])) ? filter_var(urldecode($_GET['raw_apparmor']), FILTER_SANITIZE_STRING) : "";
6363
$raw_qemu = (isset($_GET['raw_qemu'])) ? filter_var(urldecode($_GET['raw_qemu']), FILTER_SANITIZE_STRING) : "";
64+
$raw_qemu_conf = (isset($_GET['raw_qemu_conf'])) ? filter_var(urldecode($_GET['raw_qemu_conf']), FILTER_SANITIZE_STRING) : "";
6465
$security_devlxd = (isset($_GET['security_devlxd'])) ? filter_var(urldecode($_GET['security_devlxd']), FILTER_SANITIZE_STRING) : "";
6566
$security_protection_delete = (isset($_GET['security_protection_delete'])) ? filter_var(urldecode($_GET['security_protection_delete']), FILTER_SANITIZE_STRING) : "";
6667
$security_secureboot = (isset($_GET['security_secureboot'])) ? filter_var(urldecode($_GET['security_secureboot']), FILTER_SANITIZE_STRING) : "";
@@ -257,6 +258,7 @@
257258
if (!empty($migration_stateful)){ $instance_array['config']['migration.stateful'] = $migration_stateful;}
258259
if (!empty($raw_apparmor)){ $instance_array['config']['raw.apparmor'] = $raw_apparmor;}
259260
if (!empty($raw_qemu)){ $instance_array['config']['raw.qemu'] = $raw_qemu;}
261+
if (!empty($raw_qemu_conf)){ $instance_array['config']['raw.qemu.conf'] = $raw_qemu_conf;}
260262
if (!empty($security_devlxd)){ $instance_array['config']['security.devlxd'] = $security_devlxd;}
261263
if (!empty($security_protection_delete)){ $instance_array['config']['security.protection.delete'] = $security_protection_delete;}
262264
if (!empty($security_secureboot)){ $instance_array['config']['security.secureboot'] = $security_secureboot;}
@@ -899,6 +901,7 @@
899901
$instance_array['config']['migration.stateful'] = $migration_stateful;
900902
$instance_array['config']['raw.apparmor'] = $raw_apparmor;
901903
$instance_array['config']['raw.qemu'] = $raw_qemu;
904+
$instance_array['config']['raw.qemu.conf'] = $raw_qemu_conf;
902905
$instance_array['config']['security.devlxd'] = $security_devlxd;
903906
$instance_array['config']['security.protection.delete'] = $security_protection_delete;
904907
$instance_array['config']['security.secureboot'] = $security_secureboot;

lxd-dashboard/containers-single.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5953,7 +5953,8 @@ function percentageToDegrees(percentage) {
59535953

59545954
//Initialize xterm for Console
59555955
consoleTerminal = new Terminal({
5956-
cursorBlink: "block"
5956+
cursorBlink: "block",
5957+
rows: 25
59575958
});
59585959

59595960
//Setup listener for Console terminal
@@ -5965,7 +5966,8 @@ function percentageToDegrees(percentage) {
59655966

59665967
//Initialize xterm for Exec
59675968
execTerminal = new Terminal({
5968-
cursorBlink: "block"
5969+
cursorBlink: "block",
5970+
rows: 25
59695971
});
59705972

59715973
//Setup listener for Exec terminal

lxd-dashboard/containers.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,7 @@
923923
<label class="col-4 col-form-label text-right">User-Data: </label>
924924
<div class="col-6">
925925
<div class="form-group">
926-
<textarea id="containerCloudInitUserDataInput" class="form-control" name="containerCloudInitUserDataInput"></textarea>
926+
<textarea id="containerCloudInitUserDataInput" class="form-control" name="containerCloudInitUserDataInput"></textarea>
927927
</div>
928928
</div>
929929
<div class="col-1">
@@ -1517,7 +1517,7 @@ function createInstanceUsingForm(){
15171517
var snapshotsExpiry = $("#containerSnapshotsExpiryInput").val();
15181518
15191519
console.log("Info: creating container " + instanceName);
1520-
$.get("./backend/lxd/containers.php?remote=" + encodeURI(remoteId) + "&project=" + encodeURI(projectName) +
1520+
$.post("./backend/lxd/containers.php?remote=" + encodeURI(remoteId) + "&project=" + encodeURI(projectName) +
15211521
"&name=" + encodeURI(instanceName) +
15221522
"&description=" + encodeURI(instanceDescription) +
15231523
"&fingerprint=" + encodeURI(fingerprint) +
@@ -1532,8 +1532,6 @@ function createInstanceUsingForm(){
15321532
"&boot_host_shutdown_timeout=" + encodeURI(bootHostShutdownTimeout) +
15331533
"&boot_stop_priority=" + encodeURI(bootStopPriority) +
15341534
1535-
"&cloud_init_user_data=" + encodeURIComponent(cloudInitUserData) +
1536-
15371535
"&limits_cpu=" + encodeURI(limitsCpu) +
15381536
"&limits_cpu_allowance=" + encodeURI(limitsCpuAllowance) +
15391537
"&limits_cpu_priority=" + encodeURI(limitsCpuPriority) +
@@ -1591,7 +1589,10 @@ function createInstanceUsingForm(){
15911589
"&snapshots_pattern=" + encodeURI(snapshotsPattern) +
15921590
"&snapshots_expiry=" + encodeURI(snapshotsExpiry) +
15931591
1594-
"&action=createInstanceUsingForm", function (data) {
1592+
"&action=createInstanceUsingForm", {
1593+
//Sending cloud_init_user_data over POST due to encoding. Shoul work to convert all variables to POST as well in future release.
1594+
cloud_init_user_data: cloudInitUserData
1595+
}, function (data) {
15951596
//Sync type
15961597
var operationData = JSON.parse(data);
15971598
console.log(operationData);

lxd-dashboard/virtual-machines-single.php

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,7 @@
472472
<table class="table table-sm">
473473
<tr><td class="pr-3 font-weight-bold">Apparmor:</td> <td><span id="rawApparmor"></span></td></tr>
474474
<tr><td class="pr-3 font-weight-bold">Qemu:</td> <td><span id="rawQemu"></span></td></tr>
475+
<tr><td class="pr-3 font-weight-bold">Qemu.conf:</td> <td><span id="rawQemuConf"></span></td></tr>
475476
</table>
476477
</div>
477478
</div>
@@ -2583,6 +2584,17 @@
25832584
<i class="far fa-sm fa-question-circle" title="Enter in qemu configuration to be appended to the profile. Default: (not set)."></i>
25842585
</div>
25852586
</div>
2587+
<div class="row">
2588+
<label class="col-4 col-form-label text-right">Qemu.conf: </label>
2589+
<div class="col-6">
2590+
<div class="form-group">
2591+
<input type="text" id="instanceRawQemuConfInput" class="form-control" placeholder="" name="instanceRawQemuConfInput">
2592+
</div>
2593+
</div>
2594+
<div class="col-1">
2595+
<i class="far fa-sm fa-question-circle" title="Enter in qemu.conf configuration to override the generated qemu.conf file. Default: (not set)."></i>
2596+
</div>
2597+
</div>
25862598
25872599
</div>
25882600
<div class="tab-pane fade" id="nav-security" role="tabpanel" aria-labelledby="nav-security-tab">
@@ -2985,6 +2997,7 @@ function reloadPageContent(){
29852997
29862998
if (dataConfig.hasOwnProperty('raw.apparmor')) { $("#rawApparmor").text(dataConfig['raw.apparmor']); } else { $("#rawApparmor").text(""); }
29872999
if (dataConfig.hasOwnProperty('raw.qemu')) { $("#rawQemu").text(dataConfig['raw.qemu']); } else { $("#rawQemu").text(""); }
3000+
if (dataConfig.hasOwnProperty('raw.qemu.conf')) { $("#rawQemuConf").text(dataConfig['raw.qemu.conf']); } else { $("#rawQemuConf").text(""); }
29883001
29893002
if (dataConfig.hasOwnProperty('security.devlxd')) { $("#securityDevLxd").text(dataConfig['security.devlxd']); } else { $("#securityDevLxd").text(""); }
29903003
if (dataConfig.hasOwnProperty('security.protection.delete')) { $("#securityProtectionDelete").text(dataConfig['security.protection.delete']); } else { $("#securityProtectionDelete").text(""); }
@@ -3092,6 +3105,7 @@ function loadPageContent(){
30923105
30933106
if (dataConfig.hasOwnProperty('raw.apparmor')) { $("#rawApparmor").text(dataConfig['raw.apparmor']); }
30943107
if (dataConfig.hasOwnProperty('raw.qemu')) { $("#rawQemu").text(dataConfig['raw.qemu']); }
3108+
if (dataConfig.hasOwnProperty('raw.qemu.conf')) { $("#rawQemuConf").text(dataConfig['raw.qemu.conf']); }
30953109
30963110
if (dataConfig.hasOwnProperty('security.devlxd')) { $("#securityDevLxd").text(dataConfig['security.devlxd']); }
30973111
if (dataConfig.hasOwnProperty('security.protection.delete')) { $("#securityProtectionDelete").text(dataConfig['security.protection.delete']); }
@@ -4499,6 +4513,7 @@ function editInstance(){
44994513
if (dataConfig.hasOwnProperty('migration.stateful')) { $("#instanceMigrationStatefulInput").val(dataConfig['migration.stateful']); }
45004514
if (dataConfig.hasOwnProperty('raw.apparmor')) { $("#instanceRawApparmorInput").val(dataConfig['raw.apparmor']); }
45014515
if (dataConfig.hasOwnProperty('raw.qemu')) { $("#instanceRawQemuInput").val(dataConfig['raw.qemu']); }
4516+
if (dataConfig.hasOwnProperty('raw.qemu.conf')) { $("#instanceRawQemuConfInput").val(dataConfig['raw.qemu.conf']); }
45024517
if (dataConfig.hasOwnProperty('security.devlxd')) { $("#instanceSecurityDevLxdInput").val(dataConfig['security.devlxd']); }
45034518
if (dataConfig.hasOwnProperty('security.protection.delete')) { $("#instanceSecurityProtectionDeleteInput").val(dataConfig['security.protection.delete']); }
45044519
if (dataConfig.hasOwnProperty('security.secureboot')) { $("#instanceSecuritySecurebootInput").val(dataConfig['security.secureboot']); }
@@ -4531,6 +4546,7 @@ function updateInstanceForm(){
45314546
"&migration_stateful=" + encodeURI($("#instanceMigrationStatefulInput").val()) +
45324547
"&raw_apparmor=" + encodeURI($("#instanceRawApparmorInput").val()) +
45334548
"&raw_qemu=" + encodeURI($("#instanceRawQemuInput").val()) +
4549+
"&raw_qemu_conf=" + encodeURI($("#instanceRawQemuConfInput").val()) +
45344550
"&security_devlxd=" + encodeURI($("#instanceSecurityDevLxdInput").val()) +
45354551
"&security_protection_delete=" + encodeURI($("#instanceSecurityProtectionDeleteInput").val()) +
45364552
"&security_secureboot=" + encodeURI($("#instanceSecuritySecurebootInput").val()) +
@@ -4901,7 +4917,8 @@ function percentageToDegrees(percentage) {
49014917
49024918
//Initialize xterm for Console
49034919
consoleTerminal = new Terminal({
4904-
cursorBlink: "block"
4920+
cursorBlink: "block",
4921+
rows: 25
49054922
});
49064923
49074924
//Setup listener for Console terminal
@@ -4913,7 +4930,8 @@ function percentageToDegrees(percentage) {
49134930
49144931
//Initialize xterm for Exec
49154932
execTerminal = new Terminal({
4916-
cursorBlink: "block"
4933+
cursorBlink: "block",
4934+
rows: 25
49174935
});
49184936
49194937
//Setup listener for Exec terminal

0 commit comments

Comments
 (0)