Cleanup container/domain nomenclature.
authorLukasz Pawelczyk <l.pawelczyk@partner.samsung.com>
Thu, 24 Apr 2014 08:46:35 +0000 (10:46 +0200)
committerJan Olszak <j.olszak@samsung.com>
Mon, 19 May 2014 11:47:16 +0000 (13:47 +0200)
[Bug/Feature]   Be consistent in using the names container and domain.
[Cause]         It wasn't consistent
[Solution]      Domain is used for a libvirt, LXC up to a libvirt is called
                domain, above that, in our nomenclature it's called container.
[Verification]  Built, installed  and run tests.

Change-Id: I43dfe58d9cce1b87509b6e36e25e5454abe52d76
Signed-off-by: Lukasz Pawelczyk <l.pawelczyk@partner.samsung.com>
server/configs/libvirt-config/business.xml
server/configs/libvirt-config/private.xml
server/container-admin.cpp
server/container-admin.hpp
server/exception.hpp

index c934bfd..f2317a8 100644 (file)
       <source network='default'/>
     </interface>
     <filesystem type='mount'>
-      <source dir='/domains/business'/>
+      <source dir='/opt/usr/containers/business'/>
       <target dir='/'/>
     </filesystem>
     <!-- Enable access to the containers dbus -->
index 402527f..7df0db4 100644 (file)
       <source network='default'/>
     </interface>
     <filesystem type='mount'>
-      <source dir='/domains/private'/>
+      <source dir='/opt/usr/containers/private'/>
       <target dir='/'/>
     </filesystem>
     <!-- Enable access to the containers dbus -->
index 6d99189..754f281 100644 (file)
@@ -49,7 +49,7 @@ std::string getDomainName(virDomainPtr dom)
     if ((name = virDomainGetName(dom)) == NULL) {
         LOGE("Failed to get the domain's id:\n"
              << libvirt::libvirtFormatError());
-        throw DomainOperationException();
+        throw ContainerOperationException();
     }
 
     return name;
@@ -108,9 +108,9 @@ void ContainerAdmin::start()
     u_int flags = VIR_DOMAIN_START_AUTODESTROY;
 
     if (virDomainCreateWithFlags(mDom.get(), flags) < 0) {
-        LOGE(mId << ": Failed to start the domain\n"
+        LOGE(mId << ": Failed to start the container\n"
              << libvirt::libvirtFormatError());
-        throw DomainOperationException();
+        throw ContainerOperationException();
     }
 
     LOGD(mId << ": Started");
@@ -136,9 +136,9 @@ void ContainerAdmin::stop()
     u_int flags = VIR_DOMAIN_DESTROY_DEFAULT;
 
     if (virDomainDestroyFlags(mDom.get(), flags) < 0) {
-        LOGE(mId << ": Error while stopping the domain:\n"
+        LOGE(mId << ": Error while stopping the container:\n"
              << libvirt::libvirtFormatError());
-        throw DomainOperationException();
+        throw ContainerOperationException();
     }
 
     LOGD(mId << ": Stopped");
@@ -158,9 +158,9 @@ void ContainerAdmin::shutdown()
     resume();
 
     if (virDomainShutdown(mDom.get()) < 0) {
-        LOGE(mId << ": Error while shutting down the domain:\n"
+        LOGE(mId << ": Error while shutting down the container:\n"
              << libvirt::libvirtFormatError());
-        throw DomainOperationException();
+        throw ContainerOperationException();
     }
 
     LOGD(mId << ": Shut down");
@@ -193,9 +193,9 @@ void ContainerAdmin::suspend()
     }
 
     if (virDomainSuspend(mDom.get()) < 0) {
-        LOGE(mId << ": Error while suspending the domain:\n"
+        LOGE(mId << ": Error while suspending the container:\n"
              << libvirt::libvirtFormatError());
-        throw DomainOperationException();
+        throw ContainerOperationException();
     }
 
     LOGD(mId << ": Paused");
@@ -213,9 +213,9 @@ void ContainerAdmin::resume()
     }
 
     if (virDomainResume(mDom.get()) < 0) {
-        LOGE(mId << ": Error while resuming the domain:\n"
+        LOGE(mId << ": Error while resuming the container:\n"
              << libvirt::libvirtFormatError());
-        throw DomainOperationException();
+        throw ContainerOperationException();
     }
 
     LOGD(mId << ": Resumed");
@@ -235,9 +235,9 @@ int ContainerAdmin::getState()
     int state;
 
     if (virDomainGetState(mDom.get(), &state, NULL, 0)) {
-        LOGE(mId << ": Error while getting the domain's state:\n"
+        LOGE(mId << ": Error while getting the container's state:\n"
              << libvirt::libvirtFormatError());
-        throw DomainOperationException();
+        throw ContainerOperationException();
     }
 
     return state;
@@ -281,9 +281,9 @@ void ContainerAdmin::setSchedulerParams(std::uint64_t cpuShares, std::uint64_t v
     virTypedParamsAddLLong(&paramsTmp, &numParamsBuff, &maxParams, VIR_DOMAIN_SCHEDULER_VCPU_QUOTA, vcpuQuota);
 
     if (virDomainSetSchedulerParameters(mDom.get(), params.get(), numParamsBuff) < 0) {
-        LOGE(mId << ": Error while setting the domain's scheduler params:\n"
+        LOGE(mId << ": Error while setting the container's scheduler params:\n"
              << libvirt::libvirtFormatError());
-        throw DomainOperationException();
+        throw ContainerOperationException();
     }
 }
 
@@ -296,17 +296,17 @@ std::int64_t ContainerAdmin::getSchedulerQuota()
     std::unique_ptr<char, void(*)(void*)> type(virDomainGetSchedulerType(mDom.get(), &numParamsBuff), free);
 
     if (type == NULL || numParamsBuff <= 0 || strcmp(type.get(), "posix") != 0) {
-        LOGE(mId << ": Error while getting the domain's scheduler type:\n"
+        LOGE(mId << ": Error while getting the container's scheduler type:\n"
              << libvirt::libvirtFormatError());
-        throw DomainOperationException();
+        throw ContainerOperationException();
     }
 
     std::unique_ptr<virTypedParameter[]> params(new virTypedParameter[numParamsBuff]);
 
     if (virDomainGetSchedulerParameters(mDom.get(), params.get(), &numParamsBuff) < 0) {
-        LOGE(mId << ": Error while getting the domain's scheduler params:\n"
+        LOGE(mId << ": Error while getting the container's scheduler params:\n"
              << libvirt::libvirtFormatError());
-        throw DomainOperationException();
+        throw ContainerOperationException();
     }
 
     long long quota;
@@ -314,9 +314,9 @@ std::int64_t ContainerAdmin::getSchedulerQuota()
                                numParamsBuff,
                                VIR_DOMAIN_SCHEDULER_VCPU_QUOTA,
                                &quota) <= 0) {
-        LOGE(mId << ": Error while getting the domain's scheduler quota param:\n"
+        LOGE(mId << ": Error while getting the container's scheduler quota param:\n"
              << libvirt::libvirtFormatError());
-        throw DomainOperationException();
+        throw ContainerOperationException();
     }
 
     return quota;
index d1ce59a..b01d9e0 100644 (file)
@@ -66,8 +66,8 @@ public:
     void stop();
 
     /**
-     * Gracefully shutdown the domain.
-     * This method will NOT block until domain is shut down,
+     * Gracefully shutdown the container.
+     * This method will NOT block until container is shut down,
      * because some configurations may ignore this.
      */
     void shutdown();
@@ -87,9 +87,9 @@ public:
     bool isStopped();
 
     /**
-     * Suspends an active domain, the process is frozen
+     * Suspends an active container, the process is frozen
      * without further access to CPU resources and I/O,
-     * but the memory used by the domain
+     * but the memory used by the container
      * at the hypervisor level will stay allocated
      */
     void suspend();
index 6745068..3b05bdb 100644 (file)
@@ -40,10 +40,10 @@ struct ServerException: public SecurityContainersException {
 };
 
 /**
- * Error occurred during an attempt to perform an operation on a domain,
+ * Error occurred during an attempt to perform an operation on a container,
  * e.g. start, stop a container
  */
-struct DomainOperationException: public ServerException {
+struct ContainerOperationException: public ServerException {
     using ServerException::ServerException;
 };