mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +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
|
||||
qemuProcessHandleNicRxFilterChanged(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
||||
virDomainObjPtr vm,
|
||||
@ -1636,6 +1676,7 @@ static qemuMonitorCallbacks monitorCallbacks = {
|
||||
.domainMigrationStatus = qemuProcessHandleMigrationStatus,
|
||||
.domainMigrationPass = qemuProcessHandleMigrationPass,
|
||||
.domainAcpiOstInfo = qemuProcessHandleAcpiOstInfo,
|
||||
.domainBlockThreshold = qemuProcessHandleBlockThreshold,
|
||||
};
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user