Commit d41cb35a authored by Nicholas Hollingum's avatar Nicholas Hollingum Committed by Commit Bot

Add a stub task for awaiting the container launch.

This infrastructure is being built, but for now we can proceed without
it.  Until it is completed, users may have to retry actions while the vm
is actually still starting up.

Bug: b/162562622
Change-Id: I093647b931b8d33ba598054d29aea3b69e8aa670
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2472679
Commit-Queue: Nic Hollingum <hollingum@google.com>
Reviewed-by: default avatarDaniel Ng <danielng@google.com>
Cr-Commit-Position: refs/heads/master@{#818350}
parent 20618e45
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
namespace borealis { namespace borealis {
BorealisContext::~BorealisContext() = default;
BorealisContext::BorealisContext() = default; BorealisContext::BorealisContext() = default;
BorealisContext::BorealisContext(Profile* profile) : profile_(profile) {} BorealisContext::BorealisContext(Profile* profile) : profile_(profile) {}
......
...@@ -19,7 +19,7 @@ class BorealisContext { ...@@ -19,7 +19,7 @@ class BorealisContext {
public: public:
BorealisContext(const BorealisContext&) = delete; BorealisContext(const BorealisContext&) = delete;
BorealisContext& operator=(const BorealisContext&) = delete; BorealisContext& operator=(const BorealisContext&) = delete;
~BorealisContext() = default; ~BorealisContext();
static BorealisContext* CreateBorealisContextForTesting() { static BorealisContext* CreateBorealisContextForTesting() {
return new BorealisContext(); return new BorealisContext();
...@@ -34,6 +34,11 @@ class BorealisContext { ...@@ -34,6 +34,11 @@ class BorealisContext {
const std::string& vm_name() const { return vm_name_; } const std::string& vm_name() const { return vm_name_; }
void set_vm_name(std::string vm_name) { vm_name_ = std::move(vm_name); } void set_vm_name(std::string vm_name) { vm_name_ = std::move(vm_name); }
const std::string& container_name() const { return container_name_; }
void set_container_name(std::string container_name) {
container_name_ = std::move(container_name);
}
const std::string& root_path() const { return root_path_; } const std::string& root_path() const { return root_path_; }
void set_root_path(std::string path) { root_path_ = std::move(path); } void set_root_path(std::string path) { root_path_ = std::move(path); }
...@@ -49,6 +54,7 @@ class BorealisContext { ...@@ -49,6 +54,7 @@ class BorealisContext {
Profile* profile_ = nullptr; Profile* profile_ = nullptr;
bool borealis_running_ = false; bool borealis_running_ = false;
std::string vm_name_; std::string vm_name_;
std::string container_name_;
std::string root_path_; std::string root_path_;
base::FilePath disk_path_; base::FilePath disk_path_;
}; };
......
...@@ -54,6 +54,7 @@ BorealisContextManagerImpl::GetTasks() { ...@@ -54,6 +54,7 @@ BorealisContextManagerImpl::GetTasks() {
task_queue.push(std::make_unique<MountDlc>()); task_queue.push(std::make_unique<MountDlc>());
task_queue.push(std::make_unique<CreateDiskImage>()); task_queue.push(std::make_unique<CreateDiskImage>());
task_queue.push(std::make_unique<StartBorealisVm>()); task_queue.push(std::make_unique<StartBorealisVm>());
task_queue.push(std::make_unique<AwaitBorealisStartup>());
return task_queue; return task_queue;
} }
......
...@@ -147,4 +147,12 @@ void StartBorealisVm::OnStartBorealisVm( ...@@ -147,4 +147,12 @@ void StartBorealisVm::OnStartBorealisVm(
base::NumberToString(response->status()) + ")"); base::NumberToString(response->status()) + ")");
} }
void AwaitBorealisStartup::Run(BorealisContext* context,
CompletionStatusCallback callback) {
// TODO(b/170696557): Refactor to use the LaunchWatcher which is not finished
// yet. In our case the name is hard-coded, so we can use that.
context->set_container_name("penguin");
std::move(callback).Run(BorealisContextManager::kSuccess, "");
}
} // namespace borealis } // namespace borealis
...@@ -79,6 +79,13 @@ class StartBorealisVm : public BorealisTask { ...@@ -79,6 +79,13 @@ class StartBorealisVm : public BorealisTask {
base::WeakPtrFactory<StartBorealisVm> weak_factory_{this}; base::WeakPtrFactory<StartBorealisVm> weak_factory_{this};
}; };
// Waits for the startup daemon to signal completion.
class AwaitBorealisStartup : public BorealisTask {
public:
void Run(BorealisContext* context,
CompletionStatusCallback callback) override;
};
} // namespace borealis } // namespace borealis
#endif // CHROME_BROWSER_CHROMEOS_BOREALIS_BOREALIS_TASK_H_ #endif // CHROME_BROWSER_CHROMEOS_BOREALIS_BOREALIS_TASK_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment