1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-22 13:33:52 +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:
Ruben S. Montero 2024-02-12 22:48:27 +01:00
parent 50efc64d3b
commit 97cfa76290
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87

View File

@ -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);