1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-28 14:50:08 +03:00

development: add error message on wrong TM_MAD mode

This commit is contained in:
Ruben S. Montero 2018-11-10 18:59:07 +01:00
parent 9432226f97
commit a27e525c4e
5 changed files with 12 additions and 16 deletions

View File

@ -1646,7 +1646,7 @@ public:
* clone_target and ln_target
* @param tm_mad is the tm_mad for system datastore chosen
*/
int check_tm_mad_disks(const string& tm_mad);
int check_tm_mad_disks(const string& tm_mad, string& error);
private:

View File

@ -357,12 +357,6 @@ public:
*/
void to_xml_short(std::ostringstream& oss) const;
/**
* Check if a tm_mad is valid and set clone_target and ln_target
* @param tm_mad is the tm_mad for system datastore chosen
*/
int check_tm_mad(const string& tm_mad);
private:
Snapshots * snapshots;
@ -793,7 +787,7 @@ public:
* clone_target and ln_target
* @param tm_mad is the tm_mad for system datastore chosen
*/
int check_tm_mad(const string& tm_mad);
int check_tm_mad(const string& tm_mad, string& error);
protected:

View File

@ -975,18 +975,16 @@ void VirtualMachineDeploy::request_execute(xmlrpc_c::paramList const& paramList,
return;
}
if ( check_nic_auto && vm->get_auto_network_leases(&tmpl, error_str) != 0 )
if ( check_nic_auto && vm->get_auto_network_leases(&tmpl, att.resp_msg) != 0 )
{
att.resp_msg = error_str;
failure_response(ACTION, att);
vm->unlock();
return;
}
if ( vm->check_tm_mad_disks(tm_mad) != 0)
if ( vm->check_tm_mad_disks(tm_mad, att.resp_msg) != 0)
{
att.resp_msg = error_str;
failure_response(ACTION, att);
vm->unlock();

View File

@ -3471,7 +3471,7 @@ int VirtualMachine::parse_sched_action(string& error_str)
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
int VirtualMachine::check_tm_mad_disks(const string& tm_mad)
int VirtualMachine::check_tm_mad_disks(const string& tm_mad, string& error)
{
string tm_mad_sys;
@ -3481,7 +3481,7 @@ int VirtualMachine::check_tm_mad_disks(const string& tm_mad)
{
return 0;
}
if ( disks.check_tm_mad(tm_mad) != 0 )
if ( disks.check_tm_mad(tm_mad, error) != 0 )
{
return -1;
}

View File

@ -1617,7 +1617,7 @@ std::string& VirtualMachineDisks::to_xml_short(std::string& xml)
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
int VirtualMachineDisks::check_tm_mad(const string& tm_mad)
int VirtualMachineDisks::check_tm_mad(const string& tm_mad, string& error)
{
DatastorePool * dspool = Nebula::instance().get_dspool();
@ -1648,11 +1648,14 @@ int VirtualMachineDisks::check_tm_mad(const string& tm_mad)
if ( ds_img == 0 )
{
error = "Datastore does not exist";
return -1;
}
if ( ds_img->get_tm_mad_targets(tm_mad, ln_target, clone_target, disk_type) != 0 )
if ( ds_img->get_tm_mad_targets(tm_mad, ln_target, clone_target,
disk_type) != 0 )
{
error = "Image Datastore does not support transfer mode: " + tm_mad;
return -1;
}
@ -1663,6 +1666,7 @@ int VirtualMachineDisks::check_tm_mad(const string& tm_mad)
}
else
{
error = "Image datastore not defined for VM DISK";
return -1;
}