[PATCH] qemu: Add audit entries for suspend and resume

Jim Fehlig via Devel posted 1 patch 4 days, 15 hours ago
src/qemu/qemu_driver.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH] qemu: Add audit entries for suspend and resume
Posted by Jim Fehlig via Devel 4 days, 15 hours ago
We recently received a request from certification auditors to provide
audit entries for suspend and resume. This small patch uses the existing
virtDomainAudit{Start,Stop} functions with new reasons "suspended" and
"resumed".

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
---

For suspend, I initially wrote the following

  virDomainAuditStart(vm, virDomainPausedReasonTypeToString(reason), true);

but I'm not sure it makes sense in resume, where we have reasons such as
VIR_DOMAIN_CRASHED_PANICKED. For symmetry, it seemed best to go with
"suspended" and "resumed".

 src/qemu/qemu_driver.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f1a633fdd3..c670bb681e 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1682,6 +1682,7 @@ static int qemuDomainSuspend(virDomainPtr dom)
             goto endjob;
     }
     qemuDomainSaveStatus(vm);
+    virDomainAuditStart(vm, "suspended", true);
     ret = 0;
 
  endjob:
@@ -1738,6 +1739,7 @@ static int qemuDomainResume(virDomainPtr dom)
         }
     }
     qemuDomainSaveStatus(vm);
+    virDomainAuditStop(vm, "resumed");
     ret = 0;
 
  endjob:
-- 
2.43.0