1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

Fix compilation for tests with the new classes

This commit is contained in:
Ruben S. Montero 2012-02-24 21:12:50 +01:00
parent f6615f66d2
commit f411c685d7
11 changed files with 116 additions and 22 deletions

View File

@ -33,6 +33,7 @@ env.Prepend(LIBS=[
'nebula_template',
'nebula_image',
'nebula_pool',
'nebula_cluster',
'nebula_host',
'nebula_vnm',
'nebula_vm',

View File

@ -34,6 +34,7 @@ env.Prepend(LIBS=[
'nebula_template',
'nebula_image',
'nebula_pool',
'nebula_cluster',
'nebula_host',
'nebula_vnm',
'nebula_vm',

View File

@ -96,7 +96,15 @@ public:
{
string err;
hpool->allocate(&oid, "host_test", "im_mad", "vmm_mad", "vnm_mad", err);
hpool->allocate(&oid,
"host_test",
"im_mad",
"vmm_mad",
"vnm_mad",
ClusterPool::DEFAULT_CLUSTER_ID,
ClusterPool::DEFAULT_CLUSTER_NAME,
err);
CPPUNIT_ASSERT( oid >= 0 );
sleep(1);
@ -114,7 +122,15 @@ public:
{
string err;
hpool->allocate(&oid, "host_test", "im_mad", "vmm_mad", "vnm_mad", err);
hpool->allocate(&oid,
"host_test",
"im_mad",
"vmm_mad",
"vnm_mad",
ClusterPool::DEFAULT_CLUSTER_ID,
ClusterPool::DEFAULT_CLUSTER_NAME,
err);
CPPUNIT_ASSERT( oid >= 0 );
host = hpool->get(oid, true);
@ -140,7 +156,14 @@ public:
{
string err;
hpool->allocate(&oid, "host_test", "im_mad", "vmm_mad", "vnm_mad", err);
hpool->allocate(&oid,
"host_test",
"im_mad",
"vmm_mad",
"vnm_mad",
ClusterPool::DEFAULT_CLUSTER_ID,
ClusterPool::DEFAULT_CLUSTER_NAME,
err);
CPPUNIT_ASSERT( oid >= 0 );
host = hpool->get(oid, true);
@ -166,7 +189,15 @@ public:
{
string err;
hpool->allocate(&oid, "host_test", "im_mad", "vmm_mad", "vnm_mad", err);
hpool->allocate(&oid,
"host_test",
"im_mad",
"vmm_mad",
"vnm_mad",
ClusterPool::DEFAULT_CLUSTER_ID,
ClusterPool::DEFAULT_CLUSTER_NAME,
err);
CPPUNIT_ASSERT( oid >= 0 );
host = hpool->get(oid, true);

View File

@ -163,7 +163,9 @@ protected:
int oid;
string err;
return ((HostPool*)pool)->allocate(&oid, names[index], im_mad,
vmm_mad, vnm_mad, err);
vmm_mad, vnm_mad,
ClusterPool::DEFAULT_CLUSTER_ID,
ClusterPool::DEFAULT_CLUSTER_NAME,err);
};
void check(int index, PoolObjectSQL* obj)
@ -243,16 +245,37 @@ public:
// 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, err);
rc = hp->allocate(&oid_0,
names[0],
im_mad,
vmm_mad,
vnm_mad,
ClusterPool::DEFAULT_CLUSTER_ID,
ClusterPool::DEFAULT_CLUSTER_NAME,
err);
CPPUNIT_ASSERT( oid_0 == 0 );
CPPUNIT_ASSERT( rc == oid_0 );
rc = hp->allocate(&oid_1, names[0], im_mad, vmm_mad, vnm_mad, err);
rc = hp->allocate(&oid_1,
names[0],
im_mad,
vmm_mad,
vnm_mad,
ClusterPool::DEFAULT_CLUSTER_ID,
ClusterPool::DEFAULT_CLUSTER_NAME,
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_2, vmm_mad, vnm_mad, err);
rc = hp->allocate(&oid_1,
names[0],
im_mad_2,
vmm_mad,
vnm_mad,
ClusterPool::DEFAULT_CLUSTER_ID,
ClusterPool::DEFAULT_CLUSTER_NAME,
err);
CPPUNIT_ASSERT( oid_1 == -1 );
CPPUNIT_ASSERT( rc == oid_1 );
@ -272,8 +295,14 @@ public:
for(int i=0; i<5; i++)
{
((HostPool*)pool)->allocate(&oid, names[i],
im_mad, vmm_mad, vnm_mad, err);
((HostPool*)pool)->allocate(&oid,
names[i],
im_mad,
vmm_mad,
vnm_mad,
ClusterPool::DEFAULT_CLUSTER_ID,
ClusterPool::DEFAULT_CLUSTER_NAME,
err);
}
ostringstream oss;
@ -305,8 +334,14 @@ public:
for(int i=0; i<5; i++)
{
((HostPool*)pool)->allocate(&oid, names[i],
im_mad, vmm_mad, vnm_mad, err);
((HostPool*)pool)->allocate(&oid,
names[i],
im_mad,
vmm_mad,
vnm_mad,
ClusterPool::DEFAULT_CLUSTER_ID,
ClusterPool::DEFAULT_CLUSTER_NAME,
err);
}
ostringstream oss;
@ -345,7 +380,14 @@ public:
{
oss << "host" << i;
hp->allocate(&oid, oss.str().c_str(),im_mad, vmm_mad, vnm_mad, err);
hp->allocate(&oid,
oss.str(),
im_mad,
vmm_mad,
vnm_mad,
ClusterPool::DEFAULT_CLUSTER_ID,
ClusterPool::DEFAULT_CLUSTER_NAME,
err);
CPPUNIT_ASSERT(oid == i);
if (i >=8 )
@ -403,7 +445,14 @@ public:
{
oss << "host" << j;
hp->allocate(&oid,oss.str().c_str(),im_mad,vmm_mad,vnm_mad,err);
hp->allocate(&oid,
oss.str(),
im_mad,
vmm_mad,
vnm_mad,
ClusterPool::DEFAULT_CLUSTER_ID,
ClusterPool::DEFAULT_CLUSTER_NAME,
err);
}
the_time2 = time(0) - the_time;
@ -432,7 +481,14 @@ 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,err);
hp->allocate(&oid,
oss.str(),
im_mad,
vmm_mad,
vnm_mad,
ClusterPool::DEFAULT_CLUSTER_ID,
ClusterPool::DEFAULT_CLUSTER_NAME,
err);
host = hp->get(oid, false);

View File

@ -19,6 +19,7 @@
Import('env')
env.Prepend(LIBS=[
'nebula_cluster',
'nebula_host',
'nebula_core_test',
'nebula_vmm',

View File

@ -597,7 +597,7 @@ public:
VectorAttribute * disk;
int oid_0, oid_1, index, img_id;
string value;
string value, error;
Image::ImageType img_type;
// ---------------------------------------------------------------------
@ -632,7 +632,7 @@ public:
disk = new VectorAttribute("DISK");
disk->replace("IMAGE_ID", "0");
((ImagePool*)imp)->disk_attribute(disk, 0, &index, &img_type,0, img_id);
((ImagePool*)imp)->disk_attribute(disk, 0, &index, &img_type,0, img_id,error);
value = "";
value = disk->vector_value("TARGET");
@ -646,7 +646,7 @@ public:
disk = new VectorAttribute("DISK");
disk->replace("IMAGE_ID", "1");
((ImagePool*)imp)->disk_attribute(disk, 0, &index, &img_type,0, img_id);
((ImagePool*)imp)->disk_attribute(disk, 0, &index, &img_type,0, img_id,error);
value = "";
value = disk->vector_value("TARGET");

View File

@ -34,6 +34,7 @@ env.Prepend(LIBS=[
'nebula_template',
'nebula_image',
'nebula_pool',
'nebula_cluster',
'nebula_host',
'nebula_vnm',
'nebula_vm',

View File

@ -36,6 +36,7 @@ env.Prepend(LIBS=[
'nebula_template',
'nebula_image',
'nebula_pool',
'nebula_cluster',
'nebula_host',
'nebula_vnm',
'nebula_vm',

View File

@ -34,6 +34,7 @@ env.Prepend(LIBS=[
'nebula_template',
'nebula_image',
'nebula_pool',
'nebula_cluster',
'nebula_host',
'nebula_vnm',
'nebula_vm',

View File

@ -24,6 +24,7 @@ env.Prepend(LIBS=[
'nebula_hm',
'nebula_rm',
'nebula_datastore',
'nebula_cluster',
'nebula_dm',
'nebula_tm',
'nebula_um',

View File

@ -1067,7 +1067,7 @@ public:
VectorAttribute * disk;
int oid_0, oid_1;
string value;
string value, error;
// ---------------------------------------------------------------------
// Allocate 2 vnets
@ -1092,9 +1092,9 @@ public:
disk = new VectorAttribute("DISK");
disk->replace("NETWORK", "Net 0");
((VirtualNetworkPool*)vnp)->nic_attribute(disk, 0, 0);
((VirtualNetworkPool*)vnp)->nic_attribute(disk, 0, 0, error);
((VirtualNetworkPool*)vnp)->nic_attribute(disk, 0, 0);
((VirtualNetworkPool*)vnp)->nic_attribute(disk, 0, 0, error);
value = "";
value = disk->vector_value("NETWORK");
@ -1123,7 +1123,7 @@ public:
disk = new VectorAttribute("DISK");
disk->replace("NETWORK_ID", "1");
((VirtualNetworkPool*)vnp)->nic_attribute(disk,0, 0);
((VirtualNetworkPool*)vnp)->nic_attribute(disk,0, 0, error);
value = "";
value = disk->vector_value("NETWORK");