summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);
}
-
+
}