mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-22 13:33:52 +03:00
Bug #1036: Local hooks are now executed from $VAR_LOCATION/remotes/hooks. Remote hooks are still executed from the SCRIPTS_REMOTE_PATH.
This commit is contained in:
parent
f41a20d4dd
commit
42cebe30c1
@ -37,7 +37,8 @@ class HostPool : public PoolSQL
|
||||
public:
|
||||
HostPool(SqlDB * db,
|
||||
vector<const Attribute *> hook_mads,
|
||||
const string& hook_location);
|
||||
const string& hook_location,
|
||||
const string& remotes_location);
|
||||
|
||||
~HostPool(){};
|
||||
|
||||
|
@ -34,7 +34,8 @@ public:
|
||||
|
||||
VirtualMachinePool(SqlDB * db,
|
||||
vector<const Attribute *> hook_mads,
|
||||
const string& hook_location);
|
||||
const string& hook_location,
|
||||
const string& remotes_location);
|
||||
|
||||
~VirtualMachinePool(){};
|
||||
|
||||
|
@ -88,9 +88,10 @@ public:
|
||||
// Pools
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
virtual VirtualMachinePool* create_vmpool(SqlDB* db, string hook_location);
|
||||
virtual VirtualMachinePool* create_vmpool(SqlDB* db,
|
||||
string hook_location, string vloc);
|
||||
|
||||
virtual HostPool* create_hpool(SqlDB* db, string hook_location);
|
||||
virtual HostPool* create_hpool(SqlDB* db, string hook_location, string vloc);
|
||||
|
||||
virtual VirtualNetworkPool* create_vnpool(SqlDB* db,
|
||||
string mac_prefix,
|
||||
|
@ -19,6 +19,7 @@
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
|
||||
#include "HostPool.h"
|
||||
#include "HostHook.h"
|
||||
@ -30,7 +31,8 @@
|
||||
|
||||
HostPool::HostPool(SqlDB* db,
|
||||
vector<const Attribute *> hook_mads,
|
||||
const string& hook_location)
|
||||
const string& hook_location,
|
||||
const string& remotes_location)
|
||||
: PoolSQL(db,Host::table)
|
||||
{
|
||||
// ------------------ Initialize Hooks fot the pool ----------------------
|
||||
@ -88,7 +90,18 @@ HostPool::HostPool(SqlDB* db,
|
||||
|
||||
if (cmd[0] != '/')
|
||||
{
|
||||
cmd = hook_location + cmd;
|
||||
ostringstream cmd_os;
|
||||
|
||||
if ( remote )
|
||||
{
|
||||
cmd_os << hook_location << "/" << cmd;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd_os << remotes_location << "/hooks/" << cmd;
|
||||
}
|
||||
|
||||
cmd = cmd_os.str();
|
||||
}
|
||||
|
||||
if ( on == "CREATE" )
|
||||
|
@ -155,7 +155,7 @@ protected:
|
||||
{
|
||||
vector<const Attribute *> hook;
|
||||
|
||||
return new HostPool(db,hook,"./");
|
||||
return new HostPool(db,hook,"./", "./");
|
||||
};
|
||||
|
||||
int allocate(int index)
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
// Pools
|
||||
// -----------------------------------------------------------
|
||||
|
||||
HostPool* create_hpool(SqlDB* db, string hook_location)
|
||||
HostPool* create_hpool(SqlDB* db, string hook_location, string var_location)
|
||||
{
|
||||
map<string,string> hook_value;
|
||||
VectorAttribute * hook;
|
||||
@ -81,7 +81,7 @@ public:
|
||||
host_hooks.push_back(hook);
|
||||
|
||||
|
||||
return new HostPool(db, host_hooks, hook_location);
|
||||
return new HostPool(db, host_hooks, hook_location, var_location);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -280,14 +280,16 @@ void Nebula::start()
|
||||
nebula_configuration->get("VM_HOOK", vm_hooks);
|
||||
nebula_configuration->get("HOST_HOOK", host_hooks);
|
||||
|
||||
vmpool = new VirtualMachinePool(db, vm_hooks, hook_location);
|
||||
hpool = new HostPool(db, host_hooks, hook_location);
|
||||
vmpool = new VirtualMachinePool(db,
|
||||
vm_hooks,
|
||||
hook_location,
|
||||
remotes_location);
|
||||
hpool = new HostPool(db, host_hooks, hook_location, remotes_location);
|
||||
|
||||
nebula_configuration->get("MAC_PREFIX", mac_prefix);
|
||||
nebula_configuration->get("NETWORK_SIZE", size);
|
||||
|
||||
vnpool = new VirtualNetworkPool(db,mac_prefix,size);
|
||||
|
||||
gpool = new GroupPool(db);
|
||||
|
||||
nebula_configuration->get("SESSION_EXPIRATION_TIME", expiration_time);
|
||||
|
@ -201,12 +201,12 @@ void Nebula::start()
|
||||
|
||||
if (tester->need_vm_pool)
|
||||
{
|
||||
vmpool = tester->create_vmpool(db,hook_location);
|
||||
vmpool = tester->create_vmpool(db,hook_location,var_location);
|
||||
}
|
||||
|
||||
if (tester->need_host_pool)
|
||||
{
|
||||
hpool = tester->create_hpool(db,hook_location);
|
||||
hpool = tester->create_hpool(db,hook_location,var_location);
|
||||
}
|
||||
|
||||
if (tester->need_vnet_pool)
|
||||
|
@ -18,16 +18,17 @@
|
||||
|
||||
NebulaTest* NebulaTest::the_tester;
|
||||
|
||||
VirtualMachinePool* NebulaTest::create_vmpool(SqlDB* db, string hook_location)
|
||||
VirtualMachinePool* NebulaTest::create_vmpool(SqlDB* db, string hook_location,
|
||||
string vloc)
|
||||
{
|
||||
vector<const Attribute *> hooks;
|
||||
return new VirtualMachinePool(db, hooks, hook_location);
|
||||
return new VirtualMachinePool(db, hooks, hook_location, vloc);
|
||||
}
|
||||
|
||||
HostPool* NebulaTest::create_hpool(SqlDB* db, string hook_location)
|
||||
HostPool* NebulaTest::create_hpool(SqlDB* db, string hook_location, string vloc)
|
||||
{
|
||||
vector<const Attribute *> hooks;
|
||||
return new HostPool(db, hooks, hook_location);
|
||||
return new HostPool(db, hooks, hook_location, vloc);
|
||||
}
|
||||
|
||||
VirtualNetworkPool* NebulaTest::create_vnpool(SqlDB* db, string mac_prefix, int size)
|
||||
|
@ -26,7 +26,8 @@
|
||||
|
||||
VirtualMachinePool::VirtualMachinePool(SqlDB * db,
|
||||
vector<const Attribute *> hook_mads,
|
||||
const string& hook_location)
|
||||
const string& hook_location,
|
||||
const string& remotes_location)
|
||||
: PoolSQL(db,VirtualMachine::table)
|
||||
{
|
||||
const VectorAttribute * vattr;
|
||||
@ -82,7 +83,18 @@ VirtualMachinePool::VirtualMachinePool(SqlDB * db,
|
||||
|
||||
if (cmd[0] != '/')
|
||||
{
|
||||
cmd = hook_location + cmd;
|
||||
ostringstream cmd_os;
|
||||
|
||||
if ( remote )
|
||||
{
|
||||
cmd_os << hook_location << "/" << cmd;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd_os << remotes_location << "/hooks/" << cmd;
|
||||
}
|
||||
|
||||
cmd = cmd_os.str();
|
||||
}
|
||||
|
||||
if ( on == "CREATE" )
|
||||
|
@ -85,7 +85,7 @@ class VirtualMachinePoolFriend : public VirtualMachinePool
|
||||
{
|
||||
public:
|
||||
VirtualMachinePoolFriend(SqlDB * db, vector<const Attribute *> hook_mads):
|
||||
VirtualMachinePool(db, hook_mads, "./")
|
||||
VirtualMachinePool(db, hook_mads, "./", "./")
|
||||
{};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user