-
Notifications
You must be signed in to change notification settings - Fork 650
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
3114: Improve waiting for SSH r=townsend2010 a=ricab Two main changes to improve the step of waiting for SSH, when starting/launching instances: 1. Increase the time allotted for each iteration of the loop to wait for SSH, to 1 second. Log each such iteration of the loop. 2. Retry only on specific exceptions, logging them (with `trace` verbosity, since this happens every second), and letting the rest through, in the hope that this may shed some light into cases where instances end up in unknown state. Co-authored-by: Ricardo Abreu <[email protected]>
- Loading branch information
Showing
4 changed files
with
107 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (C) Canonical, Ltd. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; version 3. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
#ifndef MULTIPASS_INTERNAL_TIMEOUT_EXCEPTION_H | ||
#define MULTIPASS_INTERNAL_TIMEOUT_EXCEPTION_H | ||
|
||
#include <chrono> | ||
#include <stdexcept> | ||
#include <string> | ||
|
||
#include <multipass/format.h> | ||
|
||
namespace multipass | ||
{ | ||
|
||
class InternalTimeoutException : public std::runtime_error | ||
{ | ||
public: | ||
InternalTimeoutException(const std::string& action, std::chrono::milliseconds timeout) | ||
: std::runtime_error{fmt::format("Could not {} within {}ms", action, timeout.count())} | ||
{ | ||
} | ||
}; | ||
|
||
} // namespace multipass | ||
|
||
#endif // MULTIPASS_INTERNAL_TIMEOUT_EXCEPTION_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (C) Canonical, Ltd. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; version 3. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
#ifndef MULTIPASS_IP_UNAVAILABLE_EXCEPTION_H | ||
#define MULTIPASS_IP_UNAVAILABLE_EXCEPTION_H | ||
|
||
#include <stdexcept> | ||
#include <string> | ||
|
||
namespace multipass | ||
{ | ||
|
||
class IPUnavailableException : public std::runtime_error | ||
{ | ||
using std::runtime_error::runtime_error; | ||
}; | ||
|
||
} // namespace multipass | ||
|
||
#endif // MULTIPASS_IP_UNAVAILABLE_EXCEPTION_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters