Skip to content

Commit

Permalink
F #6400: Error message when changing from FULL to INCREMENTAL backup
Browse files Browse the repository at this point in the history
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.

(cherry picked from commit 97cfa76)
  • Loading branch information
rsmontero committed Feb 12, 2024
1 parent 82bb12a commit 4294fff
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/vm/VirtualMachine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3205,11 +3205,35 @@ int VirtualMachine::updateconf(VirtualMachineTemplate* tmpl, string &err,
// Parse backup configuration (if not doing a backup). Uses current value of
// 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()) &&
!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 )
{
NebulaLog::log("ONE",Log::ERROR, err);
Expand Down

0 comments on commit 4294fff

Please sign in to comment.