On Thu, May 24, 2018 at 01:13:28PM +0200, Michal Privoznik wrote:
When detaching a device it can be uniquely identified by its alias. Instead of misusing virDomainDetachDeviceFlags which has the same signature introduce new function.
s/new/a new/
Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- include/libvirt/libvirt-domain.h | 3 +++ src/driver-hypervisor.h | 6 +++++ src/libvirt-domain.c | 53 ++++++++++++++++++++++++++++++++++++++++ src/libvirt_public.syms | 5 ++++ 4 files changed, 67 insertions(+) diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 2d86e48979..e536781e38 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -8349,6 +8349,59 @@ virDomainUpdateDeviceFlags(virDomainPtr domain, } +/** + * virDomainDetachDeviceAlias: + * @domain: pointer to domain object
s/domain/a domain/ or even d/pointer to /
+ * @alias: device alias + * @flags: bitwise-OR of virDomainDeviceModifyFlags + * + * Detach a virtual device from a domain, using the alias to + * specify device. The value of @flags should be either
s/device/the device/
+ * VIR_DOMAIN_AFFECT_CURRENT, or a bitwise-or of values from + * VIR_DOMAIN_AFFECT_LIVE and VIR_DOMAIN_AFFECT_CURRENT, although + * hypervisors vary in which flags are supported. + * + * In contrast to virDomainDetachDeviceFlags() this API only send + * request to the hypervisor and returns immediately.
this API is asynchronous - it returns immediately after sending the detach request to the hypervisor.
It's + * caller's responsibility to wait for
s/caller/the caller/
+ * VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED event to signal actual + * device removal. + * + * Returns 0 in case of success, -1 in case of failure. + */ +int +virDomainDetachDeviceAlias(virDomainPtr domain, + const char *alias, + unsigned int flags)
Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx> Jano
Attachment:
signature.asc
Description: Digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list