mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
qemu: Introduce functions for input device cgroup manipulation
Export qemuSetupInputCgroup and introduce qemuTeardownInputCgroup for hotunplug.
This commit is contained in:
parent
d8116b5a0a
commit
f29612fd35
@ -246,7 +246,7 @@ qemuSetupTPMCgroup(virDomainObjPtr vm)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
int
|
||||
qemuSetupInputCgroup(virDomainObjPtr vm,
|
||||
virDomainInputDefPtr dev)
|
||||
{
|
||||
@ -269,6 +269,29 @@ qemuSetupInputCgroup(virDomainObjPtr vm,
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuTeardownInputCgroup(virDomainObjPtr vm,
|
||||
virDomainInputDefPtr dev)
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
int ret = 0;
|
||||
|
||||
if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_DEVICES))
|
||||
return 0;
|
||||
|
||||
switch (dev->type) {
|
||||
case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH:
|
||||
VIR_DEBUG("Process path '%s' for input device", dev->source.evdev);
|
||||
ret = virCgroupDenyDevicePath(priv->cgroup, dev->source.evdev,
|
||||
VIR_CGROUP_DEVICE_RWM, false);
|
||||
virDomainAuditCgroupPath(vm, priv->cgroup, "deny", dev->source.evdev, "rwm", ret == 0);
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuSetupHostdevCgroup(virDomainObjPtr vm,
|
||||
virDomainHostdevDefPtr dev)
|
||||
|
@ -37,6 +37,10 @@ int qemuSetupDiskCgroup(virDomainObjPtr vm,
|
||||
virDomainDiskDefPtr disk);
|
||||
int qemuTeardownDiskCgroup(virDomainObjPtr vm,
|
||||
virDomainDiskDefPtr disk);
|
||||
int qemuSetupInputCgroup(virDomainObjPtr vm,
|
||||
virDomainInputDefPtr dev);
|
||||
int qemuTeardownInputCgroup(virDomainObjPtr vm,
|
||||
virDomainInputDefPtr dev);
|
||||
int qemuSetupHostdevCgroup(virDomainObjPtr vm,
|
||||
virDomainHostdevDefPtr dev)
|
||||
ATTRIBUTE_RETURN_CHECK;
|
||||
|
Loading…
x
Reference in New Issue
Block a user