1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

bug #3661: New method for imported VMs

This commit is contained in:
Ruben S. Montero 2015-03-09 18:14:57 +01:00
parent 2203c78b0e
commit 2a5a2e4cc1
3 changed files with 20 additions and 8 deletions

View File

@ -1113,6 +1113,11 @@ public:
*/
static bool isVolatile(const Template * tmpl);
/**
* Check if the themplate is for an imported VM
*/
bool isImported() const;
/**
* Return the total SIZE of volatile disks
*/

View File

@ -640,7 +640,6 @@ void VirtualMachineDeploy::request_execute(xmlrpc_c::paramList const& paramList,
int id = xmlrpc_c::value_int(paramList.getInt(1));
int hid = xmlrpc_c::value_int(paramList.getInt(2));
bool enforce = false;
bool imported= false;
int ds_id = -1;
if ( paramList.size() > 3 )
@ -689,10 +688,6 @@ void VirtualMachineDeploy::request_execute(xmlrpc_c::paramList const& paramList,
{
ds_id = vm->get_ds_id();
}
else if (!vm->get_deploy_id().empty()) //deploy_id && not a Stopped VM
{
imported = true;
}
vm->unlock();
@ -800,13 +795,13 @@ void VirtualMachineDeploy::request_execute(xmlrpc_c::paramList const& paramList,
return;
}
if (!imported)
if (vm->isImported())
{
dm->deploy(vm);
dm->import(vm);
}
else
{
dm->import(vm);
dm->deploy(vm);
}
vm->unlock();

View File

@ -2230,6 +2230,18 @@ bool VirtualMachine::isVolatile(const Template * tmpl)
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
bool VirtualMachine::isImported() const
{
bool is_imported = false;
get_template_attribute("IMPORTED", is_imported);
return is_imported;
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
long long VirtualMachine::get_volatile_disk_size(Template * tmpl)
{
long long size = 0;