From 56b653126088a9a3f0423aa8eb1cd215e6ec0e73 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 7 Jun 2017 14:07:47 +0200 Subject: [inc/event] Retry mounting vmstore on bootup --- inc/event.inc.php | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'inc') diff --git a/inc/event.inc.php b/inc/event.inc.php index 89e68650..a16be97b 100644 --- a/inc/event.inc.php +++ b/inc/event.inc.php @@ -25,11 +25,12 @@ class Event Property::clearList('cron.key.blocked'); // Tasks: fire away + $mountStatus = false; $mountId = Trigger::mount(); $autoIp = Trigger::autoUpdateServerIp(); $ldadpId = Trigger::ldadp(); $ipxeId = Trigger::ipxe(); - + Taskmanager::submit('DozmodLauncher', array( 'operation' => 'start' )); @@ -40,11 +41,8 @@ class Event EventLog::info('No VM store type defined.'); $everythingFine = false; } else { - $res = Taskmanager::waitComplete($mountId, 5000); - if (Taskmanager::isFailed($res)) { - EventLog::failure('Mounting VM store failed', $res['data']['messages']); - $everythingFine = false; - } + $mountStatus = Taskmanager::waitComplete($mountId, 5000); + } // LDAP AD Proxy if ($ldadpId === false) { @@ -74,6 +72,22 @@ class Event } } + if ($mountStatus !== false && !Taskmanager::isFinished($mountStatus)) { + $mountStatus = Taskmanager::waitComplete($mountStatus, 5000); + } + if (Taskmanager::isFailed($mountStatus)) { + // One more time, network could've been down before + sleep(10); + $mountId = Trigger::mount(); + $mountStatus = Taskmanager::waitComplete($mountId, 10000); + } + if ($mountId !== false && Taskmanager::isFailed($mountStatus)) { + EventLog::failure('Mounting VM store failed', $mountStatus['data']['messages']); + $everythingFine = false; + } elseif ($mountId !== false && !Taskmanager::isFinished($mountStatus)) { + // TODO: Still running - create callback + } + // Just so we know booting is done (and we don't expect any more errors from booting up) if ($everythingFine) { EventLog::info('Bootup finished without errors.'); -- cgit v1.2.3-55-g7522