From: Mateusz Malicki Date: Thu, 14 May 2015 12:32:52 +0000 (+0200) Subject: libIpc separated from vasum #2/2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F13%2F39413%2F6;p=platform%2Fcore%2Fsecurity%2Fvasum.git libIpc separated from vasum #2/2 [Feature] libIpc separated from vasum; [Cause] N/A [Solution] Some header files from utils are copied to libIpc-devel rpm package (they can conflict with libSimpleDbus-devel header files) [Verification] Build, install, run tests Change-Id: Ic89a6e1d2a7a4cbb48112eef226b11cd10eb7987 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index a0b6b1b..d42f496 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -142,6 +142,7 @@ SET(LIBS_FOLDER ${PROJECT_SOURCE_DIR}/libs) SET(LOGGER_FOLDER ${PROJECT_SOURCE_DIR}/libs/logger) SET(DBUS_FOLDER ${PROJECT_SOURCE_DIR}/libs/dbus) SET(CONFIG_FOLDER ${PROJECT_SOURCE_DIR}/libs/config) +SET(IPC_FOLDER ${PROJECT_SOURCE_DIR}/libs/ipc) SET(CLIENT_FOLDER ${PROJECT_SOURCE_DIR}/client) SET(SERVER_FOLDER ${PROJECT_SOURCE_DIR}/server) SET(ZONE_SUPPORT_FOLDER ${PROJECT_SOURCE_DIR}/zone-support) @@ -185,6 +186,7 @@ SET(VSM_UNIT_TESTS_IPC_SOCKET_PATH /var/run/vasum-ipc-unit-tests.socket) ADD_SUBDIRECTORY(${LOGGER_FOLDER}) ADD_SUBDIRECTORY(${DBUS_FOLDER}) ADD_SUBDIRECTORY(${CONFIG_FOLDER}) +ADD_SUBDIRECTORY(${IPC_FOLDER}) ADD_SUBDIRECTORY(${CLIENT_FOLDER}) ADD_SUBDIRECTORY(${SERVER_FOLDER}) ADD_SUBDIRECTORY(${ZONE_SUPPORT_FOLDER}) diff --git a/cli/CMakeLists.txt b/cli/CMakeLists.txt index 957faff..f8ad183 100644 --- a/cli/CMakeLists.txt +++ b/cli/CMakeLists.txt @@ -31,7 +31,7 @@ PKG_CHECK_MODULES(LIB_DEPS REQUIRED vasum) INCLUDE_DIRECTORIES(${CLIENT_FOLDER}) INCLUDE_DIRECTORIES(${COMMON_FOLDER}) -TARGET_LINK_LIBRARIES(${CLI_CODENAME} ${PROJECT_NAME}-client ${LIB_DEPS_LIBRARIES}) +TARGET_LINK_LIBRARIES(${CLI_CODENAME} ${PROJECT_NAME}-client ${LIB_DEPS_LIBRARIES} Ipc) CONFIGURE_FILE(support/vasum-cli-completion.sh.in ${CMAKE_BINARY_DIR}/vasum-cli-completion.sh diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index e08c79b..56ed2e7 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -22,10 +22,7 @@ MESSAGE(STATUS "") MESSAGE(STATUS "Generating makefile for the Client...") FILE(GLOB project_SRCS *.cpp *.hpp *.h) -FILE(GLOB common_SRCS ${COMMON_FOLDER}/ipc/epoll/*.hpp ${COMMON_FOLDER}/ipc/epoll/*.cpp - ${COMMON_FOLDER}/ipc/*.hpp ${COMMON_FOLDER}/ipc/*.cpp - ${COMMON_FOLDER}/ipc/internals/*.hpp ${COMMON_FOLDER}/ipc/internals/*.cpp - ${COMMON_FOLDER}/utils/*.hpp ${COMMON_FOLDER}/utils/*.cpp +FILE(GLOB common_SRCS ${COMMON_FOLDER}/utils/*.hpp ${COMMON_FOLDER}/utils/*.cpp ${COMMON_FOLDER}/*.hpp ${COMMON_FOLDER}/*.cpp) SET(_LIB_VERSION_ "${VERSION}") @@ -51,9 +48,10 @@ PKG_CHECK_MODULES(LIB_DEPS REQUIRED gio-2.0 libsystemd-daemon libcap-ng) INCLUDE_DIRECTORIES(SYSTEM ${LIB_DEPS_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${COMMON_FOLDER}) INCLUDE_DIRECTORIES(${LIBS_FOLDER}) +INCLUDE_DIRECTORIES(${IPC_FOLDER}) INCLUDE_DIRECTORIES(${SERVER_FOLDER}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_DEPS_LIBRARIES} ${Boost_LIBRARIES} - Config SimpleDbus) + Config SimpleDbus Ipc) ## Generate the pc file ######################################################## CONFIGURE_FILE(${PC_FILE}.in ${CMAKE_BINARY_DIR}/${PC_FILE} @ONLY) diff --git a/common/netlink/netlink.cpp b/common/netlink/netlink.cpp index 633276a..6dd0ae5 100644 --- a/common/netlink/netlink.cpp +++ b/common/netlink/netlink.cpp @@ -28,6 +28,7 @@ #include "utils/exception.hpp" #include "utils/make-clean.hpp" #include "utils/environment.hpp" +#include "base-exception.hpp" #include #include diff --git a/common/utils/eventfd.cpp b/common/utils/eventfd.cpp index a1b45e9..9af1114 100644 --- a/common/utils/eventfd.cpp +++ b/common/utils/eventfd.cpp @@ -34,8 +34,6 @@ #include #include -using namespace vasum; - namespace utils { EventFD::EventFD() diff --git a/common/utils/exception.hpp b/common/utils/exception.hpp index 49aceb8..ca5564a 100644 --- a/common/utils/exception.hpp +++ b/common/utils/exception.hpp @@ -26,8 +26,7 @@ #ifndef COMMON_UTILS_EXCEPTION_HPP #define COMMON_UTILS_EXCEPTION_HPP -#include "base-exception.hpp" - +#include namespace utils { @@ -35,9 +34,9 @@ namespace utils { /** * Base class for exceptions in utils */ -struct UtilsException: public vasum::VasumException { +struct UtilsException: public std::runtime_error { - UtilsException(const std::string& error) : vasum::VasumException(error) {} + UtilsException(const std::string& error) : std::runtime_error(error) {} }; /** diff --git a/common/utils/fd-utils.cpp b/common/utils/fd-utils.cpp index 95080ff..d5179b1 100644 --- a/common/utils/fd-utils.cpp +++ b/common/utils/fd-utils.cpp @@ -39,8 +39,6 @@ namespace fs = boost::filesystem; namespace chr = std::chrono; -using namespace vasum; - namespace utils { namespace { diff --git a/common/utils/file-wait.cpp b/common/utils/file-wait.cpp index 4949314..b1d9a4f 100644 --- a/common/utils/file-wait.cpp +++ b/common/utils/file-wait.cpp @@ -30,8 +30,6 @@ #include #include -using namespace vasum; - namespace utils { diff --git a/common/utils/fs.cpp b/common/utils/fs.cpp index 5581a29..a093c9e 100644 --- a/common/utils/fs.cpp +++ b/common/utils/fs.cpp @@ -45,8 +45,6 @@ namespace fs = boost::filesystem; -using namespace vasum; - namespace utils { diff --git a/libs/ipc/CMakeLists.txt b/libs/ipc/CMakeLists.txt new file mode 100644 index 0000000..d760883 --- /dev/null +++ b/libs/ipc/CMakeLists.txt @@ -0,0 +1,78 @@ +# Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# @file CMakeLists.txt +# @author Mateusz Malicki (m.malicki2@samsung.com) +# + +PROJECT(Ipc) + +MESSAGE(STATUS "") +MESSAGE(STATUS "Generating makefile for the libIpc...") + +FILE(GLOB HEADERS *.hpp) +FILE(GLOB HEADERS_INTERNALS internals/*.hpp) +FILE(GLOB HEADERS_EPOLL epoll/*.hpp) +FILE(GLOB HEADERS_UTILS ${COMMON_FOLDER}/utils/fd-utils.hpp + ${COMMON_FOLDER}/utils/eventfd.hpp + ${COMMON_FOLDER}/utils/exception.hpp + ${COMMON_FOLDER}/utils/callback-guard.hpp) +FILE(GLOB SRCS *.cpp) +FILE(GLOB SRCS_INTERNALS internals/*.cpp) +FILE(GLOB SRCS_EPOLL epoll/*.cpp) +FILE(GLOB SRCS_UTILS ${COMMON_FOLDER}/utils/fd-utils.cpp + ${COMMON_FOLDER}/utils/eventfd.cpp + ${COMMON_FOLDER}/utils/exception.cpp + ${COMMON_FOLDER}/utils/callback-guard.cpp) + +SET(_LIB_VERSION_ "${VERSION}") +SET(_LIB_SOVERSION_ "0") +SET(PC_FILE "lib${PROJECT_NAME}.pc") + +## Setup target ################################################################ +ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS} ${SRCS_INTERNALS} ${SRCS_UTILS} ${SRCS_EPOLL}) +SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES + SOVERSION ${_LIB_SOVERSION_} + VERSION ${_LIB_VERSION_} + ) + +## Link libraries ############################################################## +INCLUDE_DIRECTORIES(${LIBS_FOLDER}) +INCLUDE_DIRECTORIES(${COMMON_FOLDER}) +INCLUDE_DIRECTORIES(SYSTEM ${DBUS_DEPS_INCLUDE_DIRS}) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} Logger Config) + +## Generate the pc file ######################################################## +CONFIGURE_FILE(${PC_FILE}.in ${CMAKE_CURRENT_BINARY_DIR}/${PC_FILE} @ONLY) + +## Install ##################################################################### +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PC_FILE} + DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) + +INSTALL(TARGETS ${PROJECT_NAME} + DESTINATION ${LIB_INSTALL_DIR} + COMPONENT RuntimeLibraries) + +INSTALL(FILES ${HEADERS} + DESTINATION ${INCLUDE_INSTALL_DIR}/vasum-tools/ipc) + +INSTALL(FILES ${HEADERS_INTERNALS} + DESTINATION ${INCLUDE_INSTALL_DIR}/vasum-tools/ipc/internals) + +INSTALL(FILES ${HEADERS_EPOLL} + DESTINATION ${INCLUDE_INSTALL_DIR}/vasum-tools/ipc/epoll) + +INSTALL(FILES ${HEADERS_UTILS} + DESTINATION ${INCLUDE_INSTALL_DIR}/vasum-tools/ipc/utils) diff --git a/common/ipc/client.cpp b/libs/ipc/client.cpp similarity index 100% rename from common/ipc/client.cpp rename to libs/ipc/client.cpp diff --git a/common/ipc/client.hpp b/libs/ipc/client.hpp similarity index 100% rename from common/ipc/client.hpp rename to libs/ipc/client.hpp diff --git a/common/ipc/epoll/event-poll.cpp b/libs/ipc/epoll/event-poll.cpp similarity index 99% rename from common/ipc/epoll/event-poll.cpp rename to libs/ipc/epoll/event-poll.cpp index d43c97d..fb8470e 100644 --- a/common/ipc/epoll/event-poll.cpp +++ b/libs/ipc/epoll/event-poll.cpp @@ -33,7 +33,6 @@ #include #include -using namespace vasum; using namespace utils; namespace ipc { diff --git a/common/ipc/epoll/event-poll.hpp b/libs/ipc/epoll/event-poll.hpp similarity index 100% rename from common/ipc/epoll/event-poll.hpp rename to libs/ipc/epoll/event-poll.hpp diff --git a/common/ipc/epoll/events.cpp b/libs/ipc/epoll/events.cpp similarity index 100% rename from common/ipc/epoll/events.cpp rename to libs/ipc/epoll/events.cpp diff --git a/common/ipc/epoll/events.hpp b/libs/ipc/epoll/events.hpp similarity index 100% rename from common/ipc/epoll/events.hpp rename to libs/ipc/epoll/events.hpp diff --git a/common/ipc/epoll/glib-dispatcher.cpp b/libs/ipc/epoll/glib-dispatcher.cpp similarity index 100% rename from common/ipc/epoll/glib-dispatcher.cpp rename to libs/ipc/epoll/glib-dispatcher.cpp diff --git a/common/ipc/epoll/glib-dispatcher.hpp b/libs/ipc/epoll/glib-dispatcher.hpp similarity index 100% rename from common/ipc/epoll/glib-dispatcher.hpp rename to libs/ipc/epoll/glib-dispatcher.hpp diff --git a/common/ipc/epoll/thread-dispatcher.cpp b/libs/ipc/epoll/thread-dispatcher.cpp similarity index 100% rename from common/ipc/epoll/thread-dispatcher.cpp rename to libs/ipc/epoll/thread-dispatcher.cpp diff --git a/common/ipc/epoll/thread-dispatcher.hpp b/libs/ipc/epoll/thread-dispatcher.hpp similarity index 100% rename from common/ipc/epoll/thread-dispatcher.hpp rename to libs/ipc/epoll/thread-dispatcher.hpp diff --git a/common/ipc/exception.hpp b/libs/ipc/exception.hpp similarity index 95% rename from common/ipc/exception.hpp rename to libs/ipc/exception.hpp index 3d89d3b..271cf9a 100644 --- a/common/ipc/exception.hpp +++ b/libs/ipc/exception.hpp @@ -26,16 +26,16 @@ #ifndef COMMON_IPC_EXCEPTION_HPP #define COMMON_IPC_EXCEPTION_HPP -#include "base-exception.hpp" +#include namespace ipc { /** * Base class for exceptions in IPC */ -struct IPCException: public vasum::VasumException { +struct IPCException: public std::runtime_error { IPCException(const std::string& message) - : VasumException(message) {} + : std::runtime_error(message) {} }; struct IPCParsingException: public IPCException { diff --git a/common/ipc/internals/acceptor.cpp b/libs/ipc/internals/acceptor.cpp similarity index 100% rename from common/ipc/internals/acceptor.cpp rename to libs/ipc/internals/acceptor.cpp diff --git a/common/ipc/internals/acceptor.hpp b/libs/ipc/internals/acceptor.hpp similarity index 100% rename from common/ipc/internals/acceptor.hpp rename to libs/ipc/internals/acceptor.hpp diff --git a/common/ipc/internals/add-peer-request.hpp b/libs/ipc/internals/add-peer-request.hpp similarity index 100% rename from common/ipc/internals/add-peer-request.hpp rename to libs/ipc/internals/add-peer-request.hpp diff --git a/common/ipc/internals/event-queue.hpp b/libs/ipc/internals/event-queue.hpp similarity index 100% rename from common/ipc/internals/event-queue.hpp rename to libs/ipc/internals/event-queue.hpp diff --git a/common/ipc/internals/finish-request.hpp b/libs/ipc/internals/finish-request.hpp similarity index 100% rename from common/ipc/internals/finish-request.hpp rename to libs/ipc/internals/finish-request.hpp diff --git a/common/ipc/internals/method-request.hpp b/libs/ipc/internals/method-request.hpp similarity index 100% rename from common/ipc/internals/method-request.hpp rename to libs/ipc/internals/method-request.hpp diff --git a/common/ipc/internals/processor.cpp b/libs/ipc/internals/processor.cpp similarity index 100% rename from common/ipc/internals/processor.cpp rename to libs/ipc/internals/processor.cpp diff --git a/common/ipc/internals/processor.hpp b/libs/ipc/internals/processor.hpp similarity index 100% rename from common/ipc/internals/processor.hpp rename to libs/ipc/internals/processor.hpp diff --git a/common/ipc/internals/remove-peer-request.hpp b/libs/ipc/internals/remove-peer-request.hpp similarity index 100% rename from common/ipc/internals/remove-peer-request.hpp rename to libs/ipc/internals/remove-peer-request.hpp diff --git a/common/ipc/internals/request-queue.hpp b/libs/ipc/internals/request-queue.hpp similarity index 100% rename from common/ipc/internals/request-queue.hpp rename to libs/ipc/internals/request-queue.hpp diff --git a/common/ipc/internals/result-builder.hpp b/libs/ipc/internals/result-builder.hpp similarity index 100% rename from common/ipc/internals/result-builder.hpp rename to libs/ipc/internals/result-builder.hpp diff --git a/common/ipc/internals/send-result-request.hpp b/libs/ipc/internals/send-result-request.hpp similarity index 100% rename from common/ipc/internals/send-result-request.hpp rename to libs/ipc/internals/send-result-request.hpp diff --git a/common/ipc/internals/signal-request.hpp b/libs/ipc/internals/signal-request.hpp similarity index 100% rename from common/ipc/internals/signal-request.hpp rename to libs/ipc/internals/signal-request.hpp diff --git a/common/ipc/internals/socket.cpp b/libs/ipc/internals/socket.cpp similarity index 100% rename from common/ipc/internals/socket.cpp rename to libs/ipc/internals/socket.cpp diff --git a/common/ipc/internals/socket.hpp b/libs/ipc/internals/socket.hpp similarity index 100% rename from common/ipc/internals/socket.hpp rename to libs/ipc/internals/socket.hpp diff --git a/common/ipc/ipc-gsource.cpp b/libs/ipc/ipc-gsource.cpp similarity index 100% rename from common/ipc/ipc-gsource.cpp rename to libs/ipc/ipc-gsource.cpp diff --git a/common/ipc/ipc-gsource.hpp b/libs/ipc/ipc-gsource.hpp similarity index 100% rename from common/ipc/ipc-gsource.hpp rename to libs/ipc/ipc-gsource.hpp diff --git a/libs/ipc/libIpc.pc.in b/libs/ipc/libIpc.pc.in new file mode 100644 index 0000000..dbed433 --- /dev/null +++ b/libs/ipc/libIpc.pc.in @@ -0,0 +1,13 @@ +# Package Information for pkg-config + +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=@CMAKE_INSTALL_PREFIX@ +libdir=@LIB_INSTALL_DIR@ +includedir=@INCLUDE_INSTALL_DIR@ + +Name: libIpc +Description: IPC library +Version: @_LIB_VERSION_@ +Libs: -L${libdir} -lIpc +Cflags: -I${includedir}/vasum-tools -I${includedir}/vasum-tools/ipc + diff --git a/common/ipc/method-result.cpp b/libs/ipc/method-result.cpp similarity index 100% rename from common/ipc/method-result.cpp rename to libs/ipc/method-result.cpp diff --git a/common/ipc/method-result.hpp b/libs/ipc/method-result.hpp similarity index 100% rename from common/ipc/method-result.hpp rename to libs/ipc/method-result.hpp diff --git a/common/ipc/result.hpp b/libs/ipc/result.hpp similarity index 100% rename from common/ipc/result.hpp rename to libs/ipc/result.hpp diff --git a/common/ipc/service.cpp b/libs/ipc/service.cpp similarity index 100% rename from common/ipc/service.cpp rename to libs/ipc/service.cpp diff --git a/common/ipc/service.hpp b/libs/ipc/service.hpp similarity index 100% rename from common/ipc/service.hpp rename to libs/ipc/service.hpp diff --git a/common/ipc/types.cpp b/libs/ipc/types.cpp similarity index 100% rename from common/ipc/types.cpp rename to libs/ipc/types.cpp diff --git a/common/ipc/types.hpp b/libs/ipc/types.hpp similarity index 100% rename from common/ipc/types.hpp rename to libs/ipc/types.hpp diff --git a/packaging/vasum.spec b/packaging/vasum.spec index 0636c53..0f99f07 100644 --- a/packaging/vasum.spec +++ b/packaging/vasum.spec @@ -356,4 +356,38 @@ The package provides libConfig development tools and libs. %{_includedir}/vasum-tools/config %{_libdir}/pkgconfig/libConfig.pc +## libIpc Package ####################################################### +%package -n libIpc +Summary: IPC library +Group: Security/Other +Requires: libConfig +Requires(post): /sbin/ldconfig +Requires(postun): /sbin/ldconfig + +%description -n libIpc +The package provides libIpc library. +%post -n libIpc -p /sbin/ldconfig + +%postun -n libIpc -p /sbin/ldconfig + +%files -n libIpc +%defattr(644,root,root,755) +%{_libdir}/libIpc.so.0 +%attr(755,root,root) %{_libdir}/libIpc.so.%{version} + +%package -n libIpc-devel +Summary: Development IPC library +Group: Development/Libraries +Requires: libIpc = %{epoch}:%{version}-%{release} +Requires: pkgconfig(libLogger) +Requires: pkgconfig(libConfig) + +%description -n libIpc-devel +The package provides libIpc development tools and libs. + +%files -n libIpc-devel +%defattr(644,root,root,755) +%{_libdir}/libIpc.so +%{_includedir}/vasum-tools/ipc +%{_libdir}/pkgconfig/libIpc.pc diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index c4e0d8f..6181e15 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -44,7 +44,7 @@ SET_TARGET_PROPERTIES(${SERVER_CODENAME} PROPERTIES ) TARGET_LINK_LIBRARIES(${SERVER_CODENAME} ${SERVER_DEPS_LIBRARIES} ${Boost_LIBRARIES} - Logger Config SimpleDbus) + Logger Config SimpleDbus Ipc) ## Subdirectories ############################################################## ADD_SUBDIRECTORY(configs) diff --git a/server/zones-manager.cpp b/server/zones-manager.cpp index c05b1be..3869a39 100644 --- a/server/zones-manager.cpp +++ b/server/zones-manager.cpp @@ -587,7 +587,7 @@ void ZonesManager::handleNotifyActiveZoneCall(const std::string& caller, //XXX:get(iter).sendNotification(caller, application, message); } result->setVoid(); - } catch (const VasumException&) { + } catch (const std::runtime_error&) { LOGE("Notification from " << caller << " hasn't been sent"); result->setError(api::ERROR_INTERNAL, "Notification hasn't been sent"); } @@ -820,7 +820,7 @@ void ZonesManager::handleSetNetdevAttrsCall(const api::SetNetDevAttrsIn& data, } catch (const InvalidZoneIdException&) { LOGE("No zone with id=" << data.id); result->setError(api::ERROR_INVALID_ID, "No such zone id"); - } catch (const VasumException& ex) { + } catch (const std::runtime_error& ex) { LOGE("Can't set attributes: " << ex.what()); result->setError(api::ERROR_INTERNAL, ex.what()); } @@ -842,7 +842,7 @@ void ZonesManager::handleGetNetdevAttrsCall(const api::GetNetDevAttrsIn& data, } catch (const InvalidZoneIdException&) { LOGE("No zone with id=" << data.first); result->setError(api::ERROR_INVALID_ID, "No such zone id"); - } catch (const VasumException& ex) { + } catch (const std::runtime_error& ex) { LOGE("Can't set attributes: " << ex.what()); result->setError(api::ERROR_INTERNAL, ex.what()); } @@ -860,7 +860,7 @@ void ZonesManager::handleGetNetdevListCall(const api::ZoneId& zoneId, } catch (const InvalidZoneIdException&) { LOGE("No zone with id=" << zoneId.value); result->setError(api::ERROR_INVALID_ID, "No such zone id"); - } catch (const VasumException& ex) { + } catch (const std::runtime_error& ex) { LOGE("Can't set attributes: " << ex.what()); result->setError(api::ERROR_INTERNAL, ex.what()); } @@ -878,7 +878,7 @@ void ZonesManager::handleCreateNetdevVethCall(const api::CreateNetDevVethIn& dat } catch (const InvalidZoneIdException&) { LOGE("No zone with id=" << data.id); result->setError(api::ERROR_INVALID_ID, "No such zone id"); - } catch (const VasumException& ex) { + } catch (const std::runtime_error& ex) { LOGE("Can't create veth: " << ex.what()); result->setError(api::ERROR_INTERNAL, ex.what()); } @@ -895,7 +895,7 @@ void ZonesManager::handleCreateNetdevMacvlanCall(const api::CreateNetDevMacvlanI } catch (const InvalidZoneIdException&) { LOGE("No zone with id=" << data.id); result->setError(api::ERROR_INVALID_ID, "No such zone id"); - } catch (const VasumException& ex) { + } catch (const std::runtime_error& ex) { LOGE("Can't create macvlan: " << ex.what()); result->setError(api::ERROR_INTERNAL, ex.what()); } @@ -913,7 +913,7 @@ void ZonesManager::handleCreateNetdevPhysCall(const api::CreateNetDevPhysIn& dat } catch (const InvalidZoneIdException&) { LOGE("No zone with id=" << data.first); result->setError(api::ERROR_INVALID_ID, "No such zone id"); - } catch (const VasumException& ex) { + } catch (const std::runtime_error& ex) { LOGE("Can't create netdev: " << ex.what()); result->setError(api::ERROR_INTERNAL, ex.what()); } @@ -931,7 +931,7 @@ void ZonesManager::handleDestroyNetdevCall(const api::DestroyNetDevIn& data, } catch (const InvalidZoneIdException&) { LOGE("No zone with id=" << data.first); result->setError(api::ERROR_INVALID_ID, "No such zone id"); - } catch (const VasumException& ex) { + } catch (const std::runtime_error& ex) { LOGE("Can't create netdev: " << ex.what()); result->setError(api::ERROR_INTERNAL, ex.what()); } @@ -948,7 +948,7 @@ void ZonesManager::handleDeleteNetdevIpAddressCall(const api::DeleteNetdevIpAddr } catch (const InvalidZoneIdException&) { LOGE("No zone with id=" << data.zone); result->setError(api::ERROR_INVALID_ID, "No such zone id"); - } catch (const VasumException& ex) { + } catch (const std::runtime_error& ex) { LOGE("Can't delete address: " << ex.what()); result->setError(api::ERROR_INTERNAL, ex.what()); } @@ -1022,7 +1022,7 @@ void ZonesManager::handleGetDeclarationsCall(const api::ZoneId& zoneId, } catch (const InvalidZoneIdException&) { LOGE("No zone with id=" << zoneId.value); result->setError(api::ERROR_INVALID_ID, "No such zone id"); - } catch (const VasumException& ex) { + } catch (const std::runtime_error& ex) { LOGE(ex.what()); result->setError(api::ERROR_INTERNAL, ex.what()); } @@ -1039,7 +1039,7 @@ void ZonesManager::handleRemoveDeclarationCall(const api::RemoveDeclarationIn& d } catch (const InvalidZoneIdException&) { LOGE("No zone with id=" << data.first); result->setError(api::ERROR_INVALID_ID, "No such zone id"); - } catch (const VasumException& ex) { + } catch (const std::runtime_error& ex) { LOGE(ex.what()); result->setError(api::ERROR_INTERNAL, ex.what()); } @@ -1179,7 +1179,7 @@ void ZonesManager::createZone(const std::string& id, try { LOGI("Generating config from " << zoneTemplatePath); generateNewConfig(id, zoneTemplatePath); - } catch (VasumException& e) { + } catch (std::runtime_error& e) { LOGE("Generate config failed: " << e.what()); utils::launchAsRoot(std::bind(removeAllWrapper, zonePathStr)); throw e; @@ -1188,7 +1188,7 @@ void ZonesManager::createZone(const std::string& id, LOGT("Creating new zone"); try { insertZone(id, zoneTemplatePath); - } catch (VasumException& e) { + } catch (std::runtime_error& e) { LOGE("Creating new zone failed: " << e.what()); utils::launchAsRoot(std::bind(removeAllWrapper, zonePathStr)); throw e; @@ -1207,7 +1207,7 @@ void ZonesManager::handleCreateZoneCall(const api::CreateZoneIn& data, result->setVoid(); } catch (const InvalidZoneIdException& e) { result->setError(api::ERROR_INVALID_ID, "Existing or invalid zone id"); - } catch (const VasumException& e) { + } catch (const std::runtime_error& e) { result->setError(api::ERROR_INTERNAL, "Failed to create zone"); } } @@ -1222,7 +1222,7 @@ void ZonesManager::handleDestroyZoneCall(const api::ZoneId& zoneId, } catch (const InvalidZoneIdException&) { LOGE("Failed to destroy zone - no such zone id: " << zoneId.value); result->setError(api::ERROR_INVALID_ID, "No such zone id"); - } catch (const VasumException& e) { + } catch (const std::runtime_error& e) { LOGE("Error during zone destruction: " << e.what()); result->setError(api::ERROR_INTERNAL, "Failed to destroy zone"); return; diff --git a/tests/unit_tests/CMakeLists.txt b/tests/unit_tests/CMakeLists.txt index 500e7af..a4e6cfd 100644 --- a/tests/unit_tests/CMakeLists.txt +++ b/tests/unit_tests/CMakeLists.txt @@ -66,9 +66,9 @@ SET_TARGET_PROPERTIES(${SOCKET_TEST_CODENAME} PROPERTIES ) TARGET_LINK_LIBRARIES(${UT_SERVER_CODENAME} ${UT_SERVER_DEPS_LIBRARIES} ${Boost_LIBRARIES} - Logger Config SimpleDbus) + Logger Config SimpleDbus Ipc) TARGET_LINK_LIBRARIES(${SOCKET_TEST_CODENAME} ${UT_SERVER_DEPS_LIBRARIES} ${Boost_LIBRARIES} - Logger Config SimpleDbus) + Logger Config SimpleDbus Ipc) ## Subdirectories ############################################################## SET(VSM_TEST_CONFIG_INSTALL_DIR ${VSM_CONFIG_INSTALL_DIR}/tests) diff --git a/tests/unit_tests/epoll/ut-event-poll.cpp b/tests/unit_tests/epoll/ut-event-poll.cpp index 819e959..9bf28f0 100644 --- a/tests/unit_tests/epoll/ut-event-poll.cpp +++ b/tests/unit_tests/epoll/ut-event-poll.cpp @@ -34,7 +34,6 @@ #include "ipc/epoll/glib-dispatcher.hpp" #include "ipc/epoll/thread-dispatcher.hpp" -using namespace vasum; using namespace utils; using namespace ipc; using namespace ipc::epoll; diff --git a/tests/unit_tests/ipc/ut-ipc.cpp b/tests/unit_tests/ipc/ut-ipc.cpp index b5edbf7..e71a160 100644 --- a/tests/unit_tests/ipc/ut-ipc.cpp +++ b/tests/unit_tests/ipc/ut-ipc.cpp @@ -51,7 +51,6 @@ #include #include -using namespace vasum; using namespace ipc; using namespace epoll; using namespace utils;