mirror of
https://github.com/OpenNebula/one.git
synced 2025-02-26 09:57:23 +03:00
parent
5071e85493
commit
27341b66cf
@ -713,6 +713,7 @@ public:
|
||||
|
||||
/**
|
||||
* Get all disk images for this Virtual Machine
|
||||
* @param error_str Returns the error reason, if any
|
||||
* @return 0 if success
|
||||
*/
|
||||
int get_disk_images(string &error_str);
|
||||
@ -926,16 +927,18 @@ private:
|
||||
/**
|
||||
* Parse the "CONTEXT" attribute of the template by substituting
|
||||
* $VARIABLE, $VARIABLE[ATTR] and $VARIABLE[ATTR, ATTR = VALUE]
|
||||
* @param error_str Returns the error reason, if any
|
||||
* @return 0 on success
|
||||
*/
|
||||
int parse_context();
|
||||
int parse_context(string& error_str);
|
||||
|
||||
/**
|
||||
* Parse the "REQUIREMENTS" attribute of the template by substituting
|
||||
* $VARIABLE, $VARIABLE[ATTR] and $VARIABLE[ATTR, ATTR = VALUE]
|
||||
* @param error_str Returns the error reason, if any
|
||||
* @return 0 on success
|
||||
*/
|
||||
int parse_requirements();
|
||||
int parse_requirements(string& error_str);
|
||||
|
||||
/**
|
||||
* Parse the "GRAPHICS" attribute and generates a default PORT if not
|
||||
|
@ -233,14 +233,14 @@ int VirtualMachine::insert(SqlDB * db, string& error_str)
|
||||
// Parse the context & requirements
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
rc = parse_context();
|
||||
rc = parse_context(error_str);
|
||||
|
||||
if ( rc != 0 )
|
||||
{
|
||||
goto error_context;
|
||||
}
|
||||
|
||||
rc = parse_requirements();
|
||||
rc = parse_requirements(error_str);
|
||||
|
||||
if ( rc != 0 )
|
||||
{
|
||||
@ -276,11 +276,9 @@ error_images:
|
||||
goto error_common;
|
||||
|
||||
error_context:
|
||||
error_str = "Could not parse CONTEXT for VM.";
|
||||
goto error_common;
|
||||
|
||||
error_requirements:
|
||||
error_str = "Could not parse REQUIREMENTS for VM.";
|
||||
goto error_common;
|
||||
|
||||
error_common:
|
||||
@ -293,7 +291,7 @@ error_common:
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int VirtualMachine::parse_context()
|
||||
int VirtualMachine::parse_context(string& error_str)
|
||||
{
|
||||
int rc, num;
|
||||
|
||||
@ -309,12 +307,17 @@ int VirtualMachine::parse_context()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if ( num > 1 )
|
||||
{
|
||||
error_str = "Only one CONTEXT attribute can be defined.";
|
||||
return -1;
|
||||
}
|
||||
|
||||
context = dynamic_cast<VectorAttribute *>(array_context[0]);
|
||||
|
||||
if ( context == 0 )
|
||||
{
|
||||
NebulaLog::log("ONE",Log::ERROR, "Wrong format for CONTEXT attribute");
|
||||
error_str = "Wrong format for CONTEXT attribute.";
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -413,7 +416,7 @@ void VirtualMachine::parse_graphics()
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int VirtualMachine::parse_requirements()
|
||||
int VirtualMachine::parse_requirements(string& error_str)
|
||||
{
|
||||
int rc, num;
|
||||
|
||||
@ -428,12 +431,17 @@ int VirtualMachine::parse_requirements()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if ( num > 1 )
|
||||
{
|
||||
error_str = "Only one REQUIREMENTS attribute can be defined.";
|
||||
return -1;
|
||||
}
|
||||
|
||||
reqs = dynamic_cast<SingleAttribute *>(array_reqs[0]);
|
||||
|
||||
if ( reqs == 0 )
|
||||
{
|
||||
NebulaLog::log("ONE",Log::ERROR,"Wrong format for REQUIREMENTS");
|
||||
error_str = "Wrong format for REQUIREMENTS attribute.";
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user