diff --git a/include/test/NebulaTest.h b/include/test/NebulaTest.h
index 875459932d..3768558f3d 100644
--- a/include/test/NebulaTest.h
+++ b/include/test/NebulaTest.h
@@ -26,6 +26,7 @@
#include "HostPool.h"
#include "UserPool.h"
#include "VMTemplatePool.h"
+#include "DatastorePool.h"
#include "VirtualMachineManager.h"
#include "LifeCycleManager.h"
@@ -67,6 +68,7 @@ public:
bool need_user_pool;
bool need_template_pool;
bool need_group_pool;
+ bool need_datastore_pool;
bool need_vmm;
bool need_im;
@@ -107,6 +109,8 @@ public:
virtual GroupPool* create_gpool(SqlDB* db);
+ virtual DatastorePool* create_dspool(SqlDB* db);
+
// ------------------------------------------------------------------------
// Managers
// ------------------------------------------------------------------------
diff --git a/src/host/test/HostHookTest.cc b/src/host/test/HostHookTest.cc
index e65877c27c..46ffbd7b6c 100644
--- a/src/host/test/HostHookTest.cc
+++ b/src/host/test/HostHookTest.cc
@@ -96,7 +96,7 @@ public:
{
string err;
- hpool->allocate(&oid, "host_test", "im_mad", "vmm_mad", "vnm_mad", "tm_mad", err);
+ hpool->allocate(&oid, "host_test", "im_mad", "vmm_mad", "vnm_mad", err);
CPPUNIT_ASSERT( oid >= 0 );
sleep(1);
@@ -114,7 +114,7 @@ public:
{
string err;
- hpool->allocate(&oid, "host_test", "im_mad", "vmm_mad", "vnm_mad", "tm_mad", err);
+ hpool->allocate(&oid, "host_test", "im_mad", "vmm_mad", "vnm_mad", err);
CPPUNIT_ASSERT( oid >= 0 );
host = hpool->get(oid, true);
@@ -140,7 +140,7 @@ public:
{
string err;
- hpool->allocate(&oid, "host_test", "im_mad", "vmm_mad", "vnm_mad", "tm_mad", err);
+ hpool->allocate(&oid, "host_test", "im_mad", "vmm_mad", "vnm_mad", err);
CPPUNIT_ASSERT( oid >= 0 );
host = hpool->get(oid, true);
@@ -166,7 +166,7 @@ public:
{
string err;
- hpool->allocate(&oid, "host_test", "im_mad", "vmm_mad", "vnm_mad", "tm_mad", err);
+ hpool->allocate(&oid, "host_test", "im_mad", "vmm_mad", "vnm_mad", err);
CPPUNIT_ASSERT( oid >= 0 );
host = hpool->get(oid, true);
diff --git a/src/host/test/HostPoolTest.cc b/src/host/test/HostPoolTest.cc
index 43ce2a679b..a46de04219 100644
--- a/src/host/test/HostPoolTest.cc
+++ b/src/host/test/HostPoolTest.cc
@@ -26,14 +26,13 @@ using namespace std;
const string im_mad = "im_mad";
const string vmm_mad = "vmm_mad";
const string vnm_mad = "vnm_mad";
-const string tm_mad = "tm_mad";
const string names[] = {"Host one", "Second host"};
const string xmls[] =
{
"0Host one0"
- "im_madvmm_madvnm_madtm_mad"
+ "im_madvmm_madvnm_mad"
"0"
"000"
"000"
@@ -42,7 +41,7 @@ const string xmls[] =
"0",
"1Second host0"
- "im_madvmm_madvnm_madtm_mad"
+ "im_madvmm_madvnm_mad"
"0"
"000"
"000"
@@ -54,35 +53,35 @@ const string xmls[] =
// This xml dump result has the LAST_MON_TIMEs modified to 0000000000
const string xml_dump =
"0a0im_madvmm_madvnm_madtm_mad0"
+ "M_MAD>vmm_madvnm_mad0"
"0000000000000"
"1a name0im_madvmm_madvnm_madtm_mad0vmm_madvnm_mad000000"
"000000002a_name0im_madvmm_madvnm_madtm_mad0vnm_mad0000000"
"MAX_CPU>00000003another "
"name0im_madvmm_mad"
- "vnm_madtm_mad0vnm_mad00000000004host0im_madvmm_madvnm_madtm_mad"
- "0"
+ "ATE>0im_madvmm_madvnm_mad"
+ "0"
"000"
"0000"
"0000a0im_madvmm_madvnm_madtm_mad0"
+ "M_MAD>vmm_madvnm_mad0"
"0000000000000"
"1a name0im_madvmm_madvnm_madtm_mad0vmm_madvnm_mad000000"
"000000002a_name0im_madvmm_madvnm_madtm_mad0vnm_mad0000000"
"MAX_CPU>00000003another "
"name0im_madvmm_mad"
- "vnm_madtm_mad0vnm_mad0000000000";
+ "0Host one0im_madvmm_madvnm_mad00000000000000";
const string host_0_cluster =
- "0Host one0im_madvmm_madvnm_madtm_mad0cluster_a0000000000000";
+ "0Host one0im_madvmm_madvnm_mad0cluster_a0000000000000";
/* ************************************************************************* */
/* ************************************************************************* */
@@ -164,7 +163,7 @@ protected:
int oid;
string err;
return ((HostPool*)pool)->allocate(&oid, names[index], im_mad,
- vmm_mad, vnm_mad, tm_mad, err);
+ vmm_mad, vnm_mad, err);
};
void check(int index, PoolObjectSQL* obj)
@@ -239,28 +238,28 @@ public:
Host * host;
string err;
- string tm_mad_2 = "another_tm_mad";
+ string im_mad_2 = "another_im_mad";
// If we try to allocate two hosts with the same name and drivers,
// should fail
- rc = hp->allocate(&oid_0, names[0], im_mad, vmm_mad, vnm_mad, tm_mad, err);
+ rc = hp->allocate(&oid_0, names[0], im_mad, vmm_mad, vnm_mad, err);
CPPUNIT_ASSERT( oid_0 == 0 );
CPPUNIT_ASSERT( rc == oid_0 );
- rc = hp->allocate(&oid_1, names[0], im_mad, vmm_mad, vnm_mad, tm_mad, err);
+ rc = hp->allocate(&oid_1, names[0], im_mad, vmm_mad, vnm_mad, err);
CPPUNIT_ASSERT( oid_1 == -1 );
CPPUNIT_ASSERT( rc == oid_1 );
// the hostname can not be repeated if the drivers change
- rc = hp->allocate(&oid_1, names[0], im_mad, vmm_mad, vnm_mad, tm_mad_2, err);
+ rc = hp->allocate(&oid_1, names[0], im_mad_2, vmm_mad, vnm_mad, err);
CPPUNIT_ASSERT( oid_1 == -1 );
CPPUNIT_ASSERT( rc == oid_1 );
// Get the hosts and check them
host = hp->get(oid_0, false);
CPPUNIT_ASSERT( host != 0 );
- CPPUNIT_ASSERT( host->get_tm_mad() == tm_mad );
+ CPPUNIT_ASSERT( host->get_im_mad() == im_mad );
}
/* ********************************************************************* */
@@ -274,7 +273,7 @@ public:
for(int i=0; i<5; i++)
{
((HostPool*)pool)->allocate(&oid, names[i],
- im_mad, vmm_mad, vnm_mad, tm_mad, err);
+ im_mad, vmm_mad, vnm_mad, err);
}
ostringstream oss;
@@ -285,13 +284,13 @@ public:
string result = oss.str();
// A little help for debugging
-//*
+/*
if( result != xml_dump )
{
cout << endl << result << endl << "========"
<< endl << xml_dump << endl;
}
-//*/
+*/
CPPUNIT_ASSERT( result == xml_dump );
}
@@ -307,25 +306,23 @@ public:
for(int i=0; i<5; i++)
{
((HostPool*)pool)->allocate(&oid, names[i],
- im_mad, vmm_mad, vnm_mad, tm_mad, err);
+ im_mad, vmm_mad, vnm_mad, err);
}
-
ostringstream oss;
rc = ((HostPool*)pool)->dump(oss, "name LIKE 'a%'");
CPPUNIT_ASSERT(rc == 0);
-
string result = oss.str();
// A little help for debugging
-//*
+/*
if( result != xml_dump_like_a )
{
cout << endl << result << endl << "========"
<< endl << xml_dump_like_a << endl;
}
-//*/
+*/
CPPUNIT_ASSERT( result == xml_dump_like_a );
}
@@ -348,7 +345,7 @@ public:
{
oss << "host" << i;
- hp->allocate(&oid, oss.str().c_str(), im_mad, vmm_mad, vnm_mad, tm_mad, err);
+ hp->allocate(&oid, oss.str().c_str(),im_mad, vmm_mad, vnm_mad, err);
CPPUNIT_ASSERT(oid == i);
if (i >=8 )
@@ -406,7 +403,7 @@ public:
{
oss << "host" << j;
- hp->allocate(&oid, oss.str().c_str(),im_mad,vmm_mad,vnm_mad,tm_mad,err);
+ hp->allocate(&oid,oss.str().c_str(),im_mad,vmm_mad,vnm_mad,err);
}
the_time2 = time(0) - the_time;
@@ -435,7 +432,7 @@ public:
for (i=10000,oss.str(""); i<30000 ; i++,oss.str(""))
{
oss << "host" << i;
- hp->allocate(&oid,oss.str().c_str(),im_mad,vmm_mad,vnm_mad,tm_mad,err);
+ hp->allocate(&oid,oss.str().c_str(),im_mad,vmm_mad,vnm_mad,err);
host = hp->get(oid, false);
diff --git a/src/image/test/ImagePoolTest.cc b/src/image/test/ImagePoolTest.cc
index 8427243e70..f4d96a010b 100644
--- a/src/image/test/ImagePoolTest.cc
+++ b/src/image/test/ImagePoolTest.cc
@@ -51,20 +51,20 @@ const string templates[] =
const string xmls[] =
{
-"001oneoneadminImage one110000000010000000000/tmp/image_test040",
+"001oneoneadminImage one110000000010000000000/tmp/image_test0400none",
-"111twooneadminSecond Image110000000000000000000/tmp/image_second_test040",
+"111twooneadminSecond Image110000000000000000000/tmp/image_second_test0400none",
-"021threeusersThe third image110000000000000000000/tmp/image_test040",
+"021threeusersThe third image110000000000000000000/tmp/image_test0400none",
};
// This xml dump result has the STIMEs modified to 0000000000
const string xml_dump =
-"001oneoneadminImage one110000000010000000000/tmp/image_test040111twooneadminSecond Image110000000000000000000/tmp/image_second_test040221threeusersThe third image110000000000000000000/tmp/image_test040";
+"001oneoneadminImage one110000000010000000000/tmp/image_test0400none111twooneadminSecond Image110000000000000000000/tmp/image_second_test0400none221threeusersThe third image110000000000000000000/tmp/image_test0400none";
const string xml_dump_where =
-"001oneoneadminImage one110000000010000000000/tmp/image_test040111twooneadminSecond Image110000000000000000000/tmp/image_second_test040";
+"001oneoneadminImage one110000000010000000000/tmp/image_test0400none111twooneadminSecond Image110000000000000000000/tmp/image_second_test0400none";
/* ************************************************************************* */
/* ************************************************************************* */
@@ -80,6 +80,7 @@ public:
need_image_pool = true;
need_imagem = true;
+ need_datastore_pool = true;
}
};
@@ -113,7 +114,8 @@ public:
string uname = unames[uid];
string gname = gnames[uid];
- return ImagePool::allocate(uid, 1, uname, gname, img_template, oid, err);
+ return ImagePool::allocate(uid, 1, uname, gname,
+ img_template, 0,"none", "", oid, err);
}
else
{
diff --git a/src/lcm/test/LifeCycleManagerTest.cc b/src/lcm/test/LifeCycleManagerTest.cc
index 50a43f2275..ce1166c8bd 100644
--- a/src/lcm/test/LifeCycleManagerTest.cc
+++ b/src/lcm/test/LifeCycleManagerTest.cc
@@ -48,7 +48,6 @@ static int hid = 123;
static string hostname = "test_hostname";
static string vmm_mad = "vmm_mad";
static string vnm_mad = "vnm_mad";
-static string tm_mad = "tm_mad";
static string vmdir = "vmdir";
class LifeCycleManagerTest : public OneUnitTest
@@ -226,7 +225,7 @@ private:
vm->lock();
- vm->add_history(hid,hostname,vmdir,vmm_mad,vnm_mad,tm_mad);
+ vm->add_history(hid,hostname,vmdir,vmm_mad,vnm_mad);
rc = vmpool->update_history(vm);
CPPUNIT_ASSERT( rc == 0 );
@@ -490,7 +489,7 @@ public:
{
vm = allocate_running(0);
- vm->add_history(hid,hostname,vmdir,vmm_mad,vnm_mad,tm_mad);
+ vm->add_history(hid,hostname,vmdir,vmm_mad,vnm_mad);
rc = vmpool->update_history(vm);
CPPUNIT_ASSERT( rc == 0 );
@@ -574,7 +573,7 @@ public:
{
vm = allocate_running(0);
- vm->add_history(hid,hostname,vmdir,vmm_mad,vnm_mad,tm_mad);
+ vm->add_history(hid,hostname,vmdir,vmm_mad,vnm_mad);
rc = vmpool->update_history(vm);
CPPUNIT_ASSERT( rc == 0 );
@@ -595,7 +594,7 @@ public:
{
vm = allocate_running(0);
- vm->add_history(hid,hostname,vmdir,vmm_mad,vnm_mad,tm_mad);
+ vm->add_history(hid,hostname,vmdir,vmm_mad,vnm_mad);
rc = vmpool->update_history(vm);
CPPUNIT_ASSERT( rc == 0 );
@@ -616,7 +615,7 @@ public:
{
vm = allocate_running(0);
- vm->add_history(hid,hostname,vmdir,vmm_mad,vnm_mad,tm_mad);
+ vm->add_history(hid,hostname,vmdir,vmm_mad,vnm_mad);
rc = vmpool->update_history(vm);
CPPUNIT_ASSERT( rc == 0 );
@@ -638,7 +637,7 @@ public:
{
vm = allocate_running(0);
- vm->add_history(hid,hostname,vmdir,vmm_mad,vnm_mad,tm_mad);
+ vm->add_history(hid,hostname,vmdir,vmm_mad,vnm_mad);
rc = vmpool->update_history(vm);
CPPUNIT_ASSERT( rc == 0 );
@@ -662,7 +661,7 @@ public:
{
vm = allocate_running(0);
- vm->add_history(hid,hostname,vmdir,vmm_mad,vnm_mad,tm_mad);
+ vm->add_history(hid,hostname,vmdir,vmm_mad,vnm_mad);
rc = vmpool->update_history(vm);
CPPUNIT_ASSERT( rc == 0 );
@@ -686,7 +685,7 @@ public:
{
vm = allocate_running(0);
- vm->add_history(hid,hostname,vmdir,vmm_mad,vnm_mad,tm_mad);
+ vm->add_history(hid,hostname,vmdir,vmm_mad,vnm_mad);
rc = vmpool->update_history(vm);
CPPUNIT_ASSERT( rc == 0 );
@@ -750,7 +749,7 @@ public:
{
vm = allocate_running(0);
- vm->add_history(hid,hostname,vmdir,vmm_mad,vnm_mad,tm_mad);
+ vm->add_history(hid,hostname,vmdir,vmm_mad,vnm_mad);
rc = vmpool->update_history(vm);
CPPUNIT_ASSERT( rc == 0 );
@@ -773,7 +772,7 @@ public:
{
vm = allocate_running(0);
- vm->add_history(hid,hostname,vmdir,vmm_mad,vnm_mad,tm_mad);
+ vm->add_history(hid,hostname,vmdir,vmm_mad,vnm_mad);
rc = vmpool->update_history(vm);
CPPUNIT_ASSERT( rc == 0 );
@@ -796,7 +795,7 @@ public:
{
vm = allocate_running(0);
- vm->add_history(hid,hostname,vmdir,vmm_mad,vnm_mad,tm_mad);
+ vm->add_history(hid,hostname,vmdir,vmm_mad,vnm_mad);
rc = vmpool->update_history(vm);
CPPUNIT_ASSERT( rc == 0 );
diff --git a/src/test/Nebula.cc b/src/test/Nebula.cc
index 86229b0dbe..f9d66ace3d 100644
--- a/src/test/Nebula.cc
+++ b/src/test/Nebula.cc
@@ -87,6 +87,11 @@ void Nebula::start()
delete gpool;
}
+ if ( dspool != 0)
+ {
+ delete dspool;
+ }
+
if ( vmm != 0)
{
delete vmm;
@@ -184,6 +189,7 @@ void Nebula::start()
VMTemplatePool::bootstrap(db);
GroupPool::bootstrap(db);
AclManager::bootstrap(db);
+ DatastorePool::bootstrap(db);
}
catch (exception&)
{
@@ -235,6 +241,11 @@ void Nebula::start()
{
tpool = tester->create_tpool(db);
}
+
+ if (tester->need_datastore_pool)
+ {
+ dspool = tester->create_dspool(db);
+ }
}
catch (exception&)
{
diff --git a/src/test/NebulaTest.cc b/src/test/NebulaTest.cc
index eda496815d..b600a59924 100644
--- a/src/test/NebulaTest.cc
+++ b/src/test/NebulaTest.cc
@@ -62,6 +62,11 @@ GroupPool* NebulaTest::create_gpool(SqlDB* db)
return new GroupPool(db);
}
+DatastorePool* NebulaTest::create_dspool(SqlDB* db)
+{
+ return new DatastorePool(db);
+}
+
// -----------------------------------------------------------
// Managers
// -----------------------------------------------------------
diff --git a/src/vm/test/SConstruct b/src/vm/test/SConstruct
index 9fc71af828..c2eb20b3b3 100644
--- a/src/vm/test/SConstruct
+++ b/src/vm/test/SConstruct
@@ -28,6 +28,7 @@ env.Prepend(LIBS=[
'nebula_pool',
'nebula_xml',
'nebula_image',
+ 'nebula_datastore',
'nebula_mad',
'nebula_common',
'nebula_log',
diff --git a/src/vm/test/VirtualMachinePoolTest.cc b/src/vm/test/VirtualMachinePoolTest.cc
index d74ecfbc3d..4febff2e81 100644
--- a/src/vm/test/VirtualMachinePoolTest.cc
+++ b/src/vm/test/VirtualMachinePoolTest.cc
@@ -66,7 +66,7 @@ const string xml_dump_where =
"011the_userusersVM one110000000010000000000000000";
const string xml_history_dump =
- "001the_userusersVM one110000000010000000000000000101the_userusersSecond VM1100000000200000000000000000A_hostnameA_vm_dir000A_vmm_madA_vnm_madA_tm_mad0000000201the_userusersVM one1100000000200000000000000001C_hostnameC_vm_dir200C_vmm_madC_vnm_madC_tm_mad0000000311the_userusersVM one110000000060000000000000000";
+ "001the_userusersVM one110000000010000000000000000101the_userusersSecond VM1100000000200000000000000000A_hostnameA_vm_dir000A_vmm_madA_vnm_mad0000000201the_userusersVM one1100000000200000000000000001C_hostnameC_vm_dir200C_vmm_madC_vnm_mad0000000311the_userusersVM one110000000060000000000000000";
/* ************************************************************************* */
/* ************************************************************************* */
@@ -194,7 +194,6 @@ public:
string hostname = "hostname";
string vm_dir = "vm_dir";
string vmm_mad = "vm_mad";
- string tm_mad = "tm_mad";
// Allocate two VMs
oid = allocate(0);
@@ -302,7 +301,6 @@ public:
string vm_dirs[] = {"A_vm_dir", "B_vm_dir", "C_vm_dir"};
string vmm_mads[] = {"A_vmm_mad", "B_vmm_mad", "C_vmm_mad"};
string vnm_mads[] = {"A_vnm_mad", "B_vnm_mad", "C_vnm_mad"};
- string tm_mads[] = {"A_tm_mad", "B_tm_mad", "C_tm_mad"};
int oid, rc;
ostringstream oss;
@@ -324,7 +322,7 @@ public:
CPPUNIT_ASSERT( vm != 0 );
// Add a history item
- vm->add_history(0, hostnames[0], vm_dirs[0], vmm_mads[0], vnm_mads[0], tm_mads[0]);
+ vm->add_history(0, hostnames[0], vm_dirs[0], vmm_mads[0], vnm_mads[0]);
rc = vmp->update(vm);
CPPUNIT_ASSERT( rc == 0 );
@@ -342,7 +340,7 @@ public:
CPPUNIT_ASSERT( vm != 0 );
// Add a history item
- vm->add_history(1, hostnames[1], vm_dirs[1], vmm_mads[1], vnm_mads[1], tm_mads[1]);
+ vm->add_history(1, hostnames[1], vm_dirs[1], vmm_mads[1], vnm_mads[1]);
rc = vmp->update(vm);
CPPUNIT_ASSERT( rc == 0 );
@@ -351,7 +349,7 @@ public:
CPPUNIT_ASSERT( rc == 0 );
// Add another history item
- vm->add_history(2, hostnames[2], vm_dirs[2], vmm_mads[2], vnm_mads[2], tm_mads[2]);
+ vm->add_history(2, hostnames[2], vm_dirs[2], vmm_mads[2], vnm_mads[2]);
rc = vmp->update(vm);
CPPUNIT_ASSERT( rc == 0 );
@@ -409,7 +407,6 @@ public:
string vm_dir = "vm_dir";
string vmm_mad = "vm_mad";
string vnm_mad = "vn_mad";
- string tm_mad = "tm_mad";
// Allocate a VM
oid = allocate(0);
@@ -419,7 +416,7 @@ public:
CPPUNIT_ASSERT( vm != 0 );
// Add a history item
- vm->add_history(0, hostname, vm_dir, vmm_mad, vnm_mad, tm_mad);
+ vm->add_history(0, hostname, vm_dir, vmm_mad, vnm_mad);
rc = vmp->update(vm);
CPPUNIT_ASSERT( rc == 0 );
@@ -427,7 +424,7 @@ public:
rc = vmp->update_history(vm);
CPPUNIT_ASSERT( rc == 0 );
- vm->add_history(0, new_hostname, vm_dir, vmm_mad, vnm_mad, tm_mad);
+ vm->add_history(0, new_hostname, vm_dir, vmm_mad, vnm_mad);
rc = vmp->update(vm);
CPPUNIT_ASSERT( rc == 0 );