summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2015-09-29 15:22:07 +0200
committerSimon Rettberg2015-09-29 15:22:07 +0200
commit9d0f2ffbd0700e7ad31e41657794592feef83500 (patch)
tree3b18f7b4ed3a0d05e96a6f946985a1d2f5654c6e
parent[baseconfig] Mask root password if applicable (diff)
downloadslx-admin-9d0f2ffbd0700e7ad31e41657794592feef83500.tar.gz
slx-admin-9d0f2ffbd0700e7ad31e41657794592feef83500.tar.xz
slx-admin-9d0f2ffbd0700e7ad31e41657794592feef83500.zip
[vmstore] Only save config if mounting succeeded
-rw-r--r--inc/taskmanagercallback.inc.php20
-rw-r--r--inc/trigger.inc.php7
-rw-r--r--lang/de/templates/page-vmstore.json2
-rw-r--r--modules/vmstore.inc.php4
4 files changed, 28 insertions, 5 deletions
diff --git a/inc/taskmanagercallback.inc.php b/inc/taskmanagercallback.inc.php
index ba589469..cec763fb 100644
--- a/inc/taskmanagercallback.inc.php
+++ b/inc/taskmanagercallback.inc.php
@@ -145,5 +145,25 @@ class TaskmanagerCallback
ConfigTgz::generateSucceeded($args);
}
}
+
+ public static function manualMount($task, $args)
+ {
+ if (!isset($task['data']['exitCode']))
+ return;
+ if ($task['data']['exitCode'] == 0) {
+ // Success - store configuration
+ Property::setVmStoreConfig($args);
+ return;
+ }
+ if ($task['data']['exitCode'] > 0) {
+ // Manual mount failed with non-taskmanager related error - reset storage type to reflect situation
+ $data = Property::getVmStoreConfig();
+ if (isset($data['storetype'])) {
+ unset($data['storetype']);
+ Property::setVmStoreConfig($data);
+ }
+ return;
+ }
+ }
}
diff --git a/inc/trigger.inc.php b/inc/trigger.inc.php
index ace55bf6..fcd1b3c0 100644
--- a/inc/trigger.inc.php
+++ b/inc/trigger.inc.php
@@ -112,11 +112,14 @@ class Trigger
/**
* Mount the VM store into the server.
*
+ * @param array $vmstore VM Store configuration to use. If false, read from properties
* @return array task status of mount procedure, or false on error
*/
- public static function mount()
+ public static function mount($vmstore = false)
{
- $vmstore = Property::getVmStoreConfig();
+ if ($vmstore === false) {
+ $vmstore = Property::getVmStoreConfig();
+ }
if (!is_array($vmstore))
return false;
if (isset($vmstore['storetype'])) {
diff --git a/lang/de/templates/page-vmstore.json b/lang/de/templates/page-vmstore.json
index ee462dc1..bb2c0634 100644
--- a/lang/de/templates/page-vmstore.json
+++ b/lang/de/templates/page-vmstore.json
@@ -3,7 +3,7 @@
"lang_intern": "Intern",
"lang_nfsHelp1": "Ben\u00f6tigt wird ein NFSv4\/3-Share, der f\u00fcr den Satelliten-Server schreibbar, und f\u00fcr die Arbeitsstationen lesbar ist. Beispielkonfiguration auf dem NFS-Server, wenn der Satelliten-Server die Adresse 1.2.3.4 hat:",
"lang_nfsHelp2": "Alternative Konfiguration mittels all_sqash. In diesem Fall muss das Verzeichnis auf dem Server dem Benutzer mit der uid 1234 geh\u00f6ren:",
- "lang_noAdditionalInformation": "Keine Weitere Konfiguration notwendig",
+ "lang_noAdditionalInformation": "Keine weitere Konfiguration notwendig",
"lang_password": "Passwort",
"lang_readOnly": "Nur-Lese-Zugangsdaten",
"lang_readWrite": "Lese\/Schreib-Zugangsdaten",
diff --git a/modules/vmstore.inc.php b/modules/vmstore.inc.php
index 8037d038..afc5809d 100644
--- a/modules/vmstore.inc.php
+++ b/modules/vmstore.inc.php
@@ -56,8 +56,8 @@ class Page_VmStore extends Page
Message::addError('value-invalid', 'nfsaddr', $vmstore['nfsaddr']);
Util::redirect('?do=VmStore');
}
- Property::setVmStoreConfig($vmstore);
- $this->mountTask = Trigger::mount();
+ $this->mountTask = Trigger::mount($vmstore);
+ TaskmanagerCallback::addCallback($this->mountTask, 'manualMount', $vmstore);
}
} \ No newline at end of file