mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-08 16:54:49 +00:00
qemu: process: Wire up firing of the VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD event
Bind it to qemu's BLOCK_WRITE_THRESHOLD event. Look up the disk by nodename and construct the string to return.
This commit is contained in:
parent
4e1618ce72
commit
e96130dcc8
@ -1440,6 +1440,46 @@ qemuProcessHandleAcpiOstInfo(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
qemuProcessHandleBlockThreshold(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
||||||
|
virDomainObjPtr vm,
|
||||||
|
const char *nodename,
|
||||||
|
unsigned long long threshold,
|
||||||
|
unsigned long long excess,
|
||||||
|
void *opaque)
|
||||||
|
{
|
||||||
|
virQEMUDriverPtr driver = opaque;
|
||||||
|
virObjectEventPtr event = NULL;
|
||||||
|
virDomainDiskDefPtr disk;
|
||||||
|
virStorageSourcePtr src;
|
||||||
|
unsigned int idx;
|
||||||
|
char *dev = NULL;
|
||||||
|
const char *path = NULL;
|
||||||
|
|
||||||
|
virObjectLock(vm);
|
||||||
|
|
||||||
|
VIR_DEBUG("BLOCK_WRITE_THRESHOLD event for block node '%s' in domain %p %s:"
|
||||||
|
"threshold '%llu' exceeded by '%llu'",
|
||||||
|
nodename, vm, vm->def->name, threshold, excess);
|
||||||
|
|
||||||
|
if ((disk = qemuDomainDiskLookupByNodename(vm->def, nodename, &src, &idx))) {
|
||||||
|
if (virStorageSourceIsLocalStorage(src))
|
||||||
|
path = src->path;
|
||||||
|
|
||||||
|
if ((dev = qemuDomainDiskBackingStoreGetName(disk, src, idx))) {
|
||||||
|
event = virDomainEventBlockThresholdNewFromObj(vm, dev, path,
|
||||||
|
threshold, excess);
|
||||||
|
VIR_FREE(dev);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
virObjectUnlock(vm);
|
||||||
|
qemuDomainEventQueue(driver, event);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
qemuProcessHandleNicRxFilterChanged(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
qemuProcessHandleNicRxFilterChanged(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
||||||
virDomainObjPtr vm,
|
virDomainObjPtr vm,
|
||||||
@ -1636,6 +1676,7 @@ static qemuMonitorCallbacks monitorCallbacks = {
|
|||||||
.domainMigrationStatus = qemuProcessHandleMigrationStatus,
|
.domainMigrationStatus = qemuProcessHandleMigrationStatus,
|
||||||
.domainMigrationPass = qemuProcessHandleMigrationPass,
|
.domainMigrationPass = qemuProcessHandleMigrationPass,
|
||||||
.domainAcpiOstInfo = qemuProcessHandleAcpiOstInfo,
|
.domainAcpiOstInfo = qemuProcessHandleAcpiOstInfo,
|
||||||
|
.domainBlockThreshold = qemuProcessHandleBlockThreshold,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user