Commit 2e1a6804 authored by Jeffrey Kardatzke's avatar Jeffrey Kardatzke Committed by Commit Bot

Update cicerone_client timeouts to match cicerone

Recently we updated all timeouts in cicerone to be longer because we
were running into too many failures relating to timeouts and we should
be much more lenient with that for now. We also avoid using the D-Bus
default timeout now as well in here so the values are well known.

BUG=chromium:849438
TEST=Builds

Change-Id: I6fef4a25c1056d91fc4059146fa2a67094ad9a5d
Reviewed-on: https://chromium-review.googlesource.com/1246784Reviewed-by: default avatarDan Erat <derat@chromium.org>
Commit-Queue: Jeffrey Kardatzke <jkardatzke@google.com>
Cr-Commit-Position: refs/heads/master@{#594469}
parent 98e808cc
...@@ -8,12 +8,22 @@ ...@@ -8,12 +8,22 @@
#include "base/location.h" #include "base/location.h"
#include "base/observer_list.h" #include "base/observer_list.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h"
#include "dbus/bus.h" #include "dbus/bus.h"
#include "dbus/message.h" #include "dbus/message.h"
#include "third_party/cros_system_api/dbus/service_constants.h" #include "third_party/cros_system_api/dbus/service_constants.h"
#include "third_party/cros_system_api/dbus/vm_cicerone/dbus-constants.h" #include "third_party/cros_system_api/dbus/vm_cicerone/dbus-constants.h"
namespace chromeos { namespace chromeos {
namespace {
// How long to wait before timing out on regular RPCs.
constexpr base::TimeDelta kDefaultTimeout = base::TimeDelta::FromMinutes(1);
// How long to wait while doing more complex operations like starting or
// creating a container.
constexpr base::TimeDelta kLongOperationTimeout =
base::TimeDelta::FromMinutes(2);
} // namespace
class CiceroneClientImpl : public CiceroneClient { class CiceroneClientImpl : public CiceroneClient {
public: public:
...@@ -72,7 +82,7 @@ class CiceroneClientImpl : public CiceroneClient { ...@@ -72,7 +82,7 @@ class CiceroneClientImpl : public CiceroneClient {
} }
cicerone_proxy_->CallMethod( cicerone_proxy_->CallMethod(
&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, &method_call, kDefaultTimeout.InMilliseconds(),
base::BindOnce( base::BindOnce(
&CiceroneClientImpl::OnDBusProtoResponse< &CiceroneClientImpl::OnDBusProtoResponse<
vm_tools::cicerone::LaunchContainerApplicationResponse>, vm_tools::cicerone::LaunchContainerApplicationResponse>,
...@@ -96,7 +106,7 @@ class CiceroneClientImpl : public CiceroneClient { ...@@ -96,7 +106,7 @@ class CiceroneClientImpl : public CiceroneClient {
} }
cicerone_proxy_->CallMethod( cicerone_proxy_->CallMethod(
&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, &method_call, kDefaultTimeout.InMilliseconds(),
base::BindOnce(&CiceroneClientImpl::OnDBusProtoResponse< base::BindOnce(&CiceroneClientImpl::OnDBusProtoResponse<
vm_tools::cicerone::ContainerAppIconResponse>, vm_tools::cicerone::ContainerAppIconResponse>,
weak_ptr_factory_.GetWeakPtr(), std::move(callback))); weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
...@@ -119,7 +129,7 @@ class CiceroneClientImpl : public CiceroneClient { ...@@ -119,7 +129,7 @@ class CiceroneClientImpl : public CiceroneClient {
} }
cicerone_proxy_->CallMethod( cicerone_proxy_->CallMethod(
&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, &method_call, kDefaultTimeout.InMilliseconds(),
base::BindOnce(&CiceroneClientImpl::OnDBusProtoResponse< base::BindOnce(&CiceroneClientImpl::OnDBusProtoResponse<
vm_tools::cicerone::InstallLinuxPackageResponse>, vm_tools::cicerone::InstallLinuxPackageResponse>,
weak_ptr_factory_.GetWeakPtr(), std::move(callback))); weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
...@@ -140,9 +150,8 @@ class CiceroneClientImpl : public CiceroneClient { ...@@ -140,9 +150,8 @@ class CiceroneClientImpl : public CiceroneClient {
return; return;
} }
constexpr int kCreateLxdContainerTimeoutMs = 30 * 1000;
cicerone_proxy_->CallMethod( cicerone_proxy_->CallMethod(
&method_call, kCreateLxdContainerTimeoutMs, &method_call, kLongOperationTimeout.InMilliseconds(),
base::BindOnce(&CiceroneClientImpl::OnDBusProtoResponse< base::BindOnce(&CiceroneClientImpl::OnDBusProtoResponse<
vm_tools::cicerone::CreateLxdContainerResponse>, vm_tools::cicerone::CreateLxdContainerResponse>,
weak_ptr_factory_.GetWeakPtr(), std::move(callback))); weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
...@@ -163,9 +172,8 @@ class CiceroneClientImpl : public CiceroneClient { ...@@ -163,9 +172,8 @@ class CiceroneClientImpl : public CiceroneClient {
return; return;
} }
constexpr int kStartLxdContainerTimeoutMs = 60 * 1000;
cicerone_proxy_->CallMethod( cicerone_proxy_->CallMethod(
&method_call, kStartLxdContainerTimeoutMs, &method_call, kLongOperationTimeout.InMilliseconds(),
base::BindOnce(&CiceroneClientImpl::OnDBusProtoResponse< base::BindOnce(&CiceroneClientImpl::OnDBusProtoResponse<
vm_tools::cicerone::StartLxdContainerResponse>, vm_tools::cicerone::StartLxdContainerResponse>,
weak_ptr_factory_.GetWeakPtr(), std::move(callback))); weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
...@@ -188,7 +196,7 @@ class CiceroneClientImpl : public CiceroneClient { ...@@ -188,7 +196,7 @@ class CiceroneClientImpl : public CiceroneClient {
} }
cicerone_proxy_->CallMethod( cicerone_proxy_->CallMethod(
&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, &method_call, kDefaultTimeout.InMilliseconds(),
base::BindOnce(&CiceroneClientImpl::OnDBusProtoResponse< base::BindOnce(&CiceroneClientImpl::OnDBusProtoResponse<
vm_tools::cicerone::GetLxdContainerUsernameResponse>, vm_tools::cicerone::GetLxdContainerUsernameResponse>,
weak_ptr_factory_.GetWeakPtr(), std::move(callback))); weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
...@@ -211,7 +219,7 @@ class CiceroneClientImpl : public CiceroneClient { ...@@ -211,7 +219,7 @@ class CiceroneClientImpl : public CiceroneClient {
} }
cicerone_proxy_->CallMethod( cicerone_proxy_->CallMethod(
&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, &method_call, kDefaultTimeout.InMilliseconds(),
base::BindOnce(&CiceroneClientImpl::OnDBusProtoResponse< base::BindOnce(&CiceroneClientImpl::OnDBusProtoResponse<
vm_tools::cicerone::SetUpLxdContainerUserResponse>, vm_tools::cicerone::SetUpLxdContainerUserResponse>,
weak_ptr_factory_.GetWeakPtr(), std::move(callback))); weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
......
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