2 * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Contact: Piotr Bartosiewicz <p.bartosiewi@partner.samsung.com>
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License
21 * @author Piotr Bartosiewicz (p.bartosiewi@partner.samsung.com)
25 #ifndef COMMON_LXC_ZONE_HPP
26 #define COMMON_LXC_ZONE_HPP
30 // fwd declaration of lxc internals
38 * A class wrapping lxc container
55 * @param lxcPath path where zones lives
56 * @param zoneName name of zone
58 LxcZone(const std::string& lxcPath, const std::string& zoneName);
61 LxcZone(const LxcZone&) = delete;
62 LxcZone& operator=(const LxcZone&) = delete;
67 std::string getName() const;
70 * Get item from lxc config file
71 * @throw LxcException if key not found
73 std::string getConfigItem(const std::string& key);
76 * Is zone defined (created)?
81 * String representation of state
83 static std::string toString(State state);
91 * Wait till zone is in specified state
92 * @return false on timeout
94 bool waitForState(State state, int timeout);
98 * @param templatePath template from which zone will be created
99 * @param argv additional template arguments
101 bool create(const std::string& templatePath, const char* const* argv);
110 * @param argv init process with arguments
112 bool start(const char* const* argv);
115 * Immediate stop the zone
116 * It kills all processes within this zone
126 * Gracefully shutdown zone.
128 bool shutdown(int timeout);
131 * Freeze (pause/lock) zone
140 lxc_container* mLxcContainer;
142 bool setRunLevel(int runLevel);
151 #endif // COMMON_LXC_ZONE_HPP