#include "memory.h"
#include "uuid.h"
#include "domain_conf.h"
+#include "domain_audit.h"
#include "datatypes.h"
#include "logging.h"
#include "domain_nwfilter.h"
virDomainObjLock(vm);
if (vm->autostart &&
!virDomainObjIsActive(vm)) {
+ int ret;
virResetLastError();
- if (umlStartVMDaemon(data->conn, data->driver, vm) < 0) {
+ ret = umlStartVMDaemon(data->conn, data->driver, vm);
+ virDomainAuditStart(vm, "booted", ret >= 0);
+ if (ret < 0) {
virErrorPtr err = virGetLastError();
VIR_ERROR(_("Failed to autostart VM '%s': %s"),
vm->def->name, err ? err->message : _("unknown error"));
}
umlShutdownVMDaemon(NULL, driver, dom, VIR_DOMAIN_SHUTOFF_SHUTDOWN);
+ virDomainAuditStop(dom, "shutdown");
} else if (e->mask & (IN_CREATE | IN_MODIFY)) {
VIR_DEBUG("Got inotify domain startup '%s'", name);
if (virDomainObjIsActive(dom)) {
VIR_WARN("Could not open monitor for new domain");
umlShutdownVMDaemon(NULL, driver, dom,
VIR_DOMAIN_SHUTOFF_FAILED);
+ virDomainAuditStop(dom, "failed");
} else if (umlIdentifyChrPTY(driver, dom) < 0) {
VIR_WARN("Could not identify charater devices for new domain");
umlShutdownVMDaemon(NULL, driver, dom,
VIR_DOMAIN_SHUTOFF_FAILED);
+ virDomainAuditStop(dom, "failed");
}
}
virDomainObjUnlock(dom);
struct uml_driver *driver = opaque;
virDomainObjLock(dom);
- if (virDomainObjIsActive(dom))
+ if (virDomainObjIsActive(dom)) {
umlShutdownVMDaemon(NULL, driver, dom, VIR_DOMAIN_SHUTOFF_SHUTDOWN);
+ virDomainAuditStop(dom, "shutdown");
+ }
virDomainObjUnlock(dom);
}
def = NULL;
if (umlStartVMDaemon(conn, driver, vm) < 0) {
+ virDomainAuditStart(vm, "booted", false);
virDomainRemoveInactive(&driver->domains,
vm);
vm = NULL;
goto cleanup;
}
+ virDomainAuditStart(vm, "booted", true);
dom = virGetDomain(conn, vm->def->name, vm->def->uuid);
if (dom) dom->id = vm->def->id;
}
umlShutdownVMDaemon(dom->conn, driver, vm, VIR_DOMAIN_SHUTOFF_DESTROYED);
+ virDomainAuditStop(vm, "destroyed");
if (!vm->persistent) {
virDomainRemoveInactive(&driver->domains,
vm);
}
ret = umlStartVMDaemon(dom->conn, driver, vm);
+ virDomainAuditStart(vm, "booted", ret >= 0);
cleanup:
if (vm)