1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-26 06:50:09 +03:00

feature #200: Initial integration of ImagePool

This commit is contained in:
Constantino Vázquez Blanco 2010-06-01 18:00:44 +02:00
parent 5e23f178d3
commit f41a74cd02
5 changed files with 76 additions and 6 deletions

View File

@ -340,6 +340,7 @@ private:
HostPool * hpool;
VirtualNetworkPool * vnpool;
UserPool * upool;
ImagePool * ipool;
// ---------------------------------------------------------------
// Nebula Managers

View File

@ -669,13 +669,13 @@ private:
class ImageAllocate: public xmlrpc_c::method
{
public:
UserAllocate(UserPool * _upool):upool(_upool)
ImageAllocate(UserPool * _upool):upool(_upool)
{
_signature="A:sss";
_help="Creates a new user";
};
~UserAllocate(){};
~ImageAllocate(){};
void execute(
xmlrpc_c::paramList const& paramList,
@ -683,7 +683,32 @@ private:
private:
UserPool * upool;
};
};
/* ---------------------------------------------------------------------- */
class ImageInfo: public xmlrpc_c::method
{
public:
ImageInfo(ImagePool * _ipool,
UserPool * _upool):
ipool(_ipool),
upool(_upool)
{
_signature="A:ss";
_help="Allocates an image in the pool";
};
~ImageInfo(){};
void execute(
xmlrpc_c::paramList const& paramList,
xmlrpc_c::value * const retvalP);
private:
ImagePool * ipool;
UserPool * upool;
};
/* ---------------------------------------------------------------------- */
@ -708,7 +733,7 @@ private:
private:
ImagePool * ipool;
UserPool * upool;
};
};
/* -------------------------------------------------------------------------- */

View File

@ -58,6 +58,28 @@ NETWORK_SIZE = 254
MAC_PREFIX = "00:03"
#*******************************************************************************
# Image Repository Configuration
#*******************************************************************************
# IMAGE_REPOSITORY_PATH: Define the path to the image repository, by default
# is set to $ONE_LOCATION/var
#
# DEFAULT_IMAGE_TYPE: This can take values
# OS Image file holding an operating system
# CDROM Image file holding a CDROM
# DATABLOCK Image file holding a datablock,
# always created as an empty block
# DEFAULT_DEVICE_PREFIX: This can be set to
# hd IDE prefix
# sd SCSI
# xvd XEN Virtual Disk
# vd KVM virtual disk
#*******************************************************************************
#IMAGE_REPOSITORY_PATH =
DEFAULT_IMAGE_TYPE = "OS"
DEFAULT_DEVICE_PREFIX = "hd"
#*******************************************************************************
# Information Driver Configuration
#*******************************************************************************

View File

@ -205,6 +205,7 @@ void Nebula::start()
HostPool::bootstrap(db);
VirtualNetworkPool::bootstrap(db);
UserPool::bootstrap(db);
ImagePool::bootstrap(db);
}
catch (exception&)
{
@ -213,8 +214,11 @@ void Nebula::start()
try
{
string mac_prefix;
int size;
string mac_prefix;
int size;
string repository_path;
string default_image_type;
string default_device_prefix;
vector<const Attribute *> vm_hooks;
@ -229,6 +233,22 @@ void Nebula::start()
vnpool = new VirtualNetworkPool(db,mac_prefix,size);
upool = new UserPool(db);
nebula_configuration->get("IMAGE_REPOSITORY_PATH", repository_path);
if (repository_path.empty()) // Defaults to ONE_LOCATION/var
{
repository_path = var_location;
}
nebula_configuration->get("DEFAULT_IMAGE_TYPE", default_image_type);
nebula_configuration->get("DEFAULT_DEVICE_PREFIX",
default_device_prefix);
ipool = new ImagePool(db,
repository_path,
default_image_type,
default_device_prefix);
}
catch (exception&)
{
@ -389,6 +409,7 @@ void Nebula::start()
hpool,
vnpool,
upool,
ipool,
rm_port,
log_location + "one_xmlrpc.log");
}

View File

@ -42,6 +42,7 @@ env.Append(LIBS=[
'nebula_um',
'nebula_mad',
'nebula_template',
'nebula_image',
'nebula_pool',
'nebula_host',
'nebula_vnm',