mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-11 05:17:41 +03:00
F #6400: Error message when changing from FULL to INCREMENTAL backup
This commits returns an error message when trying to change a VM to incremental mode if not supported by the VM configuration. Previously, the change was silently ignored by OpenNebula.
This commit is contained in:
parent
50efc64d3b
commit
97cfa76290
@ -3205,11 +3205,35 @@ int VirtualMachine::updateconf(VirtualMachineTemplate* tmpl, string &err,
|
|||||||
// Parse backup configuration (if not doing a backup). Uses current value of
|
// Parse backup configuration (if not doing a backup). Uses current value of
|
||||||
// BACKUP_VOLATILE attribute.
|
// BACKUP_VOLATILE attribute.
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
if ( lcm_state != BACKUP && lcm_state != BACKUP_POWEROFF)
|
VectorAttribute * backup_conf = tmpl->get("BACKUP_CONFIG");
|
||||||
|
|
||||||
|
if ( backup_conf != nullptr && lcm_state != BACKUP && lcm_state != BACKUP_POWEROFF)
|
||||||
{
|
{
|
||||||
bool increment = disks.backup_increment(_backups.do_volatile()) &&
|
bool increment = disks.backup_increment(_backups.do_volatile()) &&
|
||||||
!has_snapshots();
|
!has_snapshots();
|
||||||
|
|
||||||
|
string smode = backup_conf->vector_value("MODE");
|
||||||
|
Backups::Mode bmode = Backups::str_to_mode(smode);
|
||||||
|
|
||||||
|
if (!smode.empty() && !increment && bmode == Backups::INCREMENT)
|
||||||
|
{
|
||||||
|
err = "VM cannot use backup increment mode";
|
||||||
|
|
||||||
|
if (has_snapshots())
|
||||||
|
{
|
||||||
|
err += ", it has snapshots.";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
err += ", it has disks snapshots or disks are not qcow2.";
|
||||||
|
}
|
||||||
|
|
||||||
|
NebulaLog::log("ONE", Log::ERROR, err);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
backup_conf = nullptr;
|
||||||
|
|
||||||
if ( _backups.parse(tmpl, increment, append, err) != 0 )
|
if ( _backups.parse(tmpl, increment, append, err) != 0 )
|
||||||
{
|
{
|
||||||
NebulaLog::log("ONE",Log::ERROR, err);
|
NebulaLog::log("ONE",Log::ERROR, err);
|
||||||
|
Loading…
Reference in New Issue
Block a user