summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2020-02-26 10:21:57 +0100
committerSimon Rettberg2020-02-26 10:21:57 +0100
commitd16d25a28b41c9abe3ec8f9a62b0f316a7606823 (patch)
tree574ca56498eafad6c15d91583e3aab71445b6d60
parent[dnbd3] Remove unused code (diff)
downloadslx-admin-d16d25a28b41c9abe3ec8f9a62b0f316a7606823.tar.gz
slx-admin-d16d25a28b41c9abe3ec8f9a62b0f316a7606823.tar.xz
slx-admin-d16d25a28b41c9abe3ec8f9a62b0f316a7606823.zip
[dnbd3] Run mount script when toggling dnbd3 usage
Pass the new "if local only" option, so the script only acutally runs if internal storage is being used, since that takes care of properly enabling or disabling the NFS server.
-rw-r--r--inc/trigger.inc.php6
-rw-r--r--modules-available/dnbd3/inc/dnbd3.inc.php3
2 files changed, 7 insertions, 2 deletions
diff --git a/inc/trigger.inc.php b/inc/trigger.inc.php
index ecfa6017..8ed098fc 100644
--- a/inc/trigger.inc.php
+++ b/inc/trigger.inc.php
@@ -128,9 +128,10 @@ class Trigger
* Mount the VM store into the server.
*
* @param array $vmstore VM Store configuration to use. If false, read from properties
+ * @param bool $ifLocalOnly Only execute task if the storage type is local (used for DNBD3)
* @return array|false task status of mount procedure, or false on error
*/
- public static function mount($vmstore = false)
+ public static function mount($vmstore = false, $ifLocalOnly = false)
{
if ($vmstore === false) {
$vmstore = Property::getVmStoreConfig();
@@ -152,6 +153,9 @@ class Trigger
$opts = null;
$addr = 'null';
}
+ // Bail out if storage is not local, and we only want to run it in that case
+ if ($ifLocalOnly && $addr !== 'null')
+ return false;
if (isset($vmstore[$opts])) {
$opts = $vmstore[$opts];
}else {
diff --git a/modules-available/dnbd3/inc/dnbd3.inc.php b/modules-available/dnbd3/inc/dnbd3.inc.php
index 2a6182da..ccd783d9 100644
--- a/modules-available/dnbd3/inc/dnbd3.inc.php
+++ b/modules-available/dnbd3/inc/dnbd3.inc.php
@@ -13,6 +13,7 @@ class Dnbd3 {
public static function setEnabled($bool)
{
Property::set(self::PROP_ENABLED, $bool ? 1 : 0);
+ Trigger::mount(false, true);
}
public static function hasNfsFallback()
@@ -24,5 +25,5 @@ class Dnbd3 {
{
Property::set(self::PROP_NFS_FALLBACK, $bool ? 1 : 0);
}
-
+
}