From 9d0f2ffbd0700e7ad31e41657794592feef83500 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 29 Sep 2015 15:22:07 +0200 Subject: [vmstore] Only save config if mounting succeeded --- inc/taskmanagercallback.inc.php | 20 ++++++++++++++++++++ inc/trigger.inc.php | 7 +++++-- 2 files changed, 25 insertions(+), 2 deletions(-) (limited to 'inc') 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'])) { -- cgit v1.2.3-55-g7522