summaryrefslogtreecommitdiffstats
path: root/inc/trigger.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/trigger.inc.php')
-rw-r--r--inc/trigger.inc.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/inc/trigger.inc.php b/inc/trigger.inc.php
index 134bab53..5024b907 100644
--- a/inc/trigger.inc.php
+++ b/inc/trigger.inc.php
@@ -98,7 +98,7 @@ class Trigger
*
* @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
+ * @return string|false task id of mount procedure, or false on error
*/
public static function mount($vmstore = false, $ifLocalOnly = false)
{
@@ -130,7 +130,7 @@ class Trigger
}else {
$opts = null;
}
- return Taskmanager::submit('MountVmStore', array(
+ $status = Taskmanager::submit('MountVmStore', array(
'address' => $addr,
'type' => 'images',
'opts' => $opts,
@@ -138,6 +138,12 @@ class Trigger
'username' => $vmstore['cifsuser'],
'password' => $vmstore['cifspasswd']
));
+ if (!Taskmanager::isFailed($status)) {
+ // In case we have a concurrent active task, this should be enough
+ // for the taskmanager to give us the existing id
+ $status = Taskmanager::waitComplete($status, 100);
+ }
+ return $status['data']['existingTask'] ?? $status['id'] ?? false;
}
/**