mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
This commit is contained in:
parent
3579838ac1
commit
a5062dc68d
@ -83,29 +83,6 @@ public:
|
||||
|
||||
return new HostPool(db, host_hooks, hook_location);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// Managers
|
||||
// -----------------------------------------------------------
|
||||
|
||||
HookManager* create_hm(VirtualMachinePool * vmpool)
|
||||
{
|
||||
map<string,string> mad_value;
|
||||
VectorAttribute * mad;
|
||||
vector<const Attribute *> hm_mads;
|
||||
|
||||
ostringstream oss;
|
||||
|
||||
// we need the full path (i.e, starting with '/')
|
||||
// for the dummy executable
|
||||
oss << getenv("PWD") << "/../../hm_mad/test/dummy";
|
||||
mad_value.insert(make_pair("EXECUTABLE",oss.str()));
|
||||
|
||||
mad = new VectorAttribute("HM_MAD",mad_value);
|
||||
hm_mads.push_back(mad);
|
||||
|
||||
return new HookManager(hm_mads,vmpool);
|
||||
}
|
||||
};
|
||||
|
||||
#endif /*NEBULA_TEST_H_*/
|
||||
|
@ -64,6 +64,24 @@ const string xml_dump_where =
|
||||
"<IMAGE_POOL><IMAGE><ID>0</ID><UID>0</UID><GID>1</GID><NAME>Image one</NAME><TYPE>0</TYPE><PUBLIC>0</PUBLIC><PERSISTENT>1</PERSISTENT><REGTIME>0000000000</REGTIME><SOURCE>-</SOURCE><STATE>4</STATE><RUNNING_VMS>0</RUNNING_VMS><TEMPLATE><DESCRIPTION><![CDATA[This is a very long description of an image, and to achieve the longness I will copy this over. This is a very long description of an image, and to achieve the longness I will copy this over. And over. This is a very long description of an image, and to achieve the longness I will copy this over. And over. This is a very long description of an image, and to achieve the longness I will copy this over. And over.This is a very long description of an image, and to achieve the longness I will copy this over.]]></DESCRIPTION><DEV_PREFIX><![CDATA[hd]]></DEV_PREFIX><NAME><![CDATA[Image one]]></NAME><PATH><![CDATA[/tmp/image_test]]></PATH></TEMPLATE></IMAGE><IMAGE><ID>1</ID><UID>1</UID><GID>1</GID><NAME>Second Image</NAME><TYPE>0</TYPE><PUBLIC>1</PUBLIC><PERSISTENT>0</PERSISTENT><REGTIME>0000000000</REGTIME><SOURCE>-</SOURCE><STATE>4</STATE><RUNNING_VMS>0</RUNNING_VMS><TEMPLATE><DESCRIPTION><![CDATA[This is a rather short description.]]></DESCRIPTION><DEV_PREFIX><![CDATA[hd]]></DEV_PREFIX><NAME><![CDATA[Second Image]]></NAME><PATH><![CDATA[/tmp/image_second_test]]></PATH></TEMPLATE></IMAGE></IMAGE_POOL>";
|
||||
|
||||
|
||||
/* ************************************************************************* */
|
||||
/* ************************************************************************* */
|
||||
|
||||
#include "NebulaTest.h"
|
||||
|
||||
class NebulaTestImage: public NebulaTest
|
||||
{
|
||||
public:
|
||||
NebulaTestImage():NebulaTest()
|
||||
{
|
||||
NebulaTest::the_tester = this;
|
||||
|
||||
need_image_pool = true;
|
||||
need_imagem = true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class ImagePoolFriend : public ImagePool
|
||||
{
|
||||
public:
|
||||
@ -135,16 +153,18 @@ class ImagePoolTest : public PoolTest
|
||||
|
||||
protected:
|
||||
|
||||
NebulaTestImage * tester;
|
||||
ImagePool * ipool;
|
||||
|
||||
void bootstrap(SqlDB* db)
|
||||
{
|
||||
ImagePool::bootstrap(db);
|
||||
// setUp overwritten
|
||||
};
|
||||
|
||||
PoolSQL* create_pool(SqlDB* db)
|
||||
{
|
||||
ImagePoolFriend * imp =
|
||||
new ImagePoolFriend(db, "OS", "hd");
|
||||
return imp;
|
||||
// setUp overwritten
|
||||
return ipool;
|
||||
};
|
||||
|
||||
int allocate(int index)
|
||||
@ -183,7 +203,26 @@ public:
|
||||
|
||||
~ImagePoolTest(){xmlCleanupParser();};
|
||||
|
||||
void setUp()
|
||||
{
|
||||
create_db();
|
||||
|
||||
tester = new NebulaTestImage();
|
||||
|
||||
Nebula& neb = Nebula::instance();
|
||||
neb.start();
|
||||
|
||||
ipool = neb.get_ipool();
|
||||
|
||||
pool = ipool;
|
||||
};
|
||||
|
||||
void tearDown()
|
||||
{
|
||||
delete_db();
|
||||
|
||||
delete tester;
|
||||
};
|
||||
/* ********************************************************************* */
|
||||
|
||||
void names_initialization()
|
||||
|
@ -17,20 +17,30 @@
|
||||
Import('env')
|
||||
|
||||
env.Prepend(LIBS=[
|
||||
'nebula_image',
|
||||
### TODO: delete not needed
|
||||
'nebula_core_test',
|
||||
'nebula_host',
|
||||
'nebula_xml',
|
||||
'nebula_vmm',
|
||||
'nebula_im',
|
||||
'nebula_rm',
|
||||
'nebula_tm',
|
||||
'nebula_um',
|
||||
'nebula_vm',
|
||||
'nebula_hm',
|
||||
'nebula_vnm',
|
||||
'nebula_authm',
|
||||
'nebula_template',
|
||||
'nebula_pool',
|
||||
'nebula_mad',
|
||||
'nebula_template',
|
||||
'nebula_vm',
|
||||
'nebula_vmtemplate',
|
||||
'nebula_group',
|
||||
'nebula_vnm',
|
||||
'nebula_image',
|
||||
'nebula_pool',
|
||||
'nebula_hm',
|
||||
'nebula_authm',
|
||||
'nebula_common',
|
||||
'nebula_core',
|
||||
'nebula_lcm',
|
||||
'nebula_dm',
|
||||
'nebula_sql',
|
||||
'nebula_log',
|
||||
'nebula_xml',
|
||||
'crypto'
|
||||
])
|
||||
|
||||
|
26
src/mad/test/dummy
Executable file
26
src/mad/test/dummy
Executable file
@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
|
||||
# #
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||
# not use this file except in compliance with the License. You may obtain #
|
||||
# a copy of the License at #
|
||||
# #
|
||||
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||
# #
|
||||
# Unless required by applicable law or agreed to in writing, software #
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||
# See the License for the specific language governing permissions and #
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
#echo "MAD started" >> mad.log
|
||||
|
||||
while read COMMAND ARG1 ARG2 ARG3
|
||||
do
|
||||
# echo "$COMMAND $ARG1 $ARG2 $ARG3" >> mad.log
|
||||
|
||||
echo "$COMMAND SUCCESS"
|
||||
done
|
@ -122,6 +122,11 @@ void Nebula::start()
|
||||
delete hm;
|
||||
}
|
||||
|
||||
if ( imagem != 0 )
|
||||
{
|
||||
delete imagem;
|
||||
}
|
||||
|
||||
if ( authm != 0)
|
||||
{
|
||||
delete authm;
|
||||
@ -185,8 +190,8 @@ void Nebula::start()
|
||||
{
|
||||
string mac_prefix = "00:00";
|
||||
int size = 1;
|
||||
string default_image_type;
|
||||
string default_device_prefix;
|
||||
string default_image_type = "OS";
|
||||
string default_device_prefix = "hd";
|
||||
|
||||
if (tester->need_vm_pool)
|
||||
{
|
||||
@ -433,7 +438,7 @@ void Nebula::start()
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Auth Manager ----
|
||||
// ---- Image Manager ----
|
||||
if (tester->need_imagem)
|
||||
{
|
||||
try
|
||||
@ -482,6 +487,11 @@ void Nebula::start()
|
||||
hm->load_mads(0);
|
||||
}
|
||||
|
||||
if( imagem != 0 )
|
||||
{
|
||||
imagem->load_mads(0);
|
||||
}
|
||||
|
||||
if( authm != 0 )
|
||||
{
|
||||
authm->load_mads(0);
|
||||
|
@ -121,8 +121,12 @@ HookManager* NebulaTest::create_hm(VirtualMachinePool * vmpool)
|
||||
VectorAttribute * mad;
|
||||
|
||||
vector<const Attribute *> hm_mads;
|
||||
ostringstream oss;
|
||||
|
||||
mad_value.insert(make_pair("executable","one_hm"));
|
||||
// we need the full path (i.e, starting with '/')
|
||||
// for the dummy executable
|
||||
oss << getenv("PWD") << "/../../hm_mad/test/dummy";
|
||||
mad_value.insert(make_pair("EXECUTABLE",oss.str()));
|
||||
|
||||
mad = new VectorAttribute("HM_MAD",mad_value);
|
||||
hm_mads.push_back(mad);
|
||||
@ -141,10 +145,14 @@ ImageManager* NebulaTest::create_imagem(ImagePool * ipool)
|
||||
VectorAttribute * mad;
|
||||
|
||||
vector<const Attribute *> im_mads;
|
||||
ostringstream oss;
|
||||
|
||||
mad_value.insert(make_pair("executable","one_image"));
|
||||
// we need the full path (i.e, starting with '/')
|
||||
// for the dummy executable
|
||||
oss << getenv("PWD") << "/../../mad/test/dummy";
|
||||
mad_value.insert(make_pair("EXECUTABLE",oss.str()));
|
||||
|
||||
mad = new VectorAttribute("HM_MAD",mad_value);
|
||||
mad = new VectorAttribute("IMAGE_MAD",mad_value);
|
||||
im_mads.push_back(mad);
|
||||
|
||||
return new ImageManager(ipool,im_mads);
|
||||
|
Loading…
x
Reference in New Issue
Block a user