This requires a custom function for remoteNodeDeviceReAttachFlags, because it is named *NodeDevice, but it goes through the hypervisor driver rather than nodedevice driver, and so it uses privateData instead of nodeDevicePrivateData. (It has to go through the hypervisor driver, because that is the driver that knows about the backend drivers that will perform the pci device assignment). --- src/remote/remote_driver.c | 29 +++++++++++++++++++++++++++++ src/remote/remote_protocol.x | 12 +++++++++++- src/remote_protocol-structs | 5 +++++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 87c61f4..2c006d9 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -3497,6 +3497,34 @@ done: } static int +remoteNodeDeviceReAttachFlags(virNodeDevicePtr dev, + unsigned int flags) +{ + int rv = -1; + remote_node_device_re_attach_flags_args args; + /* This method is unusual in that it uses the HV driver, not the + * devMon driver hence its use of privateData, instead of + * nodeDevicePrivateData */ + struct private_data *priv = dev->conn->privateData; + + remoteDriverLock(priv); + + args.name = dev->name; + args.flags = flags; + + if (call(dev->conn, priv, 0, REMOTE_PROC_NODE_DEVICE_RE_ATTACH_FLAGS, + (xdrproc_t) xdr_remote_node_device_re_attach_flags_args, + (char *) &args, (xdrproc_t) xdr_void, (char *) NULL) == -1) + goto done; + + rv = 0; + +done: + remoteDriverUnlock(priv); + return rv; +} + +static int remoteNodeDeviceReset(virNodeDevicePtr dev) { int rv = -1; @@ -6291,6 +6319,7 @@ static virDriver remote_driver = { .nodeDeviceDettach = remoteNodeDeviceDettach, /* 0.6.1 */ .nodeDeviceDetachFlags = remoteNodeDeviceDetachFlags, /* 1.0.5 */ .nodeDeviceReAttach = remoteNodeDeviceReAttach, /* 0.6.1 */ + .nodeDeviceReAttachFlags = remoteNodeDeviceReAttachFlags, /* 1.0.7 */ .nodeDeviceReset = remoteNodeDeviceReset, /* 0.6.1 */ .domainMigratePrepareTunnel = remoteDomainMigratePrepareTunnel, /* 0.7.2 */ .connectIsEncrypted = remoteConnectIsEncrypted, /* 0.7.3 */ diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index 9723377..e32898e 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -1910,6 +1910,11 @@ struct remote_node_device_re_attach_args { remote_nonnull_string name; }; +struct remote_node_device_re_attach_flags_args { + remote_nonnull_string name; + unsigned int flags; +}; + struct remote_node_device_reset_args { remote_nonnull_string name; }; @@ -4434,6 +4439,11 @@ enum remote_procedure { /** * @generate: server */ - REMOTE_PROC_NODE_DEVICE_DETACH_FLAGS = 301 + REMOTE_PROC_NODE_DEVICE_DETACH_FLAGS = 301, + + /** + * @generate: server + */ + REMOTE_PROC_NODE_DEVICE_RE_ATTACH_FLAGS = 302 }; diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index ea38ea2..6bcf425 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -1448,6 +1448,10 @@ struct remote_node_device_detach_flags_args { struct remote_node_device_re_attach_args { remote_nonnull_string name; }; +struct remote_node_device_re_attach_flags_args { + remote_nonnull_string name; + u_int flags; +}; struct remote_node_device_reset_args { remote_nonnull_string name; }; @@ -2494,4 +2498,5 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_MIGRATE_GET_COMPRESSION_CACHE = 299, REMOTE_PROC_DOMAIN_MIGRATE_SET_COMPRESSION_CACHE = 300, REMOTE_PROC_NODE_DEVICE_DETACH_FLAGS = 301, + REMOTE_PROC_NODE_DEVICE_RE_ATTACH_FLAGS = 302, }; -- 1.7.11.7 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list