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

F #6063: Remove args from BJ Scheduled Action (#2681)

* Make VM scheduled backup backward compatible

Signed-off-by: Pavel Czerny <pczerny@opennebula.io>
This commit is contained in:
Pavel Czerný 2023-07-26 16:41:17 +02:00 committed by GitHub
parent e18d1b6d4f
commit 71bb9e3263
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 4 deletions

View File

@ -328,7 +328,7 @@ Request::ErrorCode VirtualMachineAllocate::pool_allocate(
}
/* ---------------------------------------------------------------------- */
/* Create ScheduleAction and associate to the BackupJob */
/* Create ScheduleAction and associate to the VM */
/* ---------------------------------------------------------------------- */
for (const auto& sa : sas)
{
@ -354,7 +354,7 @@ Request::ErrorCode VirtualMachineAllocate::pool_allocate(
}
/* ---------------------------------------------------------------------- */
/* Associate SCHED_ACTIONS to the BackupJob */
/* Associate SCHED_ACTIONS to the VM */
/* ---------------------------------------------------------------------- */
if ( auto vm = vmpool->get(id) )
{
@ -1493,8 +1493,10 @@ Request::ErrorCode BackupJobAllocate::pool_allocate(
bool sa_error = false;
for (const auto& sa : sas)
for (auto& sa : sas)
{
sa->remove("ARGS"); // ARGS not used for Backup Job Scheduled Action
int sa_id = sapool->allocate(PoolObjectSQL::BACKUPJOB, id, 0, sa.get(),
att.resp_msg);

View File

@ -226,7 +226,7 @@ void BackupJobSchedAdd::request_execute(xmlrpc_c::paramList const& _paramList,
return;
}
const VectorAttribute * va = tmpl->get("SCHED_ACTION");
VectorAttribute * va = tmpl->get("SCHED_ACTION");
if ( va == nullptr )
{
@ -236,6 +236,8 @@ void BackupJobSchedAdd::request_execute(xmlrpc_c::paramList const& _paramList,
return;
}
va->remove("ARGS"); // ARGS not used for Backup Job Scheduled Action
auto sa_id = sapool->allocate(PoolObjectSQL::BACKUPJOB, bj_id, time(0), va, att.resp_msg);
if ( sa_id < 0 )

View File

@ -647,6 +647,11 @@ int ScheduledActionManager::vm_action_call(int vmid, int sa_id, string& error)
int dsid = -1;
bool reset = false;
if (args.size() == 1)
{
args.push("0"); // For backward compatibility set reset = false
}
if (!parse_args(args, dsid, reset))
{
error = "Missing or malformed ARGS for: backup."