summaryrefslogtreecommitdiffstats
path: root/modules-available/vmstore/inc/vmstorebenchmark.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2022-07-05 17:34:32 +0200
committerSimon Rettberg2022-07-05 17:34:32 +0200
commit1197c0b678e45222e41183a538340ae1806b839c (patch)
tree1c11fb8d687e6160735725f4fe00d7fd88a8295e /modules-available/vmstore/inc/vmstorebenchmark.inc.php
parent[js_chart] Update to Chart.js 3.0.8 (diff)
downloadslx-admin-1197c0b678e45222e41183a538340ae1806b839c.tar.gz
slx-admin-1197c0b678e45222e41183a538340ae1806b839c.tar.xz
slx-admin-1197c0b678e45222e41183a538340ae1806b839c.zip
[dnbd3/vmstore] Add selection for DNBD3 server, or NFS mode, show any errors
Diffstat (limited to 'modules-available/vmstore/inc/vmstorebenchmark.inc.php')
-rw-r--r--modules-available/vmstore/inc/vmstorebenchmark.inc.php16
1 files changed, 11 insertions, 5 deletions
diff --git a/modules-available/vmstore/inc/vmstorebenchmark.inc.php b/modules-available/vmstore/inc/vmstorebenchmark.inc.php
index 10c55431..3a696d04 100644
--- a/modules-available/vmstore/inc/vmstorebenchmark.inc.php
+++ b/modules-available/vmstore/inc/vmstorebenchmark.inc.php
@@ -25,12 +25,12 @@ class VmStoreBenchmark
/**
* @param array $machineUuids
- * @param string $image
- * @param bool $nfs
+ * @param string $image relative path/name of image
+ * @param string $serverOrMode IP address of DNBD3 server, OR 'auto' for all servers known to client, or 'nfs' for NFS
* @param int $start timestamp when the clients should start
* @return ?string taskId, or null on error
*/
- public static function start(string $id, array $machineUuids, string $image, bool $nfs, int &$start)
+ public static function start(string $id, array $machineUuids, string $image, string $serverOrMode, int &$start)
{
Module::isAvailable('rebootcontrol');
$clients = Database::queryAll('SELECT machineuuid, clientip FROM machine WHERE machineuuid IN (:uuids)',
@@ -41,7 +41,13 @@ class VmStoreBenchmark
// The more clients we have, the longer it takes to SSH into all of them.
// As of 2022, RemoteExec processes 4 clients in parallel
$start = ceil(count($clients) / 4 + 5 + time());
- $nfsOpt = $nfs ? '--nfs' : '';
+ if ($serverOrMode === 'nfs') {
+ $modeOption = '--nfs';
+ } elseif ($serverOrMode === 'auto') {
+ $modeOption = '';
+ } else {
+ $modeOption = "--servers '$serverOrMode'";
+ }
// We fork off the benchmark into the background, and collect the results with another RemoteExec job
// when we're done. This is because RemoteExec only does four concurrent SSH connections, so if we wanted to
// do this the easy, synchronous way, we never could run more than four tests at the same time.
@@ -49,7 +55,7 @@ class VmStoreBenchmark
(
exec &> /dev/null < /dev/null
setsid
-image_speedcheck --start $start --console $nfsOpt --file "$image" > "/tmp/speedcheck-$id"
+image_speedcheck --start $start --console $modeOption --file "$image" > "/tmp/speedcheck-$id"
) &
COMMAND;
$task = RebootControl::runScript($clients, $command);