[PATCH v2 05/13] qemu: remove writing to QEMU log file for rename operation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The rename operation only works on inactive virtual machines,
but it none the less writes to the log file used by the QEMU
processes. This log file is not intended to provide a general
purpose audit trail of operations performed on VMs. The audit
subsystem has recording of important operations. If we want
to extend that to cover all significant public APIs that is
a valid thing to consider, but we shouldn't arbitrarily log
specific APIs into the QEMU log file in the meantime.

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c | 28 ----------------------------
 1 file changed, 28 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 92a9961..d537523 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -19909,10 +19909,6 @@ static int qemuDomainRename(virDomainPtr dom,
     virObjectEventPtr event_new = NULL;
     virObjectEventPtr event_old = NULL;
     int ret = -1;
-    int logfile = -1;
-    char ebuf[1024];
-    char *timestamp;
-    char *rename_log_msg = NULL;
     char *new_dom_name = NULL;
     char *old_dom_name = NULL;
     char *old_dom_cfg_file = NULL;
@@ -19978,11 +19974,6 @@ static int qemuDomainRename(virDomainPtr dom,
     if (VIR_STRDUP(new_dom_name, new_name) < 0)
         goto endjob;
 
-    if (virAsprintf(&rename_log_msg, ": domain %s has been renamed to %s\n",
-                    vm->def->name, new_name) < 0) {
-        goto endjob;
-    }
-
     if (!(old_dom_cfg_file = virDomainConfigFile(cfg->configDir,
                                                  vm->def->name))) {
         goto endjob;
@@ -19991,9 +19982,6 @@ static int qemuDomainRename(virDomainPtr dom,
     if (virDomainObjListRenameAddNew(driver->domains, vm, new_name) < 0)
         goto endjob;
 
-    if ((logfile = qemuDomainCreateLog(driver, vm, true)) < 0)
-        goto rollback;
-
     event_old = virDomainEventLifecycleNewFromObj(vm,
                                             VIR_DOMAIN_EVENT_UNDEFINED,
                                             VIR_DOMAIN_EVENT_UNDEFINED_RENAMED);
@@ -20021,17 +20009,6 @@ static int qemuDomainRename(virDomainPtr dom,
                                               VIR_DOMAIN_EVENT_DEFINED,
                                               VIR_DOMAIN_EVENT_DEFINED_RENAMED);
 
-    /* Write message to the log. */
-    if ((timestamp = virTimeStringNow()) != NULL) {
-        if (safewrite(logfile, timestamp, strlen(timestamp)) < 0 ||
-            safewrite(logfile, rename_log_msg,
-                      strlen(rename_log_msg)) < 0) {
-            VIR_WARN("Unable to write timestamp to logfile: %s",
-                     virStrerror(errno, ebuf, sizeof(ebuf)));
-        }
-        VIR_FREE(timestamp);
-    }
-
     /* Success, domain has been renamed. */
     ret = 0;
 
@@ -20039,15 +20016,10 @@ static int qemuDomainRename(virDomainPtr dom,
     qemuDomainObjEndJob(driver, vm);
 
  cleanup:
-    if (VIR_CLOSE(logfile) < 0) {
-        VIR_WARN("Unable to close logfile: %s",
-                 virStrerror(errno, ebuf, sizeof(ebuf)));
-    }
     virDomainObjEndAPI(&vm);
     VIR_FREE(old_dom_cfg_file);
     VIR_FREE(old_dom_name);
     VIR_FREE(new_dom_name);
-    VIR_FREE(rename_log_msg);
     qemuDomainEventQueue(driver, event_old);
     qemuDomainEventQueue(driver, event_new);
     virObjectUnref(cfg);
-- 
2.5.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]