[Bug/Feature] Rename all not associated with LXC stuff.
[Cause] N/A
[Solution] N/A
[Verification] Build, install, run tests.
Change-Id: I40bf4156e5148dc3a6f3d81bc2e7edfe81c56596
%attr(755,root,root) %{_bindir}/vasum-server
%dir /etc/vasum
%dir /etc/vasum/zones
-%dir /etc/vasum/lxc-templates
%dir /etc/vasum/templates
%config /etc/vasum/daemon.conf
-%attr(755,root,root) /etc/vasum/lxc-templates/*.sh
+%attr(755,root,root) /etc/vasum/templates/*.sh
%config /etc/vasum/templates/*.conf
%{_unitdir}/vasum.service
%{_unitdir}/vasum.socket
%attr(755,root,root) %{script_dir}/vsm_launch_test.py
%{script_dir}/vsm_test_parser.py
%config /etc/vasum/tests
-%attr(755,root,root) /etc/vasum/tests/lxc-templates
+%attr(755,root,root) /etc/vasum/tests/templates
%{python_sitelib}/vsm_integration_tests
%config /etc/dbus-1/system.d/org.tizen.vasum.tests.conf
%{_unitdir}/vasum-socket-test.socket
MESSAGE(STATUS "Installing configs to " ${VSM_CONFIG_INSTALL_DIR})
-FILE(GLOB admin_CONF lxc-templates/*.sh)
-FILE(GLOB template_CONF templates/*.conf)
+FILE(GLOB template_CONF templates/*.conf
+ templates/*.sh)
## Generate ####################################################################
CONFIGURE_FILE(systemd/vasum.service.in
INSTALL(DIRECTORY DESTINATION ${VSM_CONFIG_INSTALL_DIR}/zones) #TODO temporary solution
-INSTALL(PROGRAMS ${admin_CONF}
- DESTINATION ${VSM_CONFIG_INSTALL_DIR}/lxc-templates)
-
INSTALL(PROGRAMS ${template_CONF}
DESTINATION ${VSM_CONFIG_INSTALL_DIR}/templates)
"zoneTemplateDir" : "/etc/vasum/templates/",
"runMountPointPrefix" : "/var/run/zones",
"defaultId" : "",
- "lxcTemplatePrefix" : "/etc/vasum/lxc-templates",
+ "zoneTemplatePrefix" : "/etc/vasum/templates",
"availableVTs" : [3, 4, 5, 6],
"inputConfig" : {"enabled" : true,
"device" : "gpio_keys.6",
{
- "lxcTemplate" : "tizen-common-wayland.sh",
+ "zoneTemplate" : "tizen-common-wayland.sh",
"initWithArgs" : [],
"requestedState" : "stopped",
"ipv4Gateway" : "10.0.~IP~.1",
ZoneAdmin::ZoneAdmin(const std::string& zoneId,
const std::string& zonesPath,
- const std::string& lxcTemplatePrefix,
+ const std::string& zoneTemplatePrefix,
const ZoneConfig& config,
const ZoneDynamicConfig& dynamicConfig)
: mConfig(config),
if (!mZone.isDefined()) {
- const std::string lxcTemplate = utils::getAbsolutePath(config.lxcTemplate,
- lxcTemplatePrefix);
- LOGI(mId << ": Creating zone from template: " << lxcTemplate);
+ const std::string zoneTemplate = utils::getAbsolutePath(config.zoneTemplate,
+ zoneTemplatePrefix);
+ LOGI(mId << ": Creating zone from template: " << zoneTemplate);
utils::CStringArrayBuilder args;
if (!dynamicConfig.ipv4Gateway.empty()) {
args.add("--ipv4-gateway");
args.add("--vt");
args.add(vt.c_str());
}
- if (!mZone.create(lxcTemplate, args.c_array())) {
+ if (!mZone.create(zoneTemplate, args.c_array())) {
throw ZoneOperationException("Could not create zone");
}
}
/**
* ZoneAdmin constructor
* @param zoneId zone id
- * @param zonesPath directory where zones are defined (lxc configs, rootfs etc)
- * @param lxcTemplatePrefix directory where templates are stored
+ * @param zonesPath directory where zones are defined (configs, rootfs etc)
+ * @param zoneTemplatePrefix directory where templates are stored
* @param config zones config
* @param dynamicConfig zones dynamic config
*/
ZoneAdmin(const std::string& zoneId,
const std::string& zonesPath,
- const std::string& lxcTemplatePrefix,
+ const std::string& zoneTemplatePrefix,
const ZoneConfig& config,
const ZoneDynamicConfig& dynamicConfig);
virtual ~ZoneAdmin();
/**
* Check if the zone is stopped. It's NOT equivalent to !isRunning,
- * because it checks different internal lxc states. There are other states,
+ * because it checks different internal zone states. There are other states,
* (e.g. paused) when the zone isn't running nor stopped.
*
* @return Is the zone stopped?
struct ZoneConfig {
/**
- * Lxc template name (relative to lxcTemplatePrefix)
+ * Zone template name (relative to zoneTemplatePrefix)
*/
- std::string lxcTemplate;
+ std::string zoneTemplate;
/**
* Init program with args (empty means default /sbin/init)
CONFIG_REGISTER
(
- lxcTemplate,
+ zoneTemplate,
initWithArgs,
privilege, // TODO not needed?
switchToDefaultAfterTimeout, // TODO move to dynamic and add an API to change
const std::string& zonesPath,
const std::string& zoneTemplatePath,
const std::string& dbPath,
- const std::string& lxcTemplatePrefix,
+ const std::string& zoneTemplatePrefix,
const std::string& baseRunMountPointPath)
: mDbPath(dbPath)
{
mRunMountPoint = fs::absolute(mDynamicConfig.runMountPoint, baseRunMountPointPath).string();
}
- mAdmin.reset(new ZoneAdmin(zoneId, zonesPath, lxcTemplatePrefix, mConfig, mDynamicConfig));
+ mAdmin.reset(new ZoneAdmin(zoneId, zonesPath, zoneTemplatePrefix, mConfig, mDynamicConfig));
const fs::path zonePath = fs::path(zonesPath) / zoneId;
mRootPath = (zonePath / fs::path("rootfs")).string();
/**
* Zone constructor
* @param zoneId zone id
- * @param zonesPath directory where zones are defined (lxc configs, rootfs etc)
+ * @param zonesPath directory where zones are defined (configs, rootfs etc)
* @param zoneTemplatePath path for zones config template
* @param dbPath path to dynamic config db file
- * @param lxcTemplatePrefix directory where templates are stored
+ * @param zoneTemplatePrefix directory where templates are stored
* @param baseRunMountPointPath base directory for run mount point
*/
Zone(const std::string& zoneId,
const std::string& zonesPath,
const std::string& zoneTemplatePath,
const std::string& dbPath,
- const std::string& lxcTemplatePrefix,
+ const std::string& zoneTemplatePrefix,
const std::string& baseRunMountPointPath);
Zone(const Zone&) = delete;
Zone& operator=(const Zone&) = delete;
/**
* Check if the zone is stopped. It's NOT equivalent to !isRunning,
- * because it checks different internal LXC states. There are other states,
+ * because it checks different internal zone states. There are other states,
* (e.g. paused) when the zone isn't running nor stopped.
*
* @return Is the zone stopped?
std::string zoneTemplateDir;
/**
- * Path prefix for lxc templates
+ * Path prefix for zone templates
*/
- std::string lxcTemplatePrefix;
+ std::string zoneTemplatePrefix;
/**
* VTs available for zones
zonesPath,
zoneImagePath,
zoneTemplateDir,
- lxcTemplatePrefix,
+ zoneTemplatePrefix,
availableVTs,
inputConfig,
runMountPointPrefix,
mConfig.zonesPath,
zoneTemplatePath,
mConfig.dbPath,
- mConfig.lxcTemplatePrefix,
+ mConfig.zoneTemplatePrefix,
mConfig.runMountPointPrefix));
mZones.push_back(std::move(zone));
## Subdirectories ##############################################################
SET(VSM_TEST_CONFIG_INSTALL_DIR ${VSM_CONFIG_INSTALL_DIR}/tests)
-SET(VSM_TEST_LXC_TEMPLATES_INSTALL_DIR ${VSM_CONFIG_INSTALL_DIR}/tests/lxc-templates)
+SET(VSM_TEST_TEMPLATES_INSTALL_DIR ${VSM_CONFIG_INSTALL_DIR}/tests/templates)
ADD_DEFINITIONS(-DVSM_TEST_CONFIG_INSTALL_DIR="${VSM_TEST_CONFIG_INSTALL_DIR}")
-ADD_DEFINITIONS(-DVSM_TEST_LXC_TEMPLATES_INSTALL_DIR="${VSM_TEST_LXC_TEMPLATES_INSTALL_DIR}")
+ADD_DEFINITIONS(-DVSM_TEST_TEMPLATES_INSTALL_DIR="${VSM_TEST_TEMPLATES_INSTALL_DIR}")
ADD_SUBDIRECTORY(dbus/configs)
ADD_SUBDIRECTORY(server/configs)
{
- "lxcTemplate" : "minimal-dbus.sh",
+ "zoneTemplate" : "minimal-dbus.sh",
"initWithArgs" : ["/bin/sh", "-c", "trap exit SIGTERM; /usr/bin/dbus-daemon --config-file=@VSM_TEST_CONFIG_INSTALL_DIR@/server/ut-zones-manager/ut-dbus.conf --fork; read"],
"requestedState" : "running",
"ipv4Gateway" : "",
{
- "lxcTemplate" : "minimal-dbus.sh",
+ "zoneTemplate" : "minimal-dbus.sh",
"initWithArgs" : ["/bin/sh", "-c", "trap exit SIGTERM; read"],
"requestedState" : "running",
"ipv4Gateway" : "",
"zoneImagePath" : "",
"zoneTemplateDir" : "@VSM_TEST_CONFIG_INSTALL_DIR@/client/ut-client/templates/",
"runMountPointPrefix" : "",
- "lxcTemplatePrefix" : "@VSM_TEST_LXC_TEMPLATES_INSTALL_DIR@",
+ "zoneTemplatePrefix" : "@VSM_TEST_TEMPLATES_INSTALL_DIR@",
"availableVTs" : [],
"inputConfig" : {"enabled" : false,
"device" : "/dev/doesnotexist",
# @author Piotr Bartosiewicz (p.bartosiewi@partner.samsung.com)
#
-FILE(GLOB LXC_TEMPLATES *.sh)
+FILE(GLOB ZONE_TEMPLATES *.sh)
-INSTALL(PROGRAMS ${LXC_TEMPLATES}
- DESTINATION ${VSM_TEST_LXC_TEMPLATES_INSTALL_DIR})
+INSTALL(PROGRAMS ${ZONE_TEMPLATES}
+ DESTINATION ${VSM_TEST_TEMPLATES_INSTALL_DIR})
using namespace vasum;
using namespace vasum::lxc;
-const std::string LXC_PATH = "/tmp/ut-lxc/";
+const std::string ZONE_PATH = "/tmp/ut-zone/";
const std::string ZONE_NAME = "ut-zone";
-const std::string TEMPLATE = VSM_TEST_LXC_TEMPLATES_INSTALL_DIR "/minimal.sh";
+const std::string ZONE_TEMPLATE = VSM_TEST_TEMPLATES_INSTALL_DIR "/minimal.sh";
const char* TEMPLATE_ARGS[] = {NULL};
struct Fixture {
utils::ScopedDir mLxcDirGuard;
Fixture()
- : mLxcDirGuard(LXC_PATH)
+ : mLxcDirGuard(ZONE_PATH)
{
cleanup();
}
void cleanup()
{
- LxcZone lxc(LXC_PATH, ZONE_NAME);
+ LxcZone lxc(ZONE_PATH, ZONE_NAME);
if (lxc.isDefined()) {
if (lxc.getState() != LxcZone::State::STOPPED) {
lxc.stop();
BOOST_AUTO_TEST_CASE(ConstructorDestructor)
{
- LxcZone lxc(LXC_PATH, ZONE_NAME);
+ LxcZone lxc(ZONE_PATH, ZONE_NAME);
}
BOOST_AUTO_TEST_CASE(CreateDestroy)
{
- LxcZone lxc(LXC_PATH, ZONE_NAME);
+ LxcZone lxc(ZONE_PATH, ZONE_NAME);
BOOST_CHECK(!lxc.isDefined());
- BOOST_CHECK(lxc.create(TEMPLATE, TEMPLATE_ARGS));
+ BOOST_CHECK(lxc.create(ZONE_TEMPLATE, TEMPLATE_ARGS));
BOOST_CHECK(lxc.isDefined());
- BOOST_CHECK_EQUAL(lxc.getConfigItem("lxc.rootfs"), LXC_PATH + ZONE_NAME + "/rootfs");
+ BOOST_CHECK_EQUAL(lxc.getConfigItem("lxc.rootfs"), ZONE_PATH + ZONE_NAME + "/rootfs");
BOOST_CHECK_EXCEPTION(lxc.getConfigItem("xxx"), LxcException, WhatEquals("Key not found"));
BOOST_CHECK(lxc.destroy());
BOOST_AUTO_TEST_CASE(StartShutdown)
{
{
- LxcZone lxc(LXC_PATH, ZONE_NAME);
- BOOST_CHECK(lxc.create(TEMPLATE, TEMPLATE_ARGS));
+ LxcZone lxc(ZONE_PATH, ZONE_NAME);
+ BOOST_CHECK(lxc.create(ZONE_TEMPLATE, TEMPLATE_ARGS));
}
- LxcZone lxc(LXC_PATH, ZONE_NAME);
+ LxcZone lxc(ZONE_PATH, ZONE_NAME);
BOOST_CHECK(lxc.getState() == LxcZone::State::STOPPED);
const char* argv[] = {
"/bin/sh",
BOOST_AUTO_TEST_CASE(StartStop)
{
{
- LxcZone lxc(LXC_PATH, ZONE_NAME);
- BOOST_CHECK(lxc.create(TEMPLATE, TEMPLATE_ARGS));
+ LxcZone lxc(ZONE_PATH, ZONE_NAME);
+ BOOST_CHECK(lxc.create(ZONE_TEMPLATE, TEMPLATE_ARGS));
}
- LxcZone lxc(LXC_PATH, ZONE_NAME);
+ LxcZone lxc(ZONE_PATH, ZONE_NAME);
BOOST_CHECK(lxc.getState() == LxcZone::State::STOPPED);
const char* argv[] = {
"/bin/sh",
BOOST_AUTO_TEST_CASE(StartHasStopped)
{
{
- LxcZone lxc(LXC_PATH, ZONE_NAME);
- BOOST_CHECK(lxc.create(TEMPLATE, TEMPLATE_ARGS));
+ LxcZone lxc(ZONE_PATH, ZONE_NAME);
+ BOOST_CHECK(lxc.create(ZONE_TEMPLATE, TEMPLATE_ARGS));
}
- LxcZone lxc(LXC_PATH, ZONE_NAME);
+ LxcZone lxc(ZONE_PATH, ZONE_NAME);
BOOST_CHECK(lxc.getState() == LxcZone::State::STOPPED);
const char* argv[] = {
"/bin/sh",
BOOST_AUTO_TEST_CASE(FreezeUnfreeze)
{
- LxcZone lxc(LXC_PATH, ZONE_NAME);
- BOOST_CHECK(lxc.create(TEMPLATE, TEMPLATE_ARGS));
+ LxcZone lxc(ZONE_PATH, ZONE_NAME);
+ BOOST_CHECK(lxc.create(ZONE_TEMPLATE, TEMPLATE_ARGS));
const char* argv[] = {
"/bin/sh",
"-c",
BOOST_AUTO_TEST_CASE(FreezeStop)
{
- LxcZone lxc(LXC_PATH, ZONE_NAME);
- BOOST_CHECK(lxc.create(TEMPLATE, TEMPLATE_ARGS));
+ LxcZone lxc(ZONE_PATH, ZONE_NAME);
+ BOOST_CHECK(lxc.create(ZONE_TEMPLATE, TEMPLATE_ARGS));
const char* argv[] = {
"/bin/sh",
"-c",
BOOST_AUTO_TEST_CASE(Repeat)
{
- LxcZone lxc(LXC_PATH, ZONE_NAME);
- BOOST_CHECK(lxc.create(TEMPLATE, TEMPLATE_ARGS));
- BOOST_CHECK(!lxc.create(TEMPLATE, TEMPLATE_ARGS));// forbidden
+ LxcZone lxc(ZONE_PATH, ZONE_NAME);
+ BOOST_CHECK(lxc.create(ZONE_TEMPLATE, TEMPLATE_ARGS));
+ BOOST_CHECK(!lxc.create(ZONE_TEMPLATE, TEMPLATE_ARGS));// forbidden
const char* argv[] = {
"/bin/sh",
"-c",
{
- "lxcTemplate" : "minimal.sh",
+ "zoneTemplate" : "minimal.sh",
"initWithArgs" : ["/bin/sh", "-c", "trap exit SIGTERM; read"],
"requestedState" : "running",
"ipv4Gateway" : "",
"zoneTemplateDir" : "@VSM_TEST_CONFIG_INSTALL_DIR@/server/ut-server/templates/",
"runMountPointPrefix" : "",
"defaultId" : "",
- "lxcTemplatePrefix" : "@VSM_TEST_LXC_TEMPLATES_INSTALL_DIR@",
+ "zoneTemplatePrefix" : "@VSM_TEST_TEMPLATES_INSTALL_DIR@",
"availableVTs" : [],
"inputConfig" : {"enabled" : false,
"device" : "gpio-keys.4",
{
- "lxcTemplate" : "minimal.sh",
+ "zoneTemplate" : "minimal.sh",
"initWithArgs" : ["/foo"],
"requestedState" : "running",
"ipv4Gateway" : "",
{
- "lxcTemplate" : "missing.sh",
+ "zoneTemplate" : "missing.sh",
"initWithArgs" : ["/bin/sh", "-c", "trap exit SIGTERM; read"],
"requestedState" : "running",
"ipv4Gateway" : "",
{
- "lxcTemplate" : "minimal.sh",
+ "zoneTemplate" : "minimal.sh",
"initWithArgs" : ["/bin/sh"],
"requestedState" : "running",
"ipv4Gateway" : "",
{
- "lxcTemplate" : "minimal.sh",
+ "zoneTemplate" : "minimal.sh",
"initWithArgs" : ["/bin/sh", "-c", "trap exit SIGTERM; read"],
"requestedState" : "running",
"ipv4Gateway" : "",
{
- "lxcTemplate" : "/buggy/path",
+ "zoneTemplate" : "/buggy/path",
"initWithArgs" : ["/bin/sh", "-c", "trap exit SIGTERM; read"],
"requestedState" : "running",
"ipv4Gateway" : "",
{
- "lxcTemplate" : "minimal-dbus.sh",
+ "zoneTemplate" : "minimal-dbus.sh",
"initWithArgs" : ["/bin/sh", "-c", "trap exit SIGTERM; /usr/bin/dbus-daemon --config-file=@VSM_TEST_CONFIG_INSTALL_DIR@/server/ut-zone/ut-dbus.conf --fork; read"],
"requestedState" : "running",
"ipv4Gateway" : "",
{
- "lxcTemplate" : "minimal.sh",
+ "zoneTemplate" : "minimal.sh",
"initWithArgs" : ["/bin/sh", "-c", "trap exit SIGTERM; read"],
"requestedState" : "running",
"ipv4Gateway" : "",
{
- "lxcTemplate" : "minimal.sh",
+ "zoneTemplate" : "minimal.sh",
"initWithArgs" : ["/bin/sh", "-c", "trap exit SIGTERM; read"],
"requestedState" : "running",
"ipv4Gateway" : "",
"zoneImagePath" : "",
"zoneTemplateDir" : "@VSM_TEST_CONFIG_INSTALL_DIR@/server/ut-zones-manager/templates/",
"runMountPointPrefix" : "",
- "lxcTemplatePrefix" : "@VSM_TEST_LXC_TEMPLATES_INSTALL_DIR@",
+ "zoneTemplatePrefix" : "@VSM_TEST_TEMPLATES_INSTALL_DIR@",
"availableVTs" : [],
"inputConfig" : {"enabled" : false,
"device" : "/dev/doesnotexist",
const std::string BUGGY_CONFIG_PATH = TEMPLATES_DIR + "/buggy.conf";
const std::string MISSING_CONFIG_PATH = TEMPLATES_DIR + "/missing.conf";
const std::string ZONES_PATH = "/tmp/ut-zones";
-const std::string LXC_TEMPLATES_PATH = VSM_TEST_LXC_TEMPLATES_INSTALL_DIR;
+const std::string TEMPLATES_PATH = VSM_TEST_TEMPLATES_INSTALL_DIR;
struct Fixture {
utils::ScopedGlibLoop mLoop;
config::loadFromJsonFile(configPath, mDynamicConfig);
return std::unique_ptr<ZoneAdmin>(new ZoneAdmin("zoneId",
ZONES_PATH,
- LXC_TEMPLATES_PATH,
+ TEMPLATES_PATH,
mConfig,
mDynamicConfig));
}
const std::string TEST_CONFIG_PATH = VSM_TEST_CONFIG_INSTALL_DIR "/server/ut-zone-provision/test.conf";
const std::string ZONE = "ut-zone-provision-test";
const fs::path ZONES_PATH = "/tmp/ut-zones";
-const fs::path LXC_TEMPLATES_PATH = VSM_TEST_LXC_TEMPLATES_INSTALL_DIR;
+const fs::path TEMPLATES_PATH = VSM_TEST_TEMPLATES_INSTALL_DIR;
const fs::path ZONE_PATH = ZONES_PATH / fs::path(ZONE);
const fs::path SOME_FILE_PATH = ZONE_PATH / "file.txt";
const fs::path ROOTFS_PATH = ZONE_PATH / "rootfs";
const std::string BUGGY_CONFIG_PATH = TEMPLATES_DIR + "/buggy.conf";
const std::string MISSING_CONFIG_PATH = TEMPLATES_DIR + "/missing.conf";
const std::string ZONES_PATH = "/tmp/ut-zones";
-const std::string LXC_TEMPLATES_PATH = VSM_TEST_LXC_TEMPLATES_INSTALL_DIR;
+const std::string TEMPLATES_PATH = VSM_TEST_TEMPLATES_INSTALL_DIR;
const std::string DB_PATH = ZONES_PATH + "/vasum.db";
const std::string BRIDGE_NAME = "brtest01";
const std::string ZONE_NETDEV = "netdevtest01";
ZONES_PATH,
configPath,
DB_PATH,
- LXC_TEMPLATES_PATH,
+ TEMPLATES_PATH,
""));
}
BOOST_AUTO_TEST_CASE(DbusConnection)
{
- mRunGuard.create("/tmp/ut-run"); // the same path as in lxc template
+ mRunGuard.create("/tmp/ut-run"); // the same path as in zone template
auto c = create(TEST_DBUS_CONFIG_PATH);
c->start();