From 2d89e4343e5fe67fb267f6f910db83ee6cc5e6cf Mon Sep 17 00:00:00 2001 From: Dariusz Michaluk Date: Tue, 2 Dec 2014 15:18:51 +0100 Subject: [PATCH] Rename domain to zone Change-Id: Ic17dd814bc8fd19848bf936bd2ffebc7da1acf6c Signed-off-by: Dariusz Michaluk --- cli/command-line-interface.cpp | 38 +++--- cli/command-line-interface.hpp | 30 ++--- cli/main.cpp | 32 +++--- client/security-containers-client-impl.cpp | 46 ++++---- client/security-containers-client-impl.hpp | 60 +++++----- client/security-containers-client.cpp | 86 +++++++------- client/security-containers-client.h | 128 ++++++++++----------- common/ipc/internals/socket.cpp | 4 +- common/ipc/internals/socket.hpp | 2 +- common/lxc/domain.cpp | 92 +++++++-------- common/lxc/domain.hpp | 44 +++---- container-daemon/CMakeLists.txt | 6 +- .../org.tizen.containers.domain.daemon.conf.in | 14 --- .../org.tizen.containers.zone.daemon.conf.in | 14 +++ container-daemon/daemon-dbus-definitions.hpp | 6 +- container-support/CMakeLists.txt | 6 +- .../configs/org.tizen.containers.domain.conf.in | 14 --- .../configs/org.tizen.containers.zone.conf.in | 14 +++ packaging/security-containers.spec | 4 +- server/container-admin.cpp | 10 +- server/container-admin.hpp | 2 +- server/container-config.hpp | 2 +- server/container-dbus-definitions.hpp | 6 +- server/host-connection.hpp | 2 +- tests/integration_tests/common/sc_test_utils.py | 2 +- .../image_tests/config_checker.py | 2 +- tests/integration_tests/image_tests/image_tests.py | 2 +- tests/unit_tests/client/ut-client.cpp | 12 +- tests/unit_tests/lxc/ut-domain.cpp | 82 ++++++------- 29 files changed, 381 insertions(+), 381 deletions(-) delete mode 100644 container-daemon/configs/org.tizen.containers.domain.daemon.conf.in create mode 100644 container-daemon/configs/org.tizen.containers.zone.daemon.conf.in delete mode 100644 container-support/configs/org.tizen.containers.domain.conf.in create mode 100644 container-support/configs/org.tizen.containers.zone.conf.in diff --git a/cli/command-line-interface.cpp b/cli/command-line-interface.cpp index b46871d..cf9c71a 100644 --- a/cli/command-line-interface.cpp +++ b/cli/command-line-interface.cpp @@ -81,7 +81,7 @@ finish: } } -ostream& operator<<(ostream& out, const VsmDomainState& state) +ostream& operator<<(ostream& out, const VsmZoneState& state) { const char* name; switch (state) { @@ -103,12 +103,12 @@ ostream& operator<<(ostream& out, const VsmDomainState& state) return out; } -ostream& operator<<(ostream& out, const VsmDomain& domain) +ostream& operator<<(ostream& out, const VsmZone& zone) { - out << "Name: " << domain->id - << "\nTerminal: " << domain->terminal - << "\nState: " << domain->state - << "\nRoot: " << domain->rootfs_path; + out << "Name: " << zone->id + << "\nTerminal: " << zone->terminal + << "\nState: " << zone->state + << "\nRoot: " << zone->rootfs_path; return out; } @@ -143,7 +143,7 @@ void set_active_container(int pos, int argc, const char** argv) one_shot(bind(vsm_set_active_container, _1, argv[pos + 1])); } -void create_domain(int pos, int argc, const char** argv) +void create_zone(int pos, int argc, const char** argv) { using namespace std::placeholders; @@ -151,10 +151,10 @@ void create_domain(int pos, int argc, const char** argv) throw runtime_error("Not enough parameters"); } - one_shot(bind(vsm_create_domain, _1, argv[pos + 1], nullptr)); + one_shot(bind(vsm_create_zone, _1, argv[pos + 1], nullptr)); } -void destroy_domain(int pos, int argc, const char** argv) +void destroy_zone(int pos, int argc, const char** argv) { using namespace std::placeholders; @@ -162,10 +162,10 @@ void destroy_domain(int pos, int argc, const char** argv) throw runtime_error("Not enough parameters"); } - one_shot(bind(vsm_destroy_domain, _1, argv[pos + 1], 1)); + one_shot(bind(vsm_destroy_zone, _1, argv[pos + 1], 1)); } -void lock_domain(int pos, int argc, const char** argv) +void lock_zone(int pos, int argc, const char** argv) { using namespace std::placeholders; @@ -173,10 +173,10 @@ void lock_domain(int pos, int argc, const char** argv) throw runtime_error("Not enough parameters"); } - one_shot(bind(vsm_lock_domain, _1, argv[pos + 1])); + one_shot(bind(vsm_lock_zone, _1, argv[pos + 1])); } -void unlock_domain(int pos, int argc, const char** argv) +void unlock_zone(int pos, int argc, const char** argv) { using namespace std::placeholders; @@ -184,20 +184,20 @@ void unlock_domain(int pos, int argc, const char** argv) throw runtime_error("Not enough parameters"); } - one_shot(bind(vsm_unlock_domain, _1, argv[pos + 1])); + one_shot(bind(vsm_unlock_zone, _1, argv[pos + 1])); } -void lookup_domain_by_id(int pos, int argc, const char** argv) +void lookup_zone_by_id(int pos, int argc, const char** argv) { using namespace std::placeholders; if (argc <= pos + 1) { throw runtime_error("Not enough parameters"); } - VsmDomain domain; - one_shot(bind(vsm_lookup_domain_by_id, _1, argv[pos + 1], &domain)); - cout << domain << endl; - vsm_domain_free(domain); + VsmZone zone; + one_shot(bind(vsm_lookup_zone_by_id, _1, argv[pos + 1], &zone)); + cout << zone << endl; + vsm_zone_free(zone); } } // namespace cli diff --git a/cli/command-line-interface.hpp b/cli/command-line-interface.hpp index 360f46c..3239a00 100644 --- a/cli/command-line-interface.hpp +++ b/cli/command-line-interface.hpp @@ -104,39 +104,39 @@ private: void set_active_container(int pos, int argc, const char** argv); /** - * Parses command line arguments and call vsm_create_domain + * Parses command line arguments and call vsm_create_zone * - * @see vsm_create_domain + * @see vsm_create_zone */ -void create_domain(int pos, int argc, const char** argv); +void create_zone(int pos, int argc, const char** argv); /** - * Parses command line arguments and call vsm_destroy_domain + * Parses command line arguments and call vsm_destroy_zone * - * @see vsm_destroy_domain + * @see vsm_destroy_zone */ -void destroy_domain(int pos, int argc, const char** argv); +void destroy_zone(int pos, int argc, const char** argv); /** - * Parses command line arguments and call vsm_lock_domain + * Parses command line arguments and call vsm_lock_zone * - * @see vsm_lock_domain + * @see vsm_lock_zone */ -void lock_domain(int pos, int argc, const char** argv); +void lock_zone(int pos, int argc, const char** argv); /** - * Parses command line arguments and call vsm_unlock_domain + * Parses command line arguments and call vsm_unlock_zone * - * @see vsm_unlock_domain + * @see vsm_unlock_zone */ -void unlock_domain(int pos, int argc, const char** argv); +void unlock_zone(int pos, int argc, const char** argv); /** - * Parses command line arguments and call vsm_lookup_domain_by_id + * Parses command line arguments and call vsm_lookup_zone_by_id * - * @see vsm_lookup_domain_by_id + * @see vsm_lookup_zone_by_id */ -void lookup_domain_by_id(int pos, int argc, const char** argv); +void lookup_zone_by_id(int pos, int argc, const char** argv); } // namespace cli diff --git a/cli/main.cpp b/cli/main.cpp index 0ceb1e5..c7ad2e6 100644 --- a/cli/main.cpp +++ b/cli/main.cpp @@ -42,42 +42,42 @@ std::map commands = { } }, { - "create_domain", { - create_domain, - "create_domain container_id", + "create_zone", { + create_zone, + "create_zone container_id", "Create and add container", {{"container_id", "id container name"}} } }, { - "destroy_domain", { - destroy_domain, - "destroy_domain container_id", + "destroy_zone", { + destroy_zone, + "destroy_zone container_id", "Destroy container", {{"container_id", "id container name"}} } }, { - "lock_domain", { - lock_domain, - "lock_domain container_id", + "lock_zone", { + lock_zone, + "lock_zone container_id", "Lock container", {{"container_id", "id container name"}} } }, { - "unlock_domain", { - unlock_domain, - "unlock_domain container_id", + "unlock_zone", { + unlock_zone, + "unlock_zone container_id", "Unlock container", {{"container_id", "id container name"}} } }, { - "lookup_domain_by_id", { - lookup_domain_by_id, - "lookup_domain_by_id container_id", - "Prints informations about domain", + "lookup_zone_by_id", { + lookup_zone_by_id, + "lookup_zone_by_id container_id", + "Prints informations about zone", {{"container_id", "id container name"}} } } diff --git a/client/security-containers-client-impl.cpp b/client/security-containers-client-impl.cpp index aa8a796..f96cbcc 100644 --- a/client/security-containers-client-impl.cpp +++ b/client/security-containers-client-impl.cpp @@ -88,7 +88,7 @@ void toBasic(GVariant* in, char** str) *str = buf; } -VsmDomainState getDomainState(const char* state) +VsmZoneState getZoneState(const char* state) { if (strcmp(state, "STOPPED") == 0) { return STOPPED; @@ -114,22 +114,22 @@ VsmDomainState getDomainState(const char* state) return ACTIVATING; } assert(!"UNKNOWN STATE"); - return (VsmDomainState)-1; + return (VsmZoneState)-1; } -void toBasic(GVariant* in, VsmDomain* domain) +void toBasic(GVariant* in, VsmZone* zone) { const char* id; const char* path; const char* state; int terminal; - VsmDomain vsmDomain = (VsmDomain)malloc(sizeof(*vsmDomain)); + VsmZone vsmZone = (VsmZone)malloc(sizeof(*vsmZone)); g_variant_get(in, "(siss)", &id, &terminal, &state, &path); - vsmDomain->id = strdup(id); - vsmDomain->terminal = terminal; - vsmDomain->state = getDomainState(state); - vsmDomain->rootfs_path = strdup(path); - *domain = vsmDomain; + vsmZone->id = strdup(id); + vsmZone->terminal = terminal; + vsmZone->state = getZoneState(state); + vsmZone->rootfs_path = strdup(path); + *zone = vsmZone; } template @@ -339,7 +339,7 @@ VsmStatus Client::vsm_get_container_dbuses(VsmArrayString* keys, VsmArrayString* return ret; } -VsmStatus Client::vsm_get_domain_ids(VsmArrayString* array) noexcept +VsmStatus Client::vsm_get_zone_ids(VsmArrayString* array) noexcept { assert(array); @@ -381,7 +381,7 @@ VsmStatus Client::vsm_get_active_container_id(VsmString* id) noexcept return ret; } -VsmStatus Client::vsm_lookup_domain_by_pid(int pid, VsmString* id) noexcept +VsmStatus Client::vsm_lookup_zone_by_pid(int pid, VsmString* id) noexcept { assert(id); @@ -404,10 +404,10 @@ VsmStatus Client::vsm_lookup_domain_by_pid(int pid, VsmString* id) noexcept return vsm_get_status(); } -VsmStatus Client::vsm_lookup_domain_by_id(const char* id, VsmDomain* domain) noexcept +VsmStatus Client::vsm_lookup_zone_by_id(const char* id, VsmZone* zone) noexcept { assert(id); - assert(domain); + assert(zone); GVariant* out; GVariant* args_in = g_variant_new("(s)", id); @@ -421,13 +421,13 @@ VsmStatus Client::vsm_lookup_domain_by_id(const char* id, VsmDomain* domain) noe } GVariant* unpacked; g_variant_get(out, "(*)", &unpacked); - toBasic(unpacked, domain); + toBasic(unpacked, zone); g_variant_unref(unpacked); g_variant_unref(out); return ret; } -VsmStatus Client::vsm_lookup_domain_by_terminal_id(int, VsmString*) noexcept +VsmStatus Client::vsm_lookup_zone_by_terminal_id(int, VsmString*) noexcept { mStatus = Status(VSMCLIENT_OTHER_ERROR, "Not implemented"); return vsm_get_status(); @@ -441,7 +441,7 @@ VsmStatus Client::vsm_set_active_container(const char* id) noexcept return callMethod(HOST_INTERFACE, api::host::METHOD_SET_ACTIVE_CONTAINER, args_in); } -VsmStatus Client::vsm_create_domain(const char* id, const char* tname) noexcept +VsmStatus Client::vsm_create_zone(const char* id, const char* tname) noexcept { assert(id); if (tname) { @@ -453,26 +453,26 @@ VsmStatus Client::vsm_create_domain(const char* id, const char* tname) noexcept return callMethod(HOST_INTERFACE, api::host::METHOD_CREATE_CONTAINER, args_in); } -VsmStatus Client::vsm_destroy_domain(const char* id) noexcept +VsmStatus Client::vsm_destroy_zone(const char* id) noexcept { assert(id); GVariant* args_in = g_variant_new("(s)", id); return callMethod(HOST_INTERFACE, api::host::METHOD_DESTROY_CONTAINER, args_in); } -VsmStatus Client::vsm_shutdown_domain(const char*) noexcept +VsmStatus Client::vsm_shutdown_zone(const char*) noexcept { mStatus = Status(VSMCLIENT_OTHER_ERROR, "Not implemented"); return vsm_get_status(); } -VsmStatus Client::vsm_start_domain(const char*) noexcept +VsmStatus Client::vsm_start_zone(const char*) noexcept { mStatus = Status(VSMCLIENT_OTHER_ERROR, "Not implemented"); return vsm_get_status(); } -VsmStatus Client::vsm_lock_domain(const char* id) noexcept +VsmStatus Client::vsm_lock_zone(const char* id) noexcept { assert(id); @@ -480,7 +480,7 @@ VsmStatus Client::vsm_lock_domain(const char* id) noexcept return callMethod(HOST_INTERFACE, api::host::METHOD_LOCK_CONTAINER, args_in); } -VsmStatus Client::vsm_unlock_domain(const char* id) noexcept +VsmStatus Client::vsm_unlock_zone(const char* id) noexcept { assert(id); @@ -513,7 +513,7 @@ VsmStatus Client::vsm_del_state_callback(VsmSubscriptionId subscriptionId) noexc return signalUnsubscribe(subscriptionId); } -VsmStatus Client::vsm_domain_grant_device(const char*, const char*, uint32_t) noexcept +VsmStatus Client::vsm_zone_grant_device(const char*, const char*, uint32_t) noexcept { mStatus = Status(VSMCLIENT_OTHER_ERROR, "Not implemented"); return vsm_get_status(); @@ -525,7 +525,7 @@ VsmStatus Client::vsm_revoke_device(const char*, const char*) noexcept return vsm_get_status(); } -VsmStatus Client::vsm_domain_get_netdevs(const char*, VsmArrayString*) noexcept +VsmStatus Client::vsm_zone_get_netdevs(const char*, VsmArrayString*) noexcept { mStatus = Status(VSMCLIENT_OTHER_ERROR, "Not implemented"); return vsm_get_status(); diff --git a/client/security-containers-client-impl.hpp b/client/security-containers-client-impl.hpp index 585716d..d4c3506 100644 --- a/client/security-containers-client-impl.hpp +++ b/client/security-containers-client-impl.hpp @@ -109,9 +109,9 @@ public: VsmStatus vsm_get_container_dbuses(VsmArrayString* keys, VsmArrayString* values) noexcept; /** - * @see ::vsm_get_domain_ids + * @see ::vsm_get_zone_ids */ - VsmStatus vsm_get_domain_ids(VsmArrayString* array) noexcept; + VsmStatus vsm_get_zone_ids(VsmArrayString* array) noexcept; /** * @see ::vsm_get_active_container_id @@ -119,19 +119,19 @@ public: VsmStatus vsm_get_active_container_id(VsmString* id) noexcept; /** - * @see ::vsm_lookup_domain_by_pid + * @see ::vsm_lookup_zone_by_pid */ - VsmStatus vsm_lookup_domain_by_pid(int pid, VsmString* id) noexcept; + VsmStatus vsm_lookup_zone_by_pid(int pid, VsmString* id) noexcept; /** - * @see ::vsm_lookup_domain_by_id + * @see ::vsm_lookup_zone_by_id */ - VsmStatus vsm_lookup_domain_by_id(const char* id, VsmDomain* domain) noexcept; + VsmStatus vsm_lookup_zone_by_id(const char* id, VsmZone* zone) noexcept; /** - * @see ::vsm_lookup_domain_by_terminal_id + * @see ::vsm_lookup_zone_by_terminal_id */ - VsmStatus vsm_lookup_domain_by_terminal_id(int terminal, VsmString* id) noexcept; + VsmStatus vsm_lookup_zone_by_terminal_id(int terminal, VsmString* id) noexcept; /** * @see ::vsm_set_active_container @@ -139,34 +139,34 @@ public: VsmStatus vsm_set_active_container(const char* id) noexcept; /** - * @see ::vsm_create_domain + * @see ::vsm_create_zone */ - VsmStatus vsm_create_domain(const char* id, const char* tname) noexcept; + VsmStatus vsm_create_zone(const char* id, const char* tname) noexcept; /** - * @see ::vsm_destroy_domain + * @see ::vsm_destroy_zone */ - VsmStatus vsm_destroy_domain(const char* id) noexcept; + VsmStatus vsm_destroy_zone(const char* id) noexcept; /** - * @see ::vsm_shutdown_domain + * @see ::vsm_shutdown_zone */ - VsmStatus vsm_shutdown_domain(const char* id) noexcept; + VsmStatus vsm_shutdown_zone(const char* id) noexcept; /** - * @see ::vsm_start_domain + * @see ::vsm_start_zone */ - VsmStatus vsm_start_domain(const char* id) noexcept; + VsmStatus vsm_start_zone(const char* id) noexcept; /** - * @see ::vsm_lock_domain + * @see ::vsm_lock_zone */ - VsmStatus vsm_lock_domain(const char* id) noexcept; + VsmStatus vsm_lock_zone(const char* id) noexcept; /** - * @see ::vsm_unlock_domain + * @see ::vsm_unlock_zone */ - VsmStatus vsm_unlock_domain(const char* id) noexcept; + VsmStatus vsm_unlock_zone(const char* id) noexcept; /** * @see ::vsm_add_state_callback @@ -183,7 +183,7 @@ public: /** * @see ::vsm_del_state_callback */ - VsmStatus vsm_domain_grant_device(const char* id, + VsmStatus vsm_zone_grant_device(const char* id, const char* device, uint32_t flags) noexcept; @@ -193,28 +193,28 @@ public: VsmStatus vsm_revoke_device(const char* id, const char* device) noexcept; /** - * @see ::vsm_domain_get_netdevs + * @see ::vsm_zone_get_netdevs */ - VsmStatus vsm_domain_get_netdevs(const char* domain, VsmArrayString* netdevIds) noexcept; + VsmStatus vsm_zone_get_netdevs(const char* zone, VsmArrayString* netdevIds) noexcept; /** * @see ::vsm_netdev_get_ipv4_addr */ - VsmStatus vsm_netdev_get_ipv4_addr(const char* domain, + VsmStatus vsm_netdev_get_ipv4_addr(const char* zone, const char* netdevId, struct in_addr *addr) noexcept; /** * @see ::vsm_netdev_get_ipv6_addr */ - VsmStatus vsm_netdev_get_ipv6_addr(const char* domain, + VsmStatus vsm_netdev_get_ipv6_addr(const char* zone, const char* netdevId, struct in6_addr *addr) noexcept; /** * @see ::vsm_netdev_set_ipv4_addr */ - VsmStatus vsm_netdev_set_ipv4_addr(const char* domain, + VsmStatus vsm_netdev_set_ipv4_addr(const char* zone, const char* netdevId, struct in_addr *addr, int prefix) noexcept; @@ -222,7 +222,7 @@ public: /** * @see ::vsm_netdev_set_ipv6_addr */ - VsmStatus vsm_netdev_set_ipv6_addr(const char* domain, + VsmStatus vsm_netdev_set_ipv6_addr(const char* zone, const char* netdevId, struct in6_addr *addr, int prefix) noexcept; @@ -230,7 +230,7 @@ public: /** * @see ::vsm_create_netdev */ - VsmStatus vsm_create_netdev(const char* domain, + VsmStatus vsm_create_netdev(const char* zone, VsmNetdevType netdevType, const char* target, const char* netdevId) noexcept; @@ -238,12 +238,12 @@ public: /** * @see ::vsm_destroy_netdev */ - VsmStatus vsm_destroy_netdev(const char* domain, const char* netdevId) noexcept; + VsmStatus vsm_destroy_netdev(const char* zone, const char* netdevId) noexcept; /** * @see ::vsm_lookup_netdev_by_name */ - VsmStatus vsm_lookup_netdev_by_name(const char* domain, + VsmStatus vsm_lookup_netdev_by_name(const char* zone, const char* netdevId, VsmNetdev* netdev) noexcept; diff --git a/client/security-containers-client.cpp b/client/security-containers-client.cpp index 3ebede0..054113e 100644 --- a/client/security-containers-client.cpp +++ b/client/security-containers-client.cpp @@ -88,11 +88,11 @@ API void vsm_string_free(VsmString string) free(string); } -API void vsm_domain_free(VsmDomain domain) +API void vsm_zone_free(VsmZone zone) { - free(domain->rootfs_path); - free(domain->id); - free(domain); + free(zone->rootfs_path); + free(zone->id); + free(zone); } API void vsm_netdev_free(VsmNetdev netdev) @@ -123,9 +123,9 @@ API VsmStatus vsm_get_container_dbuses(VsmClient client, VsmArrayString* keys, V return getClient(client).vsm_get_container_dbuses(keys, values); } -API VsmStatus vsm_get_domain_ids(VsmClient client, VsmArrayString* array) +API VsmStatus vsm_get_zone_ids(VsmClient client, VsmArrayString* array) { - return getClient(client).vsm_get_domain_ids(array); + return getClient(client).vsm_get_zone_ids(array); } API VsmStatus vsm_get_active_container_id(VsmClient client, VsmString* id) @@ -133,19 +133,19 @@ API VsmStatus vsm_get_active_container_id(VsmClient client, VsmString* id) return getClient(client).vsm_get_active_container_id(id); } -API VsmStatus vsm_lookup_domain_by_pid(VsmClient client, int pid, VsmString* id) +API VsmStatus vsm_lookup_zone_by_pid(VsmClient client, int pid, VsmString* id) { - return getClient(client).vsm_lookup_domain_by_pid(pid, id); + return getClient(client).vsm_lookup_zone_by_pid(pid, id); } -API VsmStatus vsm_lookup_domain_by_id(VsmClient client, const char* id, VsmDomain* domain) +API VsmStatus vsm_lookup_zone_by_id(VsmClient client, const char* id, VsmZone* zone) { - return getClient(client).vsm_lookup_domain_by_id(id, domain); + return getClient(client).vsm_lookup_zone_by_id(id, zone); } -API VsmStatus vsm_lookup_domain_by_terminal_id(VsmClient client, int terminal, VsmString* id) +API VsmStatus vsm_lookup_zone_by_terminal_id(VsmClient client, int terminal, VsmString* id) { - return getClient(client).vsm_lookup_domain_by_terminal_id(terminal, id); + return getClient(client).vsm_lookup_zone_by_terminal_id(terminal, id); } API VsmStatus vsm_set_active_container(VsmClient client, const char* id) @@ -153,34 +153,34 @@ API VsmStatus vsm_set_active_container(VsmClient client, const char* id) return getClient(client).vsm_set_active_container(id); } -API VsmStatus vsm_create_domain(VsmClient client, const char* id, const char* tname) +API VsmStatus vsm_create_zone(VsmClient client, const char* id, const char* tname) { - return getClient(client).vsm_create_domain(id, tname); + return getClient(client).vsm_create_zone(id, tname); } -API VsmStatus vsm_destroy_domain(VsmClient client, const char* id, int /*force*/) +API VsmStatus vsm_destroy_zone(VsmClient client, const char* id, int /*force*/) { - return getClient(client).vsm_destroy_domain(id); + return getClient(client).vsm_destroy_zone(id); } -API VsmStatus vsm_shutdown_domain(VsmClient client, const char* id) +API VsmStatus vsm_shutdown_zone(VsmClient client, const char* id) { - return getClient(client).vsm_shutdown_domain(id); + return getClient(client).vsm_shutdown_zone(id); } -API VsmStatus vsm_start_domain(VsmClient client, const char* id) +API VsmStatus vsm_start_zone(VsmClient client, const char* id) { - return getClient(client).vsm_start_domain(id); + return getClient(client).vsm_start_zone(id); } -API VsmStatus vsm_lock_domain(VsmClient client, const char* id) +API VsmStatus vsm_lock_zone(VsmClient client, const char* id) { - return getClient(client).vsm_lock_domain(id); + return getClient(client).vsm_lock_zone(id); } -API VsmStatus vsm_unlock_domain(VsmClient client, const char* id) +API VsmStatus vsm_unlock_zone(VsmClient client, const char* id) { - return getClient(client).vsm_unlock_domain(id); + return getClient(client).vsm_unlock_zone(id); } API VsmStatus vsm_add_state_callback(VsmClient client, @@ -196,12 +196,12 @@ API VsmStatus vsm_del_state_callback(VsmClient client, VsmSubscriptionId subscri return getClient(client).vsm_del_state_callback(subscriptionId); } -API VsmStatus vsm_domain_grant_device(VsmClient client, +API VsmStatus vsm_zone_grant_device(VsmClient client, const char* id, const char* device, uint32_t flags) { - return getClient(client).vsm_domain_grant_device(id, device, flags); + return getClient(client).vsm_zone_grant_device(id, device, flags); } API VsmStatus vsm_revoke_device(VsmClient client, const char* id, const char* device) @@ -209,67 +209,67 @@ API VsmStatus vsm_revoke_device(VsmClient client, const char* id, const char* de return getClient(client).vsm_revoke_device(id, device); } -API VsmStatus vsm_domain_get_netdevs(VsmClient client, - const char* domain, +API VsmStatus vsm_zone_get_netdevs(VsmClient client, + const char* zone, VsmArrayString* netdevIds) { - return getClient(client).vsm_domain_get_netdevs(domain, netdevIds); + return getClient(client).vsm_zone_get_netdevs(zone, netdevIds); } API VsmStatus vsm_netdev_get_ipv4_addr(VsmClient client, - const char* domain, + const char* zone, const char* netdevId, struct in_addr *addr) { - return getClient(client).vsm_netdev_get_ipv4_addr(domain, netdevId, addr); + return getClient(client).vsm_netdev_get_ipv4_addr(zone, netdevId, addr); } API VsmStatus vsm_netdev_get_ipv6_addr(VsmClient client, - const char* domain, + const char* zone, const char* netdevId, struct in6_addr *addr) { - return getClient(client).vsm_netdev_get_ipv6_addr(domain, netdevId, addr); + return getClient(client).vsm_netdev_get_ipv6_addr(zone, netdevId, addr); } API VsmStatus vsm_netdev_set_ipv4_addr(VsmClient client, - const char* domain, + const char* zone, const char* netdevId, struct in_addr *addr, int prefix) { - return getClient(client).vsm_netdev_set_ipv4_addr(domain, netdevId, addr, prefix); + return getClient(client).vsm_netdev_set_ipv4_addr(zone, netdevId, addr, prefix); } API VsmStatus vsm_netdev_set_ipv6_addr(VsmClient client, - const char* domain, + const char* zone, const char* netdevId, struct in6_addr *addr, int prefix) { - return getClient(client).vsm_netdev_set_ipv6_addr(domain, netdevId, addr, prefix); + return getClient(client).vsm_netdev_set_ipv6_addr(zone, netdevId, addr, prefix); } API VsmStatus vsm_create_netdev(VsmClient client, - const char* domain, + const char* zone, VsmNetdevType netdevType, const char* target, const char* netdevId) { - return getClient(client).vsm_create_netdev(domain, netdevType, target, netdevId); + return getClient(client).vsm_create_netdev(zone, netdevType, target, netdevId); } -API VsmStatus vsm_destroy_netdev(VsmClient client, const char* domain, const char* netdevId) +API VsmStatus vsm_destroy_netdev(VsmClient client, const char* zone, const char* netdevId) { - return getClient(client).vsm_destroy_netdev(domain, netdevId); + return getClient(client).vsm_destroy_netdev(zone, netdevId); } API VsmStatus vsm_lookup_netdev_by_name(VsmClient client, - const char* domain, + const char* zone, const char* netdevId, VsmNetdev* netdev) { - return getClient(client).vsm_lookup_netdev_by_name(domain, netdevId, netdev); + return getClient(client).vsm_lookup_netdev_by_name(zone, netdevId, netdev); } API VsmStatus vsm_declare_file(VsmClient client, diff --git a/client/security-containers-client.h b/client/security-containers-client.h index 2e4d96b..bafa35c 100644 --- a/client/security-containers-client.h +++ b/client/security-containers-client.h @@ -54,7 +54,7 @@ int main(int argc, char** argv) goto finish; } - status = vsm_get_domain_ids(client, &values); + status = vsm_get_zone_ids(client, &values); if (VSMCLIENT_SUCCESS != status) { // error! ret = 1; @@ -123,7 +123,7 @@ typedef enum { typedef unsigned int VsmSubscriptionId; /** - * States of domain + * States of zone */ typedef enum { STOPPED, @@ -137,22 +137,22 @@ typedef enum { LOCKED, MAX_STATE, ACTIVATING = 128 -} VsmDomainState; +} VsmZoneState; /** - * Domain information structure + * Zone information structure */ typedef struct { char* id; int terminal; - VsmDomainState state; + VsmZoneState state; char *rootfs_path; -} VsmDomainStructure; +} VsmZoneStructure; /** - * Domain information + * Zone information */ -typedef VsmDomainStructure* VsmDomain; +typedef VsmZoneStructure* VsmZone; /** * Netowrk device type @@ -266,11 +266,11 @@ void vsm_array_string_free(VsmArrayString astring); void vsm_string_free(VsmString string); /** - * Release VsmDomain + * Release VsmZone * - * @param domain VsmDomain + * @param zone VsmZone */ -void vsm_domain_free(VsmDomain domain); +void vsm_zone_free(VsmZone zone); /** * Release VsmNetdev @@ -318,7 +318,7 @@ VsmStatus vsm_get_container_dbuses(VsmClient client, VsmArrayString* keys, VsmAr * @return status of this function call * @remark Use vsm_array_string_free() to free memory occupied by @p array. */ -VsmStatus vsm_get_domain_ids(VsmClient client, VsmArrayString* array); +VsmStatus vsm_get_zone_ids(VsmClient client, VsmArrayString* array); /** * Get active (foreground) container name. @@ -339,29 +339,29 @@ VsmStatus vsm_get_active_container_id(VsmClient client, VsmString* id); * @return status of this function call * @remark Use @p vsm_string_free() to free memory occupied by @p id. */ -VsmStatus vsm_lookup_domain_by_pid(VsmClient client, int pid, VsmString* id); +VsmStatus vsm_lookup_zone_by_pid(VsmClient client, int pid, VsmString* id); /** - * Get domain informations of domain with given id. + * Get zone informations of zone with given id. * * @param[in] client security-containers-server's client - * @param[in] id domain name - * @param[out] domain domain informations + * @param[in] id zone name + * @param[out] zone zone informations * @return status of this function call - * @remark Use @p vsm_domain_free() to free memory occupied by @p domain + * @remark Use @p vsm_zone_free() to free memory occupied by @p zone */ -VsmStatus vsm_lookup_domain_by_id(VsmClient client, const char* id, VsmDomain* domain); +VsmStatus vsm_lookup_zone_by_id(VsmClient client, const char* id, VsmZone* zone); /** - * Get domain name with given terminal. + * Get zone name with given terminal. * * @param[in] client security-containers-server's client * @param[in] terminal terminal id - * @param[out] id domain name with given terminal + * @param[out] id zone name with given terminal * @return status of this function call * @remark Use @p vsm_string_free() to free memory occupied by @p id. */ -VsmStatus vsm_lookup_domain_by_terminal_id(VsmClient client, int terminal, VsmString* id); +VsmStatus vsm_lookup_zone_by_terminal_id(VsmClient client, int terminal, VsmString* id); /** * Set active (foreground) container. @@ -380,53 +380,53 @@ VsmStatus vsm_set_active_container(VsmClient client, const char* id); * @param[in] tname template name, NULL for default * @return status of this function call */ -VsmStatus vsm_create_domain(VsmClient client, const char* id, const char* tname); +VsmStatus vsm_create_zone(VsmClient client, const char* id, const char* tname); /** - * Remove domain + * Remove zone * * @param[in] client security-containers-server's client * @param[in] id container id * @param[in] force if 0 data will be kept, otherwise data will be lost * @return status of this function call */ -VsmStatus vsm_destroy_domain(VsmClient clent, const char* id, int force); +VsmStatus vsm_destroy_zone(VsmClient clent, const char* id, int force); /** - * Shutdown domain + * Shutdown zone * * @param[in] client security-containers-server's client - * @param[in] id domain name + * @param[in] id zone name * @return status of this function call */ -VsmStatus vsm_shutdown_domain(VsmClient client, const char* id); +VsmStatus vsm_shutdown_zone(VsmClient client, const char* id); /** - * Start domain + * Start zone * * @param[in] client security-containers-server's client - * @param[in] id domain name + * @param[in] id zone name * @return status of this function call */ -VsmStatus vsm_start_domain(VsmClient client, const char* id); +VsmStatus vsm_start_zone(VsmClient client, const char* id); /** - * Lock domain + * Lock zone * * @param[in] client security-containers-server's client - * @param[in] id domain name + * @param[in] id zone name * @return status of this function call */ -VsmStatus vsm_lock_domain(VsmClient client, const char* id); +VsmStatus vsm_lock_zone(VsmClient client, const char* id); /** - * Unlock domain + * Unlock zone * * @param[in] client security-containers-server's client - * @param[in] id domain name + * @param[in] id zone name * @return status of this function call */ -VsmStatus vsm_unlock_domain(VsmClient client, const char* id); +VsmStatus vsm_unlock_zone(VsmClient client, const char* id); /** * Register dbus state change callback function. @@ -458,13 +458,13 @@ VsmStatus vsm_del_state_callback(VsmClient client, VsmSubscriptionId subscriptio * Grant access to device * * @param[in] client security-containers-server's client - * @param[in] domain domain name + * @param[in] zone zone name * @param[in] device device path * @param[in] flags access flags * @return status of this function call */ -VsmStatus vsm_domain_grant_device(VsmClient client, - const char* domain, +VsmStatus vsm_zone_grant_device(VsmClient client, + const char* zone, const char* device, uint32_t flags); @@ -472,34 +472,34 @@ VsmStatus vsm_domain_grant_device(VsmClient client, * Revoke access to device * * @param[in] client security-containers-server's client - * @param[in] domain domain name + * @param[in] zone zone name * @param[in] device device path * @return status of this function call */ -VsmStatus vsm_revoke_device(VsmClient client, const char* domain, const char* device); +VsmStatus vsm_revoke_device(VsmClient client, const char* zone, const char* device); /** - * Get array of netdev from given domain + * Get array of netdev from given zone * * @param[in] client security-containers-server's client - * @param[in] domain domain name + * @param[in] zone zone name * @param[out] netdevIds array of netdev id * @return status of this function call * @remark Use vsm_array_string_free() to free memory occupied by @p netdevIds. */ -VsmStatus vsm_domain_get_netdevs(VsmClient client, const char* domain, VsmArrayString* netdevIds); +VsmStatus vsm_zone_get_netdevs(VsmClient client, const char* zone, VsmArrayString* netdevIds); /** * Get ipv4 address for given netdevId * * @param[in] client security-containers-server's client - * @param[in] domain domain name + * @param[in] zone zone name * @param[in] netdevId netdev id * @param[out] addr ipv4 address * @return status of this function call */ VsmStatus vsm_netdev_get_ipv4_addr(VsmClient client, - const char* domain, + const char* zone, const char* netdevId, struct in_addr *addr); @@ -507,13 +507,13 @@ VsmStatus vsm_netdev_get_ipv4_addr(VsmClient client, * Get ipv6 address for given netdevId * * @param[in] client security-containers-server's client - * @param[in] domain domain name + * @param[in] zone zone name * @param[in] netdevId netdev id * @param[out] addr ipv6 address * @return status of this function call */ VsmStatus vsm_netdev_get_ipv6_addr(VsmClient client, - const char* domain, + const char* zone, const char* netdevId, struct in6_addr *addr); @@ -521,14 +521,14 @@ VsmStatus vsm_netdev_get_ipv6_addr(VsmClient client, * Set ipv4 address for given netdevId * * @param[in] client security-containers-server's client - * @param[in] domain domain name + * @param[in] zone zone name * @param[in] netdevId netdev id * @param[in] addr ipv4 address * @param[in] prefix bit-length of the network prefix * @return status of this function call */ VsmStatus vsm_netdev_set_ipv4_addr(VsmClient client, - const char* domain, + const char* zone, const char* netdevId, struct in_addr *addr, int prefix); @@ -537,56 +537,56 @@ VsmStatus vsm_netdev_set_ipv4_addr(VsmClient client, * Set ipv6 address for given netdevId * * @param[in] client security-containers-server's client - * @param[in] domain domain name + * @param[in] zone zone name * @param[in] netdevId netdev id * @param[in] addr ipv6 address * @param[in] prefix bit-length of the network prefix * @return status of this function call */ VsmStatus vsm_netdev_set_ipv6_addr(VsmClient client, - const char* domain, + const char* zone, const char* netdevId, struct in6_addr *addr, int prefix); /** - * Create netdev in domain + * Create netdev in zone * * @param[in] client security-containers-server's client - * @param[in] domain domain name + * @param[in] zone zone name * @param[in] netdevType netdev type - * @param[in] target TODO: this is taken form domain-control + * @param[in] target TODO: this is taken form zone-control * @param[in] netdevId network device id * @return status of this function call */ VsmStatus vsm_create_netdev(VsmClient client, - const char* domain, + const char* zone, VsmNetdevType netdevType, const char* target, const char* netdevId); /** - * Remove netdev from domain + * Remove netdev from zone * * @param[in] client security-containers-server's client - * @param[in] domain domain name + * @param[in] zone zone name * @param[in] netdevId network device id * @return status of this function call */ -VsmStatus vsm_destroy_netdev(VsmClient client, const char* domain, const char* netdevId); +VsmStatus vsm_destroy_netdev(VsmClient client, const char* zone, const char* netdevId); /** * Get netdev informations * * @param[in] client security-containers-server's client - * @param[in] domain domain name + * @param[in] zone zone name * @param[in] netdevId network device id * @param[out] netdev netdev informations * @return status of this function call * @remark Use vsm_netdev_free() to free memory occupied by @p netdev. */ VsmStatus vsm_lookup_netdev_by_name(VsmClient client, - const char* domain, + const char* zone, const char* netdevId, VsmNetdev* netdev); @@ -657,9 +657,9 @@ VsmStatus vsm_declare_link(VsmClient client, /** - * @name Domain API + * @name Zone API * - * Functions using org.tizen.containers.domain.manager D-Bus interface. + * Functions using org.tizen.containers.zone.manager D-Bus interface. * * @{ */ @@ -722,7 +722,7 @@ VsmStatus vsm_add_notification_callback(VsmClient client, */ VsmStatus vsm_del_notification_callback(VsmClient client, VsmSubscriptionId subscriptionId); -/** @} */ // Domain API +/** @} */ // Zone API #ifdef __cplusplus } diff --git a/common/ipc/internals/socket.cpp b/common/ipc/internals/socket.cpp index 4ac977a..4db22fe 100644 --- a/common/ipc/internals/socket.cpp +++ b/common/ipc/internals/socket.cpp @@ -117,7 +117,7 @@ int Socket::getSystemdSocket(const std::string& path) return -1; } -int Socket::createDomainSocket(const std::string& path) +int Socket::createZoneSocket(const std::string& path) { // Isn't the path too long? if (path.size() >= sizeof(sockaddr_un::sun_path)) { @@ -162,7 +162,7 @@ Socket Socket::createSocket(const std::string& path) { // Initialize a socket int fd = getSystemdSocket(path); - fd = fd != -1 ? fd : createDomainSocket(path); + fd = fd != -1 ? fd : createZoneSocket(path); return Socket(fd); } diff --git a/common/ipc/internals/socket.hpp b/common/ipc/internals/socket.hpp index b7a6d40..717ba00 100644 --- a/common/ipc/internals/socket.hpp +++ b/common/ipc/internals/socket.hpp @@ -106,7 +106,7 @@ private: int mFD; mutable std::recursive_mutex mCommunicationMutex; - static int createDomainSocket(const std::string& path); + static int createZoneSocket(const std::string& path); static int getSystemdSocket(const std::string& path); }; diff --git a/common/lxc/domain.cpp b/common/lxc/domain.cpp index 24453a6..6df0317 100644 --- a/common/lxc/domain.cpp +++ b/common/lxc/domain.cpp @@ -19,7 +19,7 @@ /** * @file * @author Piotr Bartosiewicz (p.bartosiewi@partner.samsung.com) - * @brief Lxc domain + * @brief Lxc zone */ // Define macro USE_EXEC if you are goind to use valgrind @@ -51,8 +51,8 @@ namespace security_containers { namespace lxc { namespace { -#define ITEM(X) {#X, LxcDomain::State::X}, - const std::map STATE_MAP = { +#define ITEM(X) {#X, LxcZone::State::X}, + const std::map STATE_MAP = { ITEM(STOPPED) ITEM(STARTING) ITEM(RUNNING) @@ -65,9 +65,9 @@ namespace { #undef ITEM } // namespace -std::string LxcDomain::toString(State state) +std::string LxcZone::toString(State state) { -#define CASE(X) case LxcDomain::State::X: return #X; +#define CASE(X) case LxcZone::State::X: return #X; switch (state) { CASE(STOPPED) CASE(STARTING) @@ -82,49 +82,49 @@ std::string LxcDomain::toString(State state) throw LxcException("Invalid state"); } -LxcDomain::LxcDomain(const std::string& lxcPath, const std::string& domainName) +LxcZone::LxcZone(const std::string& lxcPath, const std::string& zoneName) : mContainer(nullptr) { - mContainer = lxc_container_new(domainName.c_str(), lxcPath.c_str()); + mContainer = lxc_container_new(zoneName.c_str(), lxcPath.c_str()); if (!mContainer) { - LOGE("Could not initialize lxc domain " << domainName << " in path " << lxcPath); - throw LxcException("Could not initialize lxc domain"); + LOGE("Could not initialize lxc zone " << zoneName << " in path " << lxcPath); + throw LxcException("Could not initialize lxc zone"); } } -LxcDomain::~LxcDomain() +LxcZone::~LxcZone() { lxc_container_put(mContainer); } -std::string LxcDomain::getName() const +std::string LxcZone::getName() const { return mContainer->name; } -std::string LxcDomain::getConfigItem(const std::string& key) +std::string LxcZone::getConfigItem(const std::string& key) { char buffer[1024]; int len = mContainer->get_config_item(mContainer, key.c_str(), buffer, sizeof(buffer)); if (len < 0) { - LOGE("Key '" << key << "' not found in domain " << getName()); + LOGE("Key '" << key << "' not found in zone " << getName()); throw LxcException("Key not found"); } return buffer; } -bool LxcDomain::isDefined() +bool LxcZone::isDefined() { return mContainer->is_defined(mContainer); } -LxcDomain::State LxcDomain::getState() +LxcZone::State LxcZone::getState() { const std::string str = mContainer->state(mContainer); return STATE_MAP.at(str); } -bool LxcDomain::create(const std::string& templatePath, const char* const* argv) +bool LxcZone::create(const std::string& templatePath, const char* const* argv) { #ifdef USE_EXEC utils::CStringArrayBuilder args; @@ -138,7 +138,7 @@ bool LxcDomain::create(const std::string& templatePath, const char* const* argv) } if (!utils::executeAndWait("/usr/bin/lxc-create", args.c_array())) { - LOGE("Could not create domain " << getName()); + LOGE("Could not create zone " << getName()); return false; } @@ -149,23 +149,23 @@ bool LxcDomain::create(const std::string& templatePath, const char* const* argv) templatePath.c_str(), NULL, NULL, 0, const_cast(argv))) { - LOGE("Could not create domain " << getName()); + LOGE("Could not create zone " << getName()); return false; } return true; #endif } -bool LxcDomain::destroy() +bool LxcZone::destroy() { if (!mContainer->destroy(mContainer)) { - LOGE("Could not destroy domain " << getName()); + LOGE("Could not destroy zone " << getName()); return false; } return true; } -bool LxcDomain::start(const char* const* argv) +bool LxcZone::start(const char* const* argv) { #ifdef USE_EXEC if (mContainer->is_running(mContainer)) { @@ -185,7 +185,7 @@ bool LxcDomain::start(const char* const* argv) } if (!utils::executeAndWait("/usr/bin/lxc-start", args.c_array())) { - LOGE("Could not start domain " << getName()); + LOGE("Could not start zone " << getName()); return false; } @@ -193,7 +193,7 @@ bool LxcDomain::start(const char* const* argv) // we have to check status because lxc-start runs in daemonized mode if (!mContainer->is_running(mContainer)) { - LOGE("Could not start init in domain " << getName()); + LOGE("Could not start init in zone " << getName()); return false; } return true; @@ -203,43 +203,43 @@ bool LxcDomain::start(const char* const* argv) return false; } if (!mContainer->want_daemonize(mContainer, true)) { - LOGE("Could not configure domain " << getName()); + LOGE("Could not configure zone " << getName()); return false; } if (!mContainer->start(mContainer, false, const_cast(argv))) { - LOGE("Could not start domain " << getName()); + LOGE("Could not start zone " << getName()); return false; } return true; #endif } -bool LxcDomain::stop() +bool LxcZone::stop() { if (!mContainer->stop(mContainer)) { - LOGE("Could not stop domain " << getName()); + LOGE("Could not stop zone " << getName()); return false; } return true; } -bool LxcDomain::reboot() +bool LxcZone::reboot() { if (!mContainer->reboot(mContainer)) { - LOGE("Could not reboot domain " << getName()); + LOGE("Could not reboot zone " << getName()); return false; } return true; } -bool LxcDomain::shutdown(int timeout) +bool LxcZone::shutdown(int timeout) { State state = getState(); if (state == State::STOPPED) { return true; } if (state != State::RUNNING) { - LOGE("Could not gracefully shutdown domain " << getName()); + LOGE("Could not gracefully shutdown zone " << getName()); return false; } @@ -253,7 +253,7 @@ bool LxcDomain::shutdown(int timeout) .add("--nokill"); if (!utils::executeAndWait("/usr/bin/lxc-stop", args.c_array())) { - LOGE("Could not gracefully shutdown domain " << getName() << " in " << timeout << "s"); + LOGE("Could not gracefully shutdown zone " << getName() << " in " << timeout << "s"); return false; } @@ -263,50 +263,50 @@ bool LxcDomain::shutdown(int timeout) // try shutdown by sending poweroff to init if (setRunLevel(utils::RUNLEVEL_POWEROFF)) { if (!waitForState(State::STOPPED, timeout)) { - LOGE("Could not gracefully shutdown domain " << getName() << " in " << timeout << "s"); + LOGE("Could not gracefully shutdown zone " << getName() << " in " << timeout << "s"); return false; } return true; } - LOGW("SetRunLevel failed for domain " + getName()); + LOGW("SetRunLevel failed for zone " + getName()); // fallback for other inits like bash: lxc sends 'lxc.haltsignal' signal to init if (!mContainer->shutdown(mContainer, timeout)) { - LOGE("Could not gracefully shutdown domain " << getName() << " in " << timeout << "s"); + LOGE("Could not gracefully shutdown zone " << getName() << " in " << timeout << "s"); return false; } return true; #endif } -bool LxcDomain::freeze() +bool LxcZone::freeze() { if (!mContainer->freeze(mContainer)) { - LOGE("Could not freeze domain " << getName()); + LOGE("Could not freeze zone " << getName()); return false; } return true; } -bool LxcDomain::unfreeze() +bool LxcZone::unfreeze() { if (!mContainer->unfreeze(mContainer)) { - LOGE("Could not unfreeze domain " << getName()); + LOGE("Could not unfreeze zone " << getName()); return false; } return true; } -bool LxcDomain::waitForState(State state, int timeout) +bool LxcZone::waitForState(State state, int timeout) { if (!mContainer->wait(mContainer, toString(state).c_str(), timeout)) { - LOGD("Timeout while waiting for state " << toString(state) << " of domain " << getName()); + LOGD("Timeout while waiting for state " << toString(state) << " of zone " << getName()); return false; } return true; } -bool LxcDomain::setRunLevel(int runLevel) +bool LxcZone::setRunLevel(int runLevel) { auto callback = [](void* param) -> int { utils::RunLevel runLevel = *reinterpret_cast(param); @@ -326,13 +326,13 @@ bool LxcDomain::setRunLevel(int runLevel) return status == 0; } -void LxcDomain::refresh() +void LxcZone::refresh() { - //TODO Consider make LxcDomain state-less - std::string domainName = mContainer->name; + //TODO Consider make LxcZone state-less + std::string zoneName = mContainer->name; std::string lxcPath = mContainer->config_path; lxc_container_put(mContainer); - mContainer = lxc_container_new(domainName.c_str(), lxcPath.c_str()); + mContainer = lxc_container_new(zoneName.c_str(), lxcPath.c_str()); } diff --git a/common/lxc/domain.hpp b/common/lxc/domain.hpp index 3c45b85..55eecd8 100644 --- a/common/lxc/domain.hpp +++ b/common/lxc/domain.hpp @@ -19,7 +19,7 @@ /** * @file * @author Piotr Bartosiewicz (p.bartosiewi@partner.samsung.com) - * @brief Lxc domain + * @brief Lxc zone */ #ifndef COMMON_LXC_DOMAIN_HPP @@ -37,7 +37,7 @@ namespace lxc { /** * A class wwapping lxc container */ -class LxcDomain { +class LxcZone { public: enum class State { STOPPED, @@ -51,18 +51,18 @@ public: }; /** - * LxcDomain constructor + * LxcZone constructor * @param lxcPath path where containers lives - * @param domainName name of domain + * @param zoneName name of zone */ - LxcDomain(const std::string& lxcPath, const std::string& domainName); - ~LxcDomain(); + LxcZone(const std::string& lxcPath, const std::string& zoneName); + ~LxcZone(); - LxcDomain(const LxcDomain&) = delete; - LxcDomain& operator=(const LxcDomain&) = delete; + LxcZone(const LxcZone&) = delete; + LxcZone& operator=(const LxcZone&) = delete; /** - * Get domain name + * Get zone name */ std::string getName() const; @@ -73,7 +73,7 @@ public: std::string getConfigItem(const std::string& key); /** - * Is domain defined (created)? + * Is zone defined (created)? */ bool isDefined(); @@ -83,57 +83,57 @@ public: static std::string toString(State state); /** - * Get domain state + * Get zone state */ State getState(); /** - * Wait till domain is in specified state + * Wait till zone is in specified state * @return false on timeout */ bool waitForState(State state, int timeout); /** - * Create domain - * @param templatePath template from which domain will be created + * Create zone + * @param templatePath template from which zone will be created * @param argv additional template arguments */ bool create(const std::string& templatePath, const char* const* argv); /** - * Destroy domain + * Destroy zone */ bool destroy(); /** - * Start domain + * Start zone * @param argv init process with arguments */ bool start(const char* const* argv); /** - * Immediate stop the domain - * It kills all processes within this domain + * Immediate stop the zone + * It kills all processes within this zone */ bool stop(); /** - * Reboot domain + * Reboot zone */ bool reboot(); /** - * Gracefully shutdown domain. + * Gracefully shutdown zone. */ bool shutdown(int timeout); /** - * Freeze (pause/lock) domain + * Freeze (pause/lock) zone */ bool freeze(); /** - * Unfreeze domain + * Unfreeze zone */ bool unfreeze(); private: diff --git a/container-daemon/CMakeLists.txt b/container-daemon/CMakeLists.txt index 769eb7f..d702c8e 100644 --- a/container-daemon/CMakeLists.txt +++ b/container-daemon/CMakeLists.txt @@ -42,8 +42,8 @@ TARGET_LINK_LIBRARIES(${CONTAINER_DAEMON_CODENAME} ${CONTAINER_DAEMON_DEPS_LIBRA ## Install ##################################################################### INSTALL(TARGETS ${CONTAINER_DAEMON_CODENAME} DESTINATION bin) -CONFIGURE_FILE(configs/org.tizen.containers.domain.daemon.conf.in - ${CMAKE_BINARY_DIR}/configs/org.tizen.containers.domain.daemon.conf) +CONFIGURE_FILE(configs/org.tizen.containers.zone.daemon.conf.in + ${CMAKE_BINARY_DIR}/configs/org.tizen.containers.zone.daemon.conf) -INSTALL(FILES ${CMAKE_BINARY_DIR}/configs/org.tizen.containers.domain.daemon.conf +INSTALL(FILES ${CMAKE_BINARY_DIR}/configs/org.tizen.containers.zone.daemon.conf DESTINATION /etc/dbus-1/system.d/) diff --git a/container-daemon/configs/org.tizen.containers.domain.daemon.conf.in b/container-daemon/configs/org.tizen.containers.domain.daemon.conf.in deleted file mode 100644 index e080a1d..0000000 --- a/container-daemon/configs/org.tizen.containers.domain.daemon.conf.in +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - diff --git a/container-daemon/configs/org.tizen.containers.zone.daemon.conf.in b/container-daemon/configs/org.tizen.containers.zone.daemon.conf.in new file mode 100644 index 0000000..efb60b2 --- /dev/null +++ b/container-daemon/configs/org.tizen.containers.zone.daemon.conf.in @@ -0,0 +1,14 @@ + + + + + + + + + + + + + diff --git a/container-daemon/daemon-dbus-definitions.hpp b/container-daemon/daemon-dbus-definitions.hpp index f18d87f..4580d39 100644 --- a/container-daemon/daemon-dbus-definitions.hpp +++ b/container-daemon/daemon-dbus-definitions.hpp @@ -32,9 +32,9 @@ namespace security_containers { namespace container_daemon { namespace api { -const std::string BUS_NAME = "org.tizen.containers.domain.daemon"; -const std::string OBJECT_PATH = "/org/tizen/containers/domain/daemon"; -const std::string INTERFACE = "org.tizen.containers.domain.daemon"; +const std::string BUS_NAME = "org.tizen.containers.zone.daemon"; +const std::string OBJECT_PATH = "/org/tizen/containers/zone/daemon"; +const std::string INTERFACE = "org.tizen.containers.zone.daemon"; const std::string METHOD_GAIN_FOCUS = "GainFocus"; const std::string METHOD_LOSE_FOCUS = "LoseFocus"; diff --git a/container-support/CMakeLists.txt b/container-support/CMakeLists.txt index 3b26157..79bdb9c 100644 --- a/container-support/CMakeLists.txt +++ b/container-support/CMakeLists.txt @@ -23,8 +23,8 @@ MESSAGE(STATUS "Generating makefile for the Container Support...") ## Install ##################################################################### -CONFIGURE_FILE(configs/org.tizen.containers.domain.conf.in - ${CMAKE_BINARY_DIR}/dbus-1/system.d/org.tizen.containers.domain.conf) +CONFIGURE_FILE(configs/org.tizen.containers.zone.conf.in + ${CMAKE_BINARY_DIR}/dbus-1/system.d/org.tizen.containers.zone.conf) -INSTALL(FILES ${CMAKE_BINARY_DIR}/dbus-1/system.d/org.tizen.containers.domain.conf +INSTALL(FILES ${CMAKE_BINARY_DIR}/dbus-1/system.d/org.tizen.containers.zone.conf DESTINATION /etc/dbus-1/system.d/) diff --git a/container-support/configs/org.tizen.containers.domain.conf.in b/container-support/configs/org.tizen.containers.domain.conf.in deleted file mode 100644 index 49da048..0000000 --- a/container-support/configs/org.tizen.containers.domain.conf.in +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - diff --git a/container-support/configs/org.tizen.containers.zone.conf.in b/container-support/configs/org.tizen.containers.zone.conf.in new file mode 100644 index 0000000..264e915 --- /dev/null +++ b/container-support/configs/org.tizen.containers.zone.conf.in @@ -0,0 +1,14 @@ + + + + + + + + + + + + + diff --git a/packaging/security-containers.spec b/packaging/security-containers.spec index 3425c51..47833e4 100644 --- a/packaging/security-containers.spec +++ b/packaging/security-containers.spec @@ -163,7 +163,7 @@ Containers support installed inside every container. %files container-support %manifest packaging/security-containers-container-support.manifest %defattr(644,root,root,755) -/etc/dbus-1/system.d/org.tizen.containers.domain.conf +/etc/dbus-1/system.d/org.tizen.containers.zone.conf ## Container Daemon Package #################################################### @@ -180,7 +180,7 @@ Daemon running inside every container. %manifest packaging/security-containers-container-daemon.manifest %defattr(644,root,root,755) %attr(755,root,root) %{_bindir}/security-containers-container-daemon -/etc/dbus-1/system.d/org.tizen.containers.domain.daemon.conf +/etc/dbus-1/system.d/org.tizen.containers.zone.daemon.conf ## Command Line Interface ###################################################### diff --git a/server/container-admin.cpp b/server/container-admin.cpp index 1d8cdee..bd9f8f1 100644 --- a/server/container-admin.cpp +++ b/server/container-admin.cpp @@ -61,7 +61,7 @@ ContainerAdmin::ContainerAdmin(const std::string& containersPath, const std::string lxcTemplate = utils::getAbsolutePath(config.lxcTemplate, lxcTemplatePrefix); - LOGI(mId << ": Creating domain from template: " << lxcTemplate); + LOGI(mId << ": Creating zone from template: " << lxcTemplate); utils::CStringArrayBuilder args; if (!config.ipv4Gateway.empty()) { args.add("--ipv4-gateway"); @@ -72,7 +72,7 @@ ContainerAdmin::ContainerAdmin(const std::string& containersPath, args.add(config.ipv4.c_str()); } if (!mDom.create(lxcTemplate, args.c_array())) { - throw ContainerOperationException("Could not create domain"); + throw ContainerOperationException("Could not create zone"); } } } @@ -165,13 +165,13 @@ void ContainerAdmin::destroy() bool ContainerAdmin::isRunning() { - return mDom.getState() == lxc::LxcDomain::State::RUNNING; + return mDom.getState() == lxc::LxcZone::State::RUNNING; } bool ContainerAdmin::isStopped() { - return mDom.getState() == lxc::LxcDomain::State::STOPPED; + return mDom.getState() == lxc::LxcZone::State::STOPPED; } @@ -197,7 +197,7 @@ void ContainerAdmin::resume() bool ContainerAdmin::isPaused() { - return mDom.getState() == lxc::LxcDomain::State::FROZEN; + return mDom.getState() == lxc::LxcZone::State::FROZEN; } diff --git a/server/container-admin.hpp b/server/container-admin.hpp index f3c9a4f..67a8485 100644 --- a/server/container-admin.hpp +++ b/server/container-admin.hpp @@ -128,7 +128,7 @@ public: private: const ContainerConfig& mConfig; - lxc::LxcDomain mDom; + lxc::LxcZone mDom; const std::string mId; bool mDetachOnExit; bool mDestroyOnExit; diff --git a/server/container-config.hpp b/server/container-config.hpp index 779415d..c1ba2e9 100644 --- a/server/container-config.hpp +++ b/server/container-config.hpp @@ -81,7 +81,7 @@ struct ContainerConfig { /** * Specify, if D-Bus communication with the container will be enabled. - * Setting this value to "false" will make the domain API not work inside the container. + * Setting this value to "false" will make the zone API not work inside the container. */ bool enableDbusIntegration; diff --git a/server/container-dbus-definitions.hpp b/server/container-dbus-definitions.hpp index 0e280d4..d22c633 100644 --- a/server/container-dbus-definitions.hpp +++ b/server/container-dbus-definitions.hpp @@ -32,9 +32,9 @@ namespace security_containers { namespace api { namespace container { -const std::string BUS_NAME = "org.tizen.containers.domain"; -const std::string OBJECT_PATH = "/org/tizen/containers/domain"; -const std::string INTERFACE = "org.tizen.containers.domain.manager"; +const std::string BUS_NAME = "org.tizen.containers.zone"; +const std::string OBJECT_PATH = "/org/tizen/containers/zone"; +const std::string INTERFACE = "org.tizen.containers.zone.manager"; const std::string METHOD_NOTIFY_ACTIVE_CONTAINER = "NotifyActiveContainer"; const std::string METHOD_FILE_MOVE_REQUEST = "FileMoveRequest"; diff --git a/server/host-connection.hpp b/server/host-connection.hpp index 0030efc..bbec909 100644 --- a/server/host-connection.hpp +++ b/server/host-connection.hpp @@ -112,7 +112,7 @@ public: void signalContainerDbusState(const std::string& containerId, const std::string& dbusAddress); /** - * Register a callback called to get a list of domain ids + * Register a callback called to get a list of zone ids */ void setGetContainerIdsCallback(const GetContainerIdsCallback& callback); diff --git a/tests/integration_tests/common/sc_test_utils.py b/tests/integration_tests/common/sc_test_utils.py index 4e77824..bb84f99 100644 --- a/tests/integration_tests/common/sc_test_utils.py +++ b/tests/integration_tests/common/sc_test_utils.py @@ -1,4 +1,4 @@ -'''! Module containing utilities for domain-tests +'''! Module containing utilities for zone-tests @author Lukasz Kostyra (l.kostyra@samsung.com) ''' diff --git a/tests/integration_tests/image_tests/config_checker.py b/tests/integration_tests/image_tests/config_checker.py index 6788bbe..4cc2d18 100644 --- a/tests/integration_tests/image_tests/config_checker.py +++ b/tests/integration_tests/image_tests/config_checker.py @@ -17,7 +17,7 @@ class ConfigChecker: def __parseLibvirtXML(self, path): '''! Parses libvirt's configuration in order to extract container name and path. - @param path Libvirt's domain configuration path + @param path Libvirt's zone configuration path ''' tree = ET.parse(path) root = tree.getroot() diff --git a/tests/integration_tests/image_tests/image_tests.py b/tests/integration_tests/image_tests/image_tests.py index 34e61cc6..a74c5ac 100644 --- a/tests/integration_tests/image_tests/image_tests.py +++ b/tests/integration_tests/image_tests/image_tests.py @@ -12,7 +12,7 @@ import xml.etree.ElementTree as ET SCS_USER_NAME = "security-containers" SCS_UID = 377 -DAEMON_DBUS_SOCKET_NAME = "org.tizen.containers.domain" +DAEMON_DBUS_SOCKET_NAME = "org.tizen.containers.zone" # dbus config file path relative to container's root DBUS_CONFIG_PATH = "etc/dbus-1/system.d/" + DAEMON_DBUS_SOCKET_NAME + ".conf" diff --git a/tests/unit_tests/client/ut-client.cpp b/tests/unit_tests/client/ut-client.cpp index 61ed580..838f8bf 100644 --- a/tests/unit_tests/client/ut-client.cpp +++ b/tests/unit_tests/client/ut-client.cpp @@ -168,7 +168,7 @@ BOOST_AUTO_TEST_CASE(GetContainerIdsTest) VsmStatus status = vsm_connect(client); BOOST_REQUIRE_EQUAL(VSMCLIENT_SUCCESS, status); VsmArrayString values; - status = vsm_get_domain_ids(client, &values); + status = vsm_get_zone_ids(client, &values); BOOST_REQUIRE_EQUAL(VSMCLIENT_SUCCESS, status); BOOST_CHECK_EQUAL(getArrayStringLength(values, EXPECTED_DBUSES_STARTED.size() + 1), EXPECTED_DBUSES_STARTED.size()); @@ -220,7 +220,7 @@ BOOST_AUTO_TEST_CASE(CreateContainerTest) VsmClient client = vsm_client_create(); VsmStatus status = vsm_connect(client); BOOST_REQUIRE_EQUAL(VSMCLIENT_SUCCESS, status); - status = vsm_create_domain(client, newActiveContainerId.c_str(), NULL); + status = vsm_create_zone(client, newActiveContainerId.c_str(), NULL); BOOST_REQUIRE_EQUAL(VSMCLIENT_CUSTOM_ERROR, status); vsm_client_free(client); } @@ -232,9 +232,9 @@ BOOST_AUTO_TEST_CASE(LockUnlockContainerTest) VsmClient client = vsm_client_create(); VsmStatus status = vsm_connect(client); BOOST_REQUIRE_EQUAL(VSMCLIENT_SUCCESS, status); - status = vsm_lock_domain(client, newActiveContainerId.c_str()); + status = vsm_lock_zone(client, newActiveContainerId.c_str()); BOOST_REQUIRE_EQUAL(VSMCLIENT_SUCCESS, status); - status = vsm_unlock_domain(client, newActiveContainerId.c_str()); + status = vsm_unlock_zone(client, newActiveContainerId.c_str()); BOOST_REQUIRE_EQUAL(VSMCLIENT_SUCCESS, status); vsm_client_free(client); } @@ -313,7 +313,7 @@ BOOST_AUTO_TEST_CASE(GetContainerIdByPidTest1) { VsmClient client = vsm_client_create(); VsmString container; - VsmStatus status = vsm_lookup_domain_by_pid(client, 1, &container); + VsmStatus status = vsm_lookup_zone_by_pid(client, 1, &container); BOOST_REQUIRE_EQUAL(VSMCLIENT_SUCCESS, status); BOOST_CHECK_EQUAL(container, std::string("host")); @@ -329,7 +329,7 @@ BOOST_AUTO_TEST_CASE(GetContainerIdByPidTest2) VsmClient client = vsm_client_create(); for (int n = 0; n < 100000; ++n) { VsmString container; - VsmStatus status = vsm_lookup_domain_by_pid(client, n, &container); + VsmStatus status = vsm_lookup_zone_by_pid(client, n, &container); if (status == VSMCLIENT_SUCCESS) { ids.insert(container); vsm_string_free(container); diff --git a/tests/unit_tests/lxc/ut-domain.cpp b/tests/unit_tests/lxc/ut-domain.cpp index a9942b8..d618a11 100644 --- a/tests/unit_tests/lxc/ut-domain.cpp +++ b/tests/unit_tests/lxc/ut-domain.cpp @@ -20,7 +20,7 @@ /** * @file * @author Piotr Bartosiewicz (p.bartosiewi@partner.samsung.com) - * @brief Unit tests of LxcDomain class + * @brief Unit tests of LxcZone class */ #include "config.hpp" @@ -40,7 +40,7 @@ using namespace security_containers; using namespace security_containers::lxc; const std::string LXC_PATH = "/tmp/ut-lxc/"; -const std::string DOMAIN_NAME = "ut-domain"; +const std::string ZONE_NAME = "ut-zone"; const std::string TEMPLATE = SC_TEST_LXC_TEMPLATES_INSTALL_DIR "/minimal.sh"; const char* TEMPLATE_ARGS[] = {NULL}; @@ -60,9 +60,9 @@ struct Fixture { void cleanup() { - LxcDomain lxc(LXC_PATH, DOMAIN_NAME); + LxcZone lxc(LXC_PATH, ZONE_NAME); if (lxc.isDefined()) { - if (lxc.getState() != LxcDomain::State::STOPPED) { + if (lxc.getState() != LxcZone::State::STOPPED) { lxc.stop(); } lxc.destroy(); @@ -78,22 +78,22 @@ struct Fixture { } // namespace -BOOST_FIXTURE_TEST_SUITE(LxcDomainSuite, Fixture) +BOOST_FIXTURE_TEST_SUITE(LxcZoneSuite, Fixture) BOOST_AUTO_TEST_CASE(ConstructorDestructorTest) { - LxcDomain lxc(LXC_PATH, DOMAIN_NAME); + LxcZone lxc(LXC_PATH, ZONE_NAME); } BOOST_AUTO_TEST_CASE(CreateDestroyTest) { - LxcDomain lxc(LXC_PATH, DOMAIN_NAME); + LxcZone lxc(LXC_PATH, ZONE_NAME); BOOST_CHECK(!lxc.isDefined()); BOOST_CHECK(lxc.create(TEMPLATE, TEMPLATE_ARGS)); BOOST_CHECK(lxc.isDefined()); - BOOST_CHECK_EQUAL(lxc.getConfigItem("lxc.rootfs"), LXC_PATH + DOMAIN_NAME + "/rootfs"); + BOOST_CHECK_EQUAL(lxc.getConfigItem("lxc.rootfs"), LXC_PATH + ZONE_NAME + "/rootfs"); BOOST_CHECK_THROW(lxc.getConfigItem("xxx"), LxcException); BOOST_CHECK(lxc.destroy()); @@ -104,11 +104,11 @@ BOOST_AUTO_TEST_CASE(CreateDestroyTest) BOOST_AUTO_TEST_CASE(StartShutdownTest) { { - LxcDomain lxc(LXC_PATH, DOMAIN_NAME); + LxcZone lxc(LXC_PATH, ZONE_NAME); BOOST_CHECK(lxc.create(TEMPLATE, TEMPLATE_ARGS)); } - LxcDomain lxc(LXC_PATH, DOMAIN_NAME); - BOOST_CHECK(lxc.getState() == LxcDomain::State::STOPPED); + LxcZone lxc(LXC_PATH, ZONE_NAME); + BOOST_CHECK(lxc.getState() == LxcZone::State::STOPPED); const char* argv[] = { "/bin/sh", "-c", @@ -116,10 +116,10 @@ BOOST_AUTO_TEST_CASE(StartShutdownTest) NULL }; BOOST_CHECK(lxc.start(argv)); - BOOST_CHECK(lxc.getState() == LxcDomain::State::RUNNING); + BOOST_CHECK(lxc.getState() == LxcZone::State::RUNNING); waitForInit(); BOOST_CHECK(lxc.shutdown(2)); - BOOST_CHECK(lxc.getState() == LxcDomain::State::STOPPED); + BOOST_CHECK(lxc.getState() == LxcZone::State::STOPPED); BOOST_CHECK(lxc.destroy()); } @@ -127,21 +127,21 @@ BOOST_AUTO_TEST_CASE(StartShutdownTest) BOOST_AUTO_TEST_CASE(StartStopTest) { { - LxcDomain lxc(LXC_PATH, DOMAIN_NAME); + LxcZone lxc(LXC_PATH, ZONE_NAME); BOOST_CHECK(lxc.create(TEMPLATE, TEMPLATE_ARGS)); } - LxcDomain lxc(LXC_PATH, DOMAIN_NAME); - BOOST_CHECK(lxc.getState() == LxcDomain::State::STOPPED); + LxcZone lxc(LXC_PATH, ZONE_NAME); + BOOST_CHECK(lxc.getState() == LxcZone::State::STOPPED); const char* argv[] = { "/bin/sh", NULL }; BOOST_CHECK(lxc.start(argv)); - BOOST_CHECK(lxc.getState() == LxcDomain::State::RUNNING); + BOOST_CHECK(lxc.getState() == LxcZone::State::RUNNING); BOOST_CHECK(!lxc.shutdown(1)); - BOOST_CHECK(lxc.getState() == LxcDomain::State::RUNNING); + BOOST_CHECK(lxc.getState() == LxcZone::State::RUNNING); BOOST_CHECK(lxc.stop()); - BOOST_CHECK(lxc.getState() == LxcDomain::State::STOPPED); + BOOST_CHECK(lxc.getState() == LxcZone::State::STOPPED); BOOST_CHECK(lxc.destroy()); } @@ -149,11 +149,11 @@ BOOST_AUTO_TEST_CASE(StartStopTest) BOOST_AUTO_TEST_CASE(StartHasStoppedTest) { { - LxcDomain lxc(LXC_PATH, DOMAIN_NAME); + LxcZone lxc(LXC_PATH, ZONE_NAME); BOOST_CHECK(lxc.create(TEMPLATE, TEMPLATE_ARGS)); } - LxcDomain lxc(LXC_PATH, DOMAIN_NAME); - BOOST_CHECK(lxc.getState() == LxcDomain::State::STOPPED); + LxcZone lxc(LXC_PATH, ZONE_NAME); + BOOST_CHECK(lxc.getState() == LxcZone::State::STOPPED); const char* argv[] = { "/bin/sh", "-c", @@ -162,14 +162,14 @@ BOOST_AUTO_TEST_CASE(StartHasStoppedTest) }; BOOST_CHECK(lxc.start(argv)); waitForInit(); - BOOST_CHECK(lxc.getState() == LxcDomain::State::STOPPED); + BOOST_CHECK(lxc.getState() == LxcZone::State::STOPPED); BOOST_CHECK(lxc.destroy()); } BOOST_AUTO_TEST_CASE(FreezeUnfreezeTest) { - LxcDomain lxc(LXC_PATH, DOMAIN_NAME); + LxcZone lxc(LXC_PATH, ZONE_NAME); BOOST_CHECK(lxc.create(TEMPLATE, TEMPLATE_ARGS)); const char* argv[] = { "/bin/sh", @@ -178,21 +178,21 @@ BOOST_AUTO_TEST_CASE(FreezeUnfreezeTest) NULL }; BOOST_CHECK(lxc.start(argv)); - BOOST_CHECK(lxc.getState() == LxcDomain::State::RUNNING); + BOOST_CHECK(lxc.getState() == LxcZone::State::RUNNING); waitForInit(); BOOST_CHECK(lxc.freeze()); - BOOST_CHECK(lxc.getState() == LxcDomain::State::FROZEN); + BOOST_CHECK(lxc.getState() == LxcZone::State::FROZEN); BOOST_CHECK(lxc.unfreeze()); - BOOST_CHECK(lxc.getState() == LxcDomain::State::RUNNING); + BOOST_CHECK(lxc.getState() == LxcZone::State::RUNNING); BOOST_CHECK(lxc.shutdown(2)); - BOOST_CHECK(lxc.getState() == LxcDomain::State::STOPPED); + BOOST_CHECK(lxc.getState() == LxcZone::State::STOPPED); BOOST_CHECK(lxc.destroy()); } BOOST_AUTO_TEST_CASE(FreezeStopTest) { - LxcDomain lxc(LXC_PATH, DOMAIN_NAME); + LxcZone lxc(LXC_PATH, ZONE_NAME); BOOST_CHECK(lxc.create(TEMPLATE, TEMPLATE_ARGS)); const char* argv[] = { "/bin/sh", @@ -201,21 +201,21 @@ BOOST_AUTO_TEST_CASE(FreezeStopTest) NULL }; BOOST_CHECK(lxc.start(argv)); - BOOST_CHECK(lxc.getState() == LxcDomain::State::RUNNING); + BOOST_CHECK(lxc.getState() == LxcZone::State::RUNNING); waitForInit(); BOOST_CHECK(lxc.freeze()); - BOOST_CHECK(lxc.getState() == LxcDomain::State::FROZEN); + BOOST_CHECK(lxc.getState() == LxcZone::State::FROZEN); BOOST_CHECK(!lxc.shutdown(1)); - BOOST_CHECK(lxc.getState() == LxcDomain::State::FROZEN); + BOOST_CHECK(lxc.getState() == LxcZone::State::FROZEN); BOOST_CHECK(lxc.stop()); - BOOST_CHECK(lxc.getState() == LxcDomain::State::STOPPED); + BOOST_CHECK(lxc.getState() == LxcZone::State::STOPPED); BOOST_CHECK(lxc.destroy()); } BOOST_AUTO_TEST_CASE(RepeatTest) { - LxcDomain lxc(LXC_PATH, DOMAIN_NAME); + LxcZone lxc(LXC_PATH, ZONE_NAME); BOOST_CHECK(lxc.create(TEMPLATE, TEMPLATE_ARGS)); BOOST_CHECK(!lxc.create(TEMPLATE, TEMPLATE_ARGS));// forbidden const char* argv[] = { @@ -225,21 +225,21 @@ BOOST_AUTO_TEST_CASE(RepeatTest) NULL }; BOOST_CHECK(lxc.start(argv)); - BOOST_CHECK(lxc.getState() == LxcDomain::State::RUNNING); + BOOST_CHECK(lxc.getState() == LxcZone::State::RUNNING); waitForInit(); BOOST_CHECK(!lxc.start(argv)); // forbidden BOOST_CHECK(lxc.freeze()); - BOOST_CHECK(lxc.getState() == LxcDomain::State::FROZEN); + BOOST_CHECK(lxc.getState() == LxcZone::State::FROZEN); BOOST_CHECK(lxc.freeze()); // repeat is nop - BOOST_CHECK(lxc.getState() == LxcDomain::State::FROZEN); + BOOST_CHECK(lxc.getState() == LxcZone::State::FROZEN); BOOST_CHECK(lxc.unfreeze()); - BOOST_CHECK(lxc.getState() == LxcDomain::State::RUNNING); + BOOST_CHECK(lxc.getState() == LxcZone::State::RUNNING); BOOST_CHECK(lxc.unfreeze()); // repeat is nop - BOOST_CHECK(lxc.getState() == LxcDomain::State::RUNNING); + BOOST_CHECK(lxc.getState() == LxcZone::State::RUNNING); BOOST_CHECK(lxc.stop()); - BOOST_CHECK(lxc.getState() == LxcDomain::State::STOPPED); + BOOST_CHECK(lxc.getState() == LxcZone::State::STOPPED); BOOST_CHECK(lxc.stop()); // repeat is nop - BOOST_CHECK(lxc.getState() == LxcDomain::State::STOPPED); + BOOST_CHECK(lxc.getState() == LxcZone::State::STOPPED); BOOST_CHECK(lxc.destroy()); BOOST_CHECK(!lxc.isDefined()); -- 2.7.4