mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 01:34:11 +03:00
audit: rename remaining qemu audit functions
Also add ATTRIBUTE_NONNULL markers. * src/qemu/qemu_audit.h: The pattern qemuDomainXXXAudit is inconsistent; prefer qemuAuditXXX instead. * src/qemu/qemu_audit.c: Reflect the renames. * src/qemu/qemu_driver.c: Likewise. * src/qemu/qemu_hotplug.c: Likewise. * src/qemu/qemu_migration.c: Likewise. * src/qemu/qemu_process.c: Likewise.
This commit is contained in:
parent
f2512684ad
commit
48096a0064
@ -57,11 +57,10 @@ qemuAuditGetRdev(const char *path ATTRIBUTE_UNUSED)
|
||||
}
|
||||
#endif
|
||||
|
||||
void qemuDomainDiskAudit(virDomainObjPtr vm,
|
||||
virDomainDiskDefPtr oldDef,
|
||||
virDomainDiskDefPtr newDef,
|
||||
const char *reason,
|
||||
bool success)
|
||||
void
|
||||
qemuAuditDisk(virDomainObjPtr vm,
|
||||
virDomainDiskDefPtr oldDef, virDomainDiskDefPtr newDef,
|
||||
const char *reason, bool success)
|
||||
{
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
char *vmname;
|
||||
@ -99,11 +98,10 @@ cleanup:
|
||||
}
|
||||
|
||||
|
||||
void qemuDomainNetAudit(virDomainObjPtr vm,
|
||||
virDomainNetDefPtr oldDef,
|
||||
virDomainNetDefPtr newDef,
|
||||
const char *reason,
|
||||
bool success)
|
||||
void
|
||||
qemuAuditNet(virDomainObjPtr vm,
|
||||
virDomainNetDefPtr oldDef, virDomainNetDefPtr newDef,
|
||||
const char *reason, bool success)
|
||||
{
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
char newMacstr[VIR_MAC_STRING_BUFLEN];
|
||||
@ -131,7 +129,7 @@ void qemuDomainNetAudit(virDomainObjPtr vm,
|
||||
|
||||
|
||||
/**
|
||||
* qemuDomainHostdevAudit:
|
||||
* qemuAuditHostdev:
|
||||
* @vm: domain making a change in pass-through host device
|
||||
* @hostdev: device being attached or removed
|
||||
* @reason: one of "start", "attach", or "detach"
|
||||
@ -140,10 +138,8 @@ void qemuDomainNetAudit(virDomainObjPtr vm,
|
||||
* Log an audit message about an attempted device passthrough change.
|
||||
*/
|
||||
void
|
||||
qemuDomainHostdevAudit(virDomainObjPtr vm,
|
||||
virDomainHostdevDefPtr hostdev,
|
||||
const char *reason,
|
||||
bool success)
|
||||
qemuAuditHostdev(virDomainObjPtr vm, virDomainHostdevDefPtr hostdev,
|
||||
const char *reason, bool success)
|
||||
{
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
char *vmname;
|
||||
@ -310,7 +306,7 @@ cleanup:
|
||||
}
|
||||
|
||||
/**
|
||||
* qemuDomainResourceAudit:
|
||||
* qemuAuditResource:
|
||||
* @vm: domain making an integer resource change
|
||||
* @resource: name of the resource: "mem" or "vcpu"
|
||||
* @oldval: the old value of the resource
|
||||
@ -321,12 +317,9 @@ cleanup:
|
||||
* Log an audit message about an attempted resource change.
|
||||
*/
|
||||
static void
|
||||
qemuDomainResourceAudit(virDomainObjPtr vm,
|
||||
const char *resource,
|
||||
unsigned long long oldval,
|
||||
unsigned long long newval,
|
||||
const char *reason,
|
||||
bool success)
|
||||
qemuAuditResource(virDomainObjPtr vm, const char *resource,
|
||||
unsigned long long oldval, unsigned long long newval,
|
||||
const char *reason, bool success)
|
||||
{
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
char *vmname;
|
||||
@ -346,26 +339,24 @@ qemuDomainResourceAudit(virDomainObjPtr vm,
|
||||
}
|
||||
|
||||
void
|
||||
qemuDomainMemoryAudit(virDomainObjPtr vm,
|
||||
unsigned long long oldmem, unsigned long long newmem,
|
||||
const char *reason, bool success)
|
||||
qemuAuditMemory(virDomainObjPtr vm,
|
||||
unsigned long long oldmem, unsigned long long newmem,
|
||||
const char *reason, bool success)
|
||||
{
|
||||
return qemuDomainResourceAudit(vm, "mem", oldmem, newmem, reason, success);
|
||||
return qemuAuditResource(vm, "mem", oldmem, newmem, reason, success);
|
||||
}
|
||||
|
||||
void
|
||||
qemuDomainVcpuAudit(virDomainObjPtr vm,
|
||||
unsigned int oldvcpu, unsigned int newvcpu,
|
||||
const char *reason, bool success)
|
||||
qemuAuditVcpu(virDomainObjPtr vm,
|
||||
unsigned int oldvcpu, unsigned int newvcpu,
|
||||
const char *reason, bool success)
|
||||
{
|
||||
return qemuDomainResourceAudit(vm, "vcpu", oldvcpu, newvcpu, reason,
|
||||
success);
|
||||
return qemuAuditResource(vm, "vcpu", oldvcpu, newvcpu, reason, success);
|
||||
}
|
||||
|
||||
static void qemuDomainLifecycleAudit(virDomainObjPtr vm,
|
||||
const char *op,
|
||||
const char *reason,
|
||||
bool success)
|
||||
static void
|
||||
qemuAuditLifecycle(virDomainObjPtr vm, const char *op,
|
||||
const char *reason, bool success)
|
||||
{
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
char *vmname;
|
||||
@ -384,39 +375,42 @@ static void qemuDomainLifecycleAudit(virDomainObjPtr vm,
|
||||
}
|
||||
|
||||
|
||||
void qemuDomainStartAudit(virDomainObjPtr vm, const char *reason, bool success)
|
||||
void
|
||||
qemuAuditDomainStart(virDomainObjPtr vm, const char *reason, bool success)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0 ; i < vm->def->ndisks ; i++) {
|
||||
virDomainDiskDefPtr disk = vm->def->disks[i];
|
||||
if (disk->src) /* Skips CDROM without media initially inserted */
|
||||
qemuDomainDiskAudit(vm, NULL, disk, "start", true);
|
||||
qemuAuditDisk(vm, NULL, disk, "start", true);
|
||||
}
|
||||
|
||||
for (i = 0 ; i < vm->def->nnets ; i++) {
|
||||
virDomainNetDefPtr net = vm->def->nets[i];
|
||||
qemuDomainNetAudit(vm, NULL, net, "start", true);
|
||||
qemuAuditNet(vm, NULL, net, "start", true);
|
||||
}
|
||||
|
||||
for (i = 0 ; i < vm->def->nhostdevs ; i++) {
|
||||
virDomainHostdevDefPtr hostdev = vm->def->hostdevs[i];
|
||||
qemuDomainHostdevAudit(vm, hostdev, "start", true);
|
||||
qemuAuditHostdev(vm, hostdev, "start", true);
|
||||
}
|
||||
|
||||
qemuDomainMemoryAudit(vm, 0, vm->def->mem.cur_balloon, "start", true);
|
||||
qemuDomainVcpuAudit(vm, 0, vm->def->vcpus, "start", true);
|
||||
qemuAuditMemory(vm, 0, vm->def->mem.cur_balloon, "start", true);
|
||||
qemuAuditVcpu(vm, 0, vm->def->vcpus, "start", true);
|
||||
|
||||
qemuDomainLifecycleAudit(vm, "start", reason, success);
|
||||
qemuAuditLifecycle(vm, "start", reason, success);
|
||||
}
|
||||
|
||||
|
||||
void qemuDomainStopAudit(virDomainObjPtr vm, const char *reason)
|
||||
void
|
||||
qemuAuditDomainStop(virDomainObjPtr vm, const char *reason)
|
||||
{
|
||||
qemuDomainLifecycleAudit(vm, "stop", reason, true);
|
||||
qemuAuditLifecycle(vm, "stop", reason, true);
|
||||
}
|
||||
|
||||
void qemuDomainSecurityLabelAudit(virDomainObjPtr vm, bool success)
|
||||
void
|
||||
qemuAuditSecurityLabel(virDomainObjPtr vm, bool success)
|
||||
{
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
char *vmname;
|
||||
|
@ -27,48 +27,66 @@
|
||||
# include "domain_conf.h"
|
||||
# include "cgroup.h"
|
||||
|
||||
void qemuDomainStartAudit(virDomainObjPtr vm, const char *reason, bool success);
|
||||
void qemuDomainStopAudit(virDomainObjPtr vm, const char *reason);
|
||||
void qemuDomainDiskAudit(virDomainObjPtr vm,
|
||||
virDomainDiskDefPtr oldDef,
|
||||
virDomainDiskDefPtr newDef,
|
||||
const char *reason,
|
||||
bool success);
|
||||
void qemuDomainNetAudit(virDomainObjPtr vm,
|
||||
virDomainNetDefPtr oldDef,
|
||||
virDomainNetDefPtr newDef,
|
||||
const char *reason,
|
||||
bool success);
|
||||
void qemuDomainHostdevAudit(virDomainObjPtr vm,
|
||||
virDomainHostdevDefPtr def,
|
||||
const char *reason,
|
||||
bool success);
|
||||
void qemuAuditDomainStart(virDomainObjPtr vm,
|
||||
const char *reason,
|
||||
bool success)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||
void qemuAuditDomainStop(virDomainObjPtr vm,
|
||||
const char *reason)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||
void qemuAuditDisk(virDomainObjPtr vm,
|
||||
virDomainDiskDefPtr oldDef,
|
||||
virDomainDiskDefPtr newDef,
|
||||
const char *reason,
|
||||
bool success)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
|
||||
void qemuAuditNet(virDomainObjPtr vm,
|
||||
virDomainNetDefPtr oldDef,
|
||||
virDomainNetDefPtr newDef,
|
||||
const char *reason,
|
||||
bool success)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
|
||||
void qemuAuditHostdev(virDomainObjPtr vm,
|
||||
virDomainHostdevDefPtr def,
|
||||
const char *reason,
|
||||
bool success)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
|
||||
void qemuAuditCgroup(virDomainObjPtr vm,
|
||||
virCgroupPtr group,
|
||||
const char *reason,
|
||||
const char *extra,
|
||||
bool success);
|
||||
bool success)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
|
||||
ATTRIBUTE_NONNULL(4);
|
||||
void qemuAuditCgroupMajor(virDomainObjPtr vm,
|
||||
virCgroupPtr group,
|
||||
const char *reason,
|
||||
int maj,
|
||||
const char *name,
|
||||
bool success);
|
||||
bool success)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
|
||||
ATTRIBUTE_NONNULL(5);
|
||||
void qemuAuditCgroupPath(virDomainObjPtr vm,
|
||||
virCgroupPtr group,
|
||||
const char *reason,
|
||||
const char *path,
|
||||
int rc);
|
||||
void qemuDomainMemoryAudit(virDomainObjPtr vm,
|
||||
unsigned long long oldmem,
|
||||
unsigned long long newmem,
|
||||
const char *reason,
|
||||
bool success);
|
||||
void qemuDomainVcpuAudit(virDomainObjPtr vm,
|
||||
unsigned int oldvcpu,
|
||||
unsigned int newvcpu,
|
||||
const char *reason,
|
||||
bool success);
|
||||
void qemuDomainSecurityLabelAudit(virDomainObjPtr vm, bool success);
|
||||
int rc)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
|
||||
ATTRIBUTE_NONNULL(4);
|
||||
void qemuAuditMemory(virDomainObjPtr vm,
|
||||
unsigned long long oldmem,
|
||||
unsigned long long newmem,
|
||||
const char *reason,
|
||||
bool success)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
|
||||
void qemuAuditVcpu(virDomainObjPtr vm,
|
||||
unsigned int oldvcpu,
|
||||
unsigned int newvcpu,
|
||||
const char *reason,
|
||||
bool success)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
|
||||
void qemuAuditSecurityLabel(virDomainObjPtr vm,
|
||||
bool success)
|
||||
ATTRIBUTE_NONNULL(1);
|
||||
|
||||
#endif /* __QEMU_AUDIT_H__ */
|
||||
|
@ -1266,7 +1266,7 @@ static virDomainPtr qemudDomainCreate(virConnectPtr conn, const char *xml,
|
||||
if (qemuProcessStart(conn, driver, vm, NULL,
|
||||
(flags & VIR_DOMAIN_START_PAUSED) != 0,
|
||||
-1, NULL, VIR_VM_OP_CREATE) < 0) {
|
||||
qemuDomainStartAudit(vm, "booted", false);
|
||||
qemuAuditDomainStart(vm, "booted", false);
|
||||
if (qemuDomainObjEndJob(vm) > 0)
|
||||
virDomainRemoveInactive(&driver->domains,
|
||||
vm);
|
||||
@ -1277,7 +1277,7 @@ static virDomainPtr qemudDomainCreate(virConnectPtr conn, const char *xml,
|
||||
event = virDomainEventNewFromObj(vm,
|
||||
VIR_DOMAIN_EVENT_STARTED,
|
||||
VIR_DOMAIN_EVENT_STARTED_BOOTED);
|
||||
qemuDomainStartAudit(vm, "booted", true);
|
||||
qemuAuditDomainStart(vm, "booted", true);
|
||||
|
||||
dom = virGetDomain(conn, vm->def->name, vm->def->uuid);
|
||||
if (dom) dom->id = vm->def->id;
|
||||
@ -1492,7 +1492,7 @@ static int qemudDomainDestroy(virDomainPtr dom) {
|
||||
event = virDomainEventNewFromObj(vm,
|
||||
VIR_DOMAIN_EVENT_STOPPED,
|
||||
VIR_DOMAIN_EVENT_STOPPED_DESTROYED);
|
||||
qemuDomainStopAudit(vm, "destroyed");
|
||||
qemuAuditDomainStop(vm, "destroyed");
|
||||
|
||||
if (!vm->persistent) {
|
||||
if (qemuDomainObjEndJob(vm) > 0)
|
||||
@ -1604,8 +1604,7 @@ static int qemudDomainSetMemory(virDomainPtr dom, unsigned long newmem) {
|
||||
qemuDomainObjEnterMonitor(vm);
|
||||
r = qemuMonitorSetBalloon(priv->mon, newmem);
|
||||
qemuDomainObjExitMonitor(vm);
|
||||
qemuDomainMemoryAudit(vm, vm->def->mem.cur_balloon, newmem, "update",
|
||||
r == 1);
|
||||
qemuAuditMemory(vm, vm->def->mem.cur_balloon, newmem, "update", r == 1);
|
||||
if (r < 0)
|
||||
goto endjob;
|
||||
|
||||
@ -2024,7 +2023,7 @@ static int qemudDomainSaveFlag(struct qemud_driver *driver, virDomainPtr dom,
|
||||
|
||||
/* Shut it down */
|
||||
qemuProcessStop(driver, vm, 0);
|
||||
qemuDomainStopAudit(vm, "saved");
|
||||
qemuAuditDomainStop(vm, "saved");
|
||||
event = virDomainEventNewFromObj(vm,
|
||||
VIR_DOMAIN_EVENT_STOPPED,
|
||||
VIR_DOMAIN_EVENT_STOPPED_SAVED);
|
||||
@ -2420,7 +2419,7 @@ static int qemudDomainCoreDump(virDomainPtr dom,
|
||||
endjob:
|
||||
if ((ret == 0) && (flags & VIR_DUMP_CRASH)) {
|
||||
qemuProcessStop(driver, vm, 0);
|
||||
qemuDomainStopAudit(vm, "crashed");
|
||||
qemuAuditDomainStop(vm, "crashed");
|
||||
event = virDomainEventNewFromObj(vm,
|
||||
VIR_DOMAIN_EVENT_STOPPED,
|
||||
VIR_DOMAIN_EVENT_STOPPED_CRASHED);
|
||||
@ -2552,7 +2551,7 @@ static int qemudDomainHotplugVcpus(virDomainObjPtr vm, unsigned int nvcpus)
|
||||
|
||||
cleanup:
|
||||
qemuDomainObjExitMonitor(vm);
|
||||
qemuDomainVcpuAudit(vm, oldvcpus, nvcpus, "update", rc == 1);
|
||||
qemuAuditVcpu(vm, oldvcpus, nvcpus, "update", rc == 1);
|
||||
return ret;
|
||||
|
||||
unsupported:
|
||||
@ -3330,14 +3329,14 @@ qemudDomainSaveImageStartVM(virConnectPtr conn,
|
||||
*read_pid = -1;
|
||||
|
||||
if (ret < 0) {
|
||||
qemuDomainStartAudit(vm, "restored", false);
|
||||
qemuAuditDomainStart(vm, "restored", false);
|
||||
goto out;
|
||||
}
|
||||
|
||||
event = virDomainEventNewFromObj(vm,
|
||||
VIR_DOMAIN_EVENT_STARTED,
|
||||
VIR_DOMAIN_EVENT_STARTED_RESTORED);
|
||||
qemuDomainStartAudit(vm, "restored", true);
|
||||
qemuAuditDomainStart(vm, "restored", true);
|
||||
if (event)
|
||||
qemuDomainEventQueue(driver, event);
|
||||
|
||||
@ -3675,7 +3674,7 @@ static int qemudDomainObjStart(virConnectPtr conn,
|
||||
|
||||
ret = qemuProcessStart(conn, driver, vm, NULL, start_paused, -1, NULL,
|
||||
VIR_VM_OP_CREATE);
|
||||
qemuDomainStartAudit(vm, "booted", ret >= 0);
|
||||
qemuAuditDomainStart(vm, "booted", ret >= 0);
|
||||
if (ret >= 0) {
|
||||
virDomainEventPtr event =
|
||||
virDomainEventNewFromObj(vm,
|
||||
@ -6354,7 +6353,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
|
||||
|
||||
rc = qemuProcessStart(snapshot->domain->conn, driver, vm, NULL,
|
||||
false, -1, NULL, VIR_VM_OP_CREATE);
|
||||
qemuDomainStartAudit(vm, "from-snapshot", rc >= 0);
|
||||
qemuAuditDomainStart(vm, "from-snapshot", rc >= 0);
|
||||
if (qemuDomainSnapshotSetCurrentInactive(vm, driver->snapshotDir) < 0)
|
||||
goto endjob;
|
||||
if (rc < 0)
|
||||
@ -6387,7 +6386,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
|
||||
|
||||
if (virDomainObjIsActive(vm)) {
|
||||
qemuProcessStop(driver, vm, 0);
|
||||
qemuDomainStopAudit(vm, "from-snapshot");
|
||||
qemuAuditDomainStop(vm, "from-snapshot");
|
||||
event = virDomainEventNewFromObj(vm,
|
||||
VIR_DOMAIN_EVENT_STOPPED,
|
||||
VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT);
|
||||
|
@ -108,7 +108,7 @@ int qemuDomainChangeEjectableMedia(struct qemud_driver *driver,
|
||||
}
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
|
||||
qemuDomainDiskAudit(vm, origdisk, disk, "update", ret >= 0);
|
||||
qemuAuditDisk(vm, origdisk, disk, "update", ret >= 0);
|
||||
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
@ -203,7 +203,7 @@ int qemuDomainAttachPciDiskDevice(struct qemud_driver *driver,
|
||||
}
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
|
||||
qemuDomainDiskAudit(vm, NULL, disk, "attach", ret >= 0);
|
||||
qemuAuditDisk(vm, NULL, disk, "attach", ret >= 0);
|
||||
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
@ -435,7 +435,7 @@ int qemuDomainAttachSCSIDisk(struct qemud_driver *driver,
|
||||
}
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
|
||||
qemuDomainDiskAudit(vm, NULL, disk, "attach", ret >= 0);
|
||||
qemuAuditDisk(vm, NULL, disk, "attach", ret >= 0);
|
||||
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
@ -518,7 +518,7 @@ int qemuDomainAttachUsbMassstorageDevice(struct qemud_driver *driver,
|
||||
}
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
|
||||
qemuDomainDiskAudit(vm, NULL, disk, "attach", ret >= 0);
|
||||
qemuAuditDisk(vm, NULL, disk, "attach", ret >= 0);
|
||||
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
@ -653,13 +653,13 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
|
||||
qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuMonitorAddNetdev(priv->mon, netstr) < 0) {
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
qemuDomainNetAudit(vm, NULL, net, "attach", false);
|
||||
qemuAuditNet(vm, NULL, net, "attach", false);
|
||||
goto try_tapfd_close;
|
||||
}
|
||||
} else {
|
||||
if (qemuMonitorAddHostNetwork(priv->mon, netstr) < 0) {
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
qemuDomainNetAudit(vm, NULL, net, "attach", false);
|
||||
qemuAuditNet(vm, NULL, net, "attach", false);
|
||||
goto try_tapfd_close;
|
||||
}
|
||||
}
|
||||
@ -685,14 +685,14 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
|
||||
if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuMonitorAddDevice(priv->mon, nicstr) < 0) {
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
qemuDomainNetAudit(vm, NULL, net, "attach", false);
|
||||
qemuAuditNet(vm, NULL, net, "attach", false);
|
||||
goto try_remove;
|
||||
}
|
||||
} else {
|
||||
if (qemuMonitorAddPCINetwork(priv->mon, nicstr,
|
||||
&guestAddr) < 0) {
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
qemuDomainNetAudit(vm, NULL, net, "attach", false);
|
||||
qemuAuditNet(vm, NULL, net, "attach", false);
|
||||
goto try_remove;
|
||||
}
|
||||
net->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
|
||||
@ -700,7 +700,7 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
|
||||
}
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
|
||||
qemuDomainNetAudit(vm, NULL, net, "attach", true);
|
||||
qemuAuditNet(vm, NULL, net, "attach", true);
|
||||
|
||||
ret = 0;
|
||||
|
||||
@ -842,7 +842,7 @@ int qemuDomainAttachHostPciDevice(struct qemud_driver *driver,
|
||||
hostdev->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
|
||||
memcpy(&hostdev->info.addr.pci, &guestAddr, sizeof(guestAddr));
|
||||
}
|
||||
qemuDomainHostdevAudit(vm, hostdev, "attach", ret == 0);
|
||||
qemuAuditHostdev(vm, hostdev, "attach", ret == 0);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
|
||||
@ -919,7 +919,7 @@ int qemuDomainAttachHostUsbDevice(struct qemud_driver *driver,
|
||||
hostdev->source.subsys.u.usb.bus,
|
||||
hostdev->source.subsys.u.usb.device);
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
qemuDomainHostdevAudit(vm, hostdev, "attach", ret == 0);
|
||||
qemuAuditHostdev(vm, hostdev, "attach", ret == 0);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
|
||||
@ -1194,7 +1194,7 @@ int qemuDomainDetachPciDiskDevice(struct qemud_driver *driver,
|
||||
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
|
||||
qemuDomainDiskAudit(vm, detach, NULL, "detach", ret >= 0);
|
||||
qemuAuditDisk(vm, detach, NULL, "detach", ret >= 0);
|
||||
|
||||
if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE) &&
|
||||
qemuDomainPCIAddressReleaseAddr(priv->pciaddrs, &detach->info) < 0)
|
||||
@ -1277,7 +1277,7 @@ int qemuDomainDetachDiskDevice(struct qemud_driver *driver,
|
||||
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
|
||||
qemuDomainDiskAudit(vm, detach, NULL, "detach", ret >= 0);
|
||||
qemuAuditDisk(vm, detach, NULL, "detach", ret >= 0);
|
||||
|
||||
virDomainDiskRemove(vm->def, i);
|
||||
|
||||
@ -1486,14 +1486,14 @@ int qemuDomainDetachNetDevice(struct qemud_driver *driver,
|
||||
if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuMonitorDelDevice(priv->mon, detach->info.alias) < 0) {
|
||||
qemuDomainObjExitMonitor(vm);
|
||||
qemuDomainNetAudit(vm, detach, NULL, "detach", false);
|
||||
qemuAuditNet(vm, detach, NULL, "detach", false);
|
||||
goto cleanup;
|
||||
}
|
||||
} else {
|
||||
if (qemuMonitorRemovePCIDevice(priv->mon,
|
||||
&detach->info.addr.pci) < 0) {
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
qemuDomainNetAudit(vm, detach, NULL, "detach", false);
|
||||
qemuAuditNet(vm, detach, NULL, "detach", false);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
@ -1502,19 +1502,19 @@ int qemuDomainDetachNetDevice(struct qemud_driver *driver,
|
||||
qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuMonitorRemoveNetdev(priv->mon, hostnet_name) < 0) {
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
qemuDomainNetAudit(vm, detach, NULL, "detach", false);
|
||||
qemuAuditNet(vm, detach, NULL, "detach", false);
|
||||
goto cleanup;
|
||||
}
|
||||
} else {
|
||||
if (qemuMonitorRemoveHostNetwork(priv->mon, vlan, hostnet_name) < 0) {
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
qemuDomainNetAudit(vm, detach, NULL, "detach", false);
|
||||
qemuAuditNet(vm, detach, NULL, "detach", false);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
|
||||
qemuDomainNetAudit(vm, detach, NULL, "detach", true);
|
||||
qemuAuditNet(vm, detach, NULL, "detach", true);
|
||||
|
||||
if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE) &&
|
||||
qemuDomainPCIAddressReleaseAddr(priv->pciaddrs, &detach->info) < 0)
|
||||
@ -1615,7 +1615,7 @@ int qemuDomainDetachHostPciDevice(struct qemud_driver *driver,
|
||||
ret = qemuMonitorRemovePCIDevice(priv->mon, &detach->info.addr.pci);
|
||||
}
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
qemuDomainHostdevAudit(vm, detach, "detach", ret == 0);
|
||||
qemuAuditHostdev(vm, detach, "detach", ret == 0);
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
|
||||
@ -1714,7 +1714,7 @@ int qemuDomainDetachHostUsbDevice(struct qemud_driver *driver,
|
||||
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||
ret = qemuMonitorDelDevice(priv->mon, detach->info.alias);
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
qemuDomainHostdevAudit(vm, detach, "detach", ret == 0);
|
||||
qemuAuditHostdev(vm, detach, "detach", ret == 0);
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
|
||||
|
@ -324,7 +324,7 @@ qemuMigrationPrepareTunnel(struct qemud_driver *driver,
|
||||
-1, NULL, VIR_VM_OP_MIGRATE_IN_START);
|
||||
VIR_FREE(migrateFrom);
|
||||
if (internalret < 0) {
|
||||
qemuDomainStartAudit(vm, "migrated", false);
|
||||
qemuAuditDomainStart(vm, "migrated", false);
|
||||
/* Note that we don't set an error here because qemuProcessStart
|
||||
* should have already done that.
|
||||
*/
|
||||
@ -338,7 +338,7 @@ qemuMigrationPrepareTunnel(struct qemud_driver *driver,
|
||||
if (virFDStreamConnectUNIX(st,
|
||||
unixfile,
|
||||
false) < 0) {
|
||||
qemuDomainStartAudit(vm, "migrated", false);
|
||||
qemuAuditDomainStart(vm, "migrated", false);
|
||||
qemuProcessStop(driver, vm, 0);
|
||||
if (!vm->persistent) {
|
||||
if (qemuDomainObjEndJob(vm) > 0)
|
||||
@ -351,7 +351,7 @@ qemuMigrationPrepareTunnel(struct qemud_driver *driver,
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
qemuDomainStartAudit(vm, "migrated", true);
|
||||
qemuAuditDomainStart(vm, "migrated", true);
|
||||
|
||||
event = virDomainEventNewFromObj(vm,
|
||||
VIR_DOMAIN_EVENT_STARTED,
|
||||
@ -532,7 +532,7 @@ qemuMigrationPrepareDirect(struct qemud_driver *driver,
|
||||
snprintf (migrateFrom, sizeof (migrateFrom), "tcp:0.0.0.0:%d", this_port);
|
||||
if (qemuProcessStart(dconn, driver, vm, migrateFrom, true,
|
||||
-1, NULL, VIR_VM_OP_MIGRATE_IN_START) < 0) {
|
||||
qemuDomainStartAudit(vm, "migrated", false);
|
||||
qemuAuditDomainStart(vm, "migrated", false);
|
||||
/* Note that we don't set an error here because qemuProcessStart
|
||||
* should have already done that.
|
||||
*/
|
||||
@ -544,7 +544,7 @@ qemuMigrationPrepareDirect(struct qemud_driver *driver,
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
qemuDomainStartAudit(vm, "migrated", true);
|
||||
qemuAuditDomainStart(vm, "migrated", true);
|
||||
event = virDomainEventNewFromObj(vm,
|
||||
VIR_DOMAIN_EVENT_STARTED,
|
||||
VIR_DOMAIN_EVENT_STARTED_MIGRATED);
|
||||
@ -1089,7 +1089,7 @@ int qemuMigrationPerform(struct qemud_driver *driver,
|
||||
|
||||
/* Clean up the source domain. */
|
||||
qemuProcessStop(driver, vm, 1);
|
||||
qemuDomainStopAudit(vm, "migrated");
|
||||
qemuAuditDomainStop(vm, "migrated");
|
||||
resume = 0;
|
||||
|
||||
event = virDomainEventNewFromObj(vm,
|
||||
@ -1268,7 +1268,7 @@ qemuMigrationFinish(struct qemud_driver *driver,
|
||||
}
|
||||
} else {
|
||||
qemuProcessStop(driver, vm, 1);
|
||||
qemuDomainStopAudit(vm, "failed");
|
||||
qemuAuditDomainStop(vm, "failed");
|
||||
event = virDomainEventNewFromObj(vm,
|
||||
VIR_DOMAIN_EVENT_STOPPED,
|
||||
VIR_DOMAIN_EVENT_STOPPED_FAILED);
|
||||
|
@ -131,7 +131,7 @@ qemuProcessHandleMonitorEOF(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
||||
VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN);
|
||||
|
||||
qemuProcessStop(driver, vm, 0);
|
||||
qemuDomainStopAudit(vm, hasError ? "failed" : "shutdown");
|
||||
qemuAuditDomainStop(vm, hasError ? "failed" : "shutdown");
|
||||
|
||||
if (!vm->persistent)
|
||||
virDomainRemoveInactive(&driver->domains, vm);
|
||||
@ -1935,10 +1935,10 @@ int qemuProcessStart(virConnectPtr conn,
|
||||
then generate a security label for isolation */
|
||||
VIR_DEBUG0("Generating domain security label (if required)");
|
||||
if (virSecurityManagerGenLabel(driver->securityManager, vm) < 0) {
|
||||
qemuDomainSecurityLabelAudit(vm, false);
|
||||
qemuAuditSecurityLabel(vm, false);
|
||||
goto cleanup;
|
||||
}
|
||||
qemuDomainSecurityLabelAudit(vm, true);
|
||||
qemuAuditSecurityLabel(vm, true);
|
||||
|
||||
VIR_DEBUG0("Generating setting domain security labels (if required)");
|
||||
if (virSecurityManagerSetAllLabel(driver->securityManager,
|
||||
|
Loading…
Reference in New Issue
Block a user