From 4c55d2d204ffaab7661bea92845836cb70ced5b5 Mon Sep 17 00:00:00 2001 From: Mateusz Malicki Date: Wed, 6 May 2015 11:38:03 +0200 Subject: [PATCH] Client timeout fixes: vsm_start_zone, vsm_shutdown_zone, vsm_lock_zone [Feature] Greater timeout for vsm_start_zone, vsm_shutdown_zone, vsm_lock_zone, vsm_destroy_zone [Cause] Timeout was too small [Solution] N/A [Verification] Start vasum on odroid, start zone, lock zone, shutdown zone, destroy zone Change-Id: I22c080565736abeb95a1e57653777c7d0863c7b3 --- client/host-ipc-connection.cpp | 89 +++++++++++++++++++++++------------------- client/host-ipc-connection.hpp | 6 --- 2 files changed, 48 insertions(+), 47 deletions(-) diff --git a/client/host-ipc-connection.cpp b/client/host-ipc-connection.cpp index 11741f6..6aa87ec 100644 --- a/client/host-ipc-connection.cpp +++ b/client/host-ipc-connection.cpp @@ -31,6 +31,10 @@ namespace vasum { namespace client { +namespace { + const int TIMEOUT_INFINITE = -1; +} //namespace + void HostIPCConnection::createSystem() { mClient.reset(new ipc::Client(mDispatcher.getPoll(), HOST_IPC_SOCKET)); @@ -49,21 +53,23 @@ void HostIPCConnection::create(const std::string& address) void HostIPCConnection::callGetZoneIds(api::ZoneIds& argOut) { - api::Void argVoid; - call(api::ipc::METHOD_GET_ZONE_ID_LIST, argVoid, argOut); + argOut = *mClient->callSync( + api::ipc::METHOD_GET_ZONE_ID_LIST, + std::make_shared()); } void HostIPCConnection::callGetActiveZoneId(api::ZoneId& argOut) { - api::Void argVoid; - call(api::ipc::METHOD_GET_ACTIVE_ZONE_ID, argVoid, argOut); + argOut = *mClient->callSync( + api::ipc::METHOD_GET_ACTIVE_ZONE_ID, + std::make_shared()); } void HostIPCConnection::callSetActiveZone(const api::ZoneId& argIn) { mClient->callSync( - api::ipc::METHOD_SET_ACTIVE_ZONE, - std::make_shared(argIn)); + api::ipc::METHOD_SET_ACTIVE_ZONE, + std::make_shared(argIn)); } void HostIPCConnection::callGetZoneInfo(const api::ZoneId& argIn, api::ZoneInfoOut& argOut) @@ -76,11 +82,8 @@ void HostIPCConnection::callGetZoneInfo(const api::ZoneId& argIn, api::ZoneInfoO void HostIPCConnection::callSetNetdevAttrs(const api::SetNetDevAttrsIn& argIn) { mClient->callSync( - api::ipc::METHOD_SET_NETDEV_ATTRS, - std::make_shared(argIn)); - - api::Void argVoid; - call(api::ipc::METHOD_SET_NETDEV_ATTRS, argIn, argVoid); + api::ipc::METHOD_SET_NETDEV_ATTRS, + std::make_shared(argIn)); } void HostIPCConnection::callGetNetdevAttrs(const api::GetNetDevAttrsIn& argIn, api::GetNetDevAttrs& argOut) @@ -100,36 +103,36 @@ void HostIPCConnection::callGetNetdevList(const api::ZoneId& argIn, api::NetDevL void HostIPCConnection::callCreateNetdevVeth(const api::CreateNetDevVethIn& argIn) { mClient->callSync( - api::ipc::METHOD_CREATE_NETDEV_VETH, - std::make_shared(argIn)); + api::ipc::METHOD_CREATE_NETDEV_VETH, + std::make_shared(argIn)); } void HostIPCConnection::callCreateNetdevMacvlan(const api::CreateNetDevMacvlanIn& argIn) { mClient->callSync( - api::ipc::METHOD_CREATE_NETDEV_MACVLAN, - std::make_shared(argIn)); + api::ipc::METHOD_CREATE_NETDEV_MACVLAN, + std::make_shared(argIn)); } void HostIPCConnection::callCreateNetdevPhys(const api::CreateNetDevPhysIn& argIn) { mClient->callSync( - api::ipc::METHOD_CREATE_NETDEV_PHYS, - std::make_shared(argIn)); + api::ipc::METHOD_CREATE_NETDEV_PHYS, + std::make_shared(argIn)); } void HostIPCConnection::callDestroyNetdev(const api::DestroyNetDevIn& argIn) { mClient->callSync( - api::ipc::METHOD_DESTROY_NETDEV, - std::make_shared(argIn)); + api::ipc::METHOD_DESTROY_NETDEV, + std::make_shared(argIn)); } void HostIPCConnection::callDeleteNetdevIpAddress(const api::DeleteNetdevIpAddressIn& argIn) { mClient->callSync( - api::ipc::METHOD_DELETE_NETDEV_IP_ADDRESS, - std::make_shared(argIn)); + api::ipc::METHOD_DELETE_NETDEV_IP_ADDRESS, + std::make_shared(argIn)); } void HostIPCConnection::callDeclareFile(const api::DeclareFileIn& argIn, api::Declaration& argOut) @@ -163,71 +166,75 @@ void HostIPCConnection::callGetDeclarations(const api::ZoneId& argIn, api::Decla void HostIPCConnection::callRemoveDeclaration(const api::RemoveDeclarationIn& argIn) { mClient->callSync( - api::ipc::METHOD_REMOVE_DECLARATION, - std::make_shared(argIn)); + api::ipc::METHOD_REMOVE_DECLARATION, + std::make_shared(argIn)); } void HostIPCConnection::callCreateZone(const api::CreateZoneIn& argIn) { mClient->callSync( - api::ipc::METHOD_CREATE_ZONE, - std::make_shared(argIn)); + api::ipc::METHOD_CREATE_ZONE, + std::make_shared(argIn)); } void HostIPCConnection::callDestroyZone(const api::ZoneId& argIn) { mClient->callSync( - api::ipc::METHOD_DESTROY_ZONE, - std::make_shared(argIn)); + api::ipc::METHOD_DESTROY_ZONE, + std::make_shared(argIn), + TIMEOUT_INFINITE); } void HostIPCConnection::callShutdownZone(const api::ZoneId& argIn) { mClient->callSync( - api::ipc::METHOD_SHUTDOWN_ZONE, - std::make_shared(argIn)); + api::ipc::METHOD_SHUTDOWN_ZONE, + std::make_shared(argIn), + TIMEOUT_INFINITE); } void HostIPCConnection::callStartZone(const api::ZoneId& argIn) { mClient->callSync( - api::ipc::METHOD_START_ZONE, - std::make_shared(argIn)); + api::ipc::METHOD_START_ZONE, + std::make_shared(argIn), + TIMEOUT_INFINITE); } void HostIPCConnection::callLockZone(const api::ZoneId& argIn) { mClient->callSync( - api::ipc::METHOD_LOCK_ZONE, - std::make_shared(argIn)); + api::ipc::METHOD_LOCK_ZONE, + std::make_shared(argIn), + TIMEOUT_INFINITE); } void HostIPCConnection::callUnlockZone(const api::ZoneId& argIn) { mClient->callSync( - api::ipc::METHOD_UNLOCK_ZONE, - std::make_shared(argIn)); + api::ipc::METHOD_UNLOCK_ZONE, + std::make_shared(argIn)); } void HostIPCConnection::callGrantDevice(const api::GrantDeviceIn& argIn) { mClient->callSync( - api::ipc::METHOD_GRANT_DEVICE, - std::make_shared(argIn)); + api::ipc::METHOD_GRANT_DEVICE, + std::make_shared(argIn)); } void HostIPCConnection::callRevokeDevice(const api::RevokeDeviceIn& argIn) { mClient->callSync( - api::ipc::METHOD_REVOKE_DEVICE, - std::make_shared(argIn)); + api::ipc::METHOD_REVOKE_DEVICE, + std::make_shared(argIn)); } void HostIPCConnection::callNotifyActiveZone(const api::NotifActiveZoneIn& argIn) { mClient->callSync( - api::ipc::METHOD_NOTIFY_ACTIVE_ZONE, - std::make_shared(argIn)); + api::ipc::METHOD_NOTIFY_ACTIVE_ZONE, + std::make_shared(argIn)); } void HostIPCConnection::callFileMoveRequest(const api::FileMoveRequestIn& argIn, diff --git a/client/host-ipc-connection.hpp b/client/host-ipc-connection.hpp index 39015f4..1497390 100644 --- a/client/host-ipc-connection.hpp +++ b/client/host-ipc-connection.hpp @@ -82,12 +82,6 @@ public: private: epoll::ThreadDispatcher mDispatcher; std::unique_ptr mClient; - - template - void call(const ipc::MethodID method, const ArgIn& argIn, ArgOut& argOut, int timeout = 5000) { - auto out = mClient->callSync(method, std::make_shared(argIn), timeout); - argOut = *out; - } }; } // namespace client -- 2.7.4