}
}
-ostream& operator<<(ostream& out, const VsmDomainState& state)
+ostream& operator<<(ostream& out, const VsmZoneState& state)
{
const char* name;
switch (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;
}
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;
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;
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;
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;
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
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
}
},
{
- "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"}}
}
}
*str = buf;
}
-VsmDomainState getDomainState(const char* state)
+VsmZoneState getZoneState(const char* state)
{
if (strcmp(state, "STOPPED") == 0) {
return STOPPED;
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<typename T>
return ret;
}
-VsmStatus Client::vsm_get_domain_ids(VsmArrayString* array) noexcept
+VsmStatus Client::vsm_get_zone_ids(VsmArrayString* array) noexcept
{
assert(array);
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);
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);
}
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();
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) {
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);
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);
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();
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();
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
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
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
/**
* @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;
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;
/**
* @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;
/**
* @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;
/**
* @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;
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)
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)
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)
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,
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)
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,
goto finish;
}
- status = vsm_get_domain_ids(client, &values);
+ status = vsm_get_zone_ids(client, &values);
if (VSMCLIENT_SUCCESS != status) {
// error!
ret = 1;
typedef unsigned int VsmSubscriptionId;
/**
- * States of domain
+ * States of zone
*/
typedef enum {
STOPPED,
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
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
* @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.
* @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.
* @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.
* 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);
* 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);
* 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);
* 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);
* 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);
/**
- * @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.
*
* @{
*/
*/
VsmStatus vsm_del_notification_callback(VsmClient client, VsmSubscriptionId subscriptionId);
-/** @} */ // Domain API
+/** @} */ // Zone API
#ifdef __cplusplus
}
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)) {
{
// Initialize a socket
int fd = getSystemdSocket(path);
- fd = fd != -1 ? fd : createDomainSocket(path);
+ fd = fd != -1 ? fd : createZoneSocket(path);
return Socket(fd);
}
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);
};
/**
* @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
namespace lxc {
namespace {
-#define ITEM(X) {#X, LxcDomain::State::X},
- const std::map<std::string, LxcDomain::State> STATE_MAP = {
+#define ITEM(X) {#X, LxcZone::State::X},
+ const std::map<std::string, LxcZone::State> STATE_MAP = {
ITEM(STOPPED)
ITEM(STARTING)
ITEM(RUNNING)
#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)
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;
}
if (!utils::executeAndWait("/usr/bin/lxc-create", args.c_array())) {
- LOGE("Could not create domain " << getName());
+ LOGE("Could not create zone " << getName());
return false;
}
templatePath.c_str(),
NULL, NULL, 0,
const_cast<char* const*>(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)) {
}
if (!utils::executeAndWait("/usr/bin/lxc-start", args.c_array())) {
- LOGE("Could not start domain " << getName());
+ LOGE("Could not start zone " << getName());
return false;
}
// 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;
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<char* const*>(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;
}
.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;
}
// 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<utils::RunLevel*>(param);
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());
}
/**
* @file
* @author Piotr Bartosiewicz (p.bartosiewi@partner.samsung.com)
- * @brief Lxc domain
+ * @brief Lxc zone
*/
#ifndef COMMON_LXC_DOMAIN_HPP
/**
* A class wwapping lxc container
*/
-class LxcDomain {
+class LxcZone {
public:
enum class State {
STOPPED,
};
/**
- * 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;
std::string getConfigItem(const std::string& key);
/**
- * Is domain defined (created)?
+ * Is zone defined (created)?
*/
bool isDefined();
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:
## 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/)
+++ /dev/null
-<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
-
-<busconfig>
- <policy user="${SECURITY_CONTAINERS_USER}">
- <allow own="org.tizen.containers.domain.daemon"/>
- <allow send_destination="org.tizen.containers.domain.daemon"/>
- <allow receive_sender="org.tizen.containers.domain.daemon"/>
- </policy>
- <policy context="default">
- <allow send_destination="org.tizen.containers.domain.daemon"/>
- <allow receive_sender="org.tizen.containers.domain.daemon"/>
- </policy>
-</busconfig>
--- /dev/null
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+
+<busconfig>
+ <policy user="${SECURITY_CONTAINERS_USER}">
+ <allow own="org.tizen.containers.zone.daemon"/>
+ <allow send_destination="org.tizen.containers.zone.daemon"/>
+ <allow receive_sender="org.tizen.containers.zone.daemon"/>
+ </policy>
+ <policy context="default">
+ <allow send_destination="org.tizen.containers.zone.daemon"/>
+ <allow receive_sender="org.tizen.containers.zone.daemon"/>
+ </policy>
+</busconfig>
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";
## 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/)
+++ /dev/null
-<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
-
-<busconfig>
- <policy user="${SECURITY_CONTAINERS_USER}">
- <allow own="org.tizen.containers.domain"/>
- <allow send_destination="org.tizen.containers.domain"/>
- <allow receive_sender="org.tizen.containers.domain"/>
- </policy>
- <policy context="default">
- <allow send_destination="org.tizen.containers.domain"/>
- <allow receive_sender="org.tizen.containers.domain"/>
- </policy>
-</busconfig>
--- /dev/null
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+
+<busconfig>
+ <policy user="${SECURITY_CONTAINERS_USER}">
+ <allow own="org.tizen.containers.zone"/>
+ <allow send_destination="org.tizen.containers.zone"/>
+ <allow receive_sender="org.tizen.containers.zone"/>
+ </policy>
+ <policy context="default">
+ <allow send_destination="org.tizen.containers.zone"/>
+ <allow receive_sender="org.tizen.containers.zone"/>
+ </policy>
+</busconfig>
%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 ####################################################
%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 ######################################################
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");
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");
}
}
}
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;
}
bool ContainerAdmin::isPaused()
{
- return mDom.getState() == lxc::LxcDomain::State::FROZEN;
+ return mDom.getState() == lxc::LxcZone::State::FROZEN;
}
private:
const ContainerConfig& mConfig;
- lxc::LxcDomain mDom;
+ lxc::LxcZone mDom;
const std::string mId;
bool mDetachOnExit;
bool mDestroyOnExit;
/**
* 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;
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";
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);
-'''! Module containing utilities for domain-tests
+'''! Module containing utilities for zone-tests
@author Lukasz Kostyra (l.kostyra@samsung.com)
'''
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()
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"
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());
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);
}
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);
}
{
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"));
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);
/**
* @file
* @author Piotr Bartosiewicz (p.bartosiewi@partner.samsung.com)
- * @brief Unit tests of LxcDomain class
+ * @brief Unit tests of LxcZone class
*/
#include "config.hpp"
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};
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();
} // 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());
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",
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());
}
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());
}
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",
};
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",
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",
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[] = {
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());