Nothing to see here, just a bunch of plumbing.
Signed-off-by: Mark McLoughlin <markmc(a)redhat.com>
---
ChangeLog | 5 ++
qemud/remote.c | 78 ++++++++++++++++++++++++++++++++++++
qemud/remote_dispatch_args.h | 3 +
qemud/remote_dispatch_prototypes.h | 21 ++++++++++
qemud/remote_dispatch_table.h | 15 +++++++
qemud/remote_protocol.c | 27 ++++++++++++
qemud/remote_protocol.h | 24 +++++++++++
qemud/remote_protocol.x | 17 +++++++-
src/remote_internal.c | 72 +++++++++++++++++++++++++++++++++
9 files changed, 261 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 1bd29ed..dd8241d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Feb 24 22:02:32 GMT 2009 Mark McLoughlin <markmc(a)redhat.com>
+
+ * qemud/remote*, src/remote_internal.c: plumb the new
+ APIs in the remote driver
+
Tue Feb 24 21:58:22 GMT 2009 Mark McLoughlin <markmc(a)redhat.com>
* include/libvirt/libvirt.h: add virNodeDeviceDettach(),
diff --git a/qemud/remote.c b/qemud/remote.c
index 78dda42..bb4cdb0 100644
--- a/qemud/remote.c
+++ b/qemud/remote.c
@@ -4172,6 +4172,84 @@ remoteDispatchNodeDeviceListCaps (struct qemud_server *server
ATTRIBUTE_UNUSED,
}
+static int
+remoteDispatchNodeDeviceDettach (struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_error *rerr,
+ remote_node_device_dettach_args *args,
+ void *ret ATTRIBUTE_UNUSED)
+{
+ virNodeDevicePtr dev;
+ CHECK_CONN(client);
+
+ dev = virNodeDeviceLookupByName(conn, args->name);
+ if (dev == NULL) {
+ remoteDispatchFormatError(rerr, "%s", _("node_device not
found"));
+ return -1;
+ }
+
+ if (virNodeDeviceDettach(dev) == -1) {
+ remoteDispatchConnError(rerr, conn);
+ return -1;
+ }
+
+ return 0;
+}
+
+
+static int
+remoteDispatchNodeDeviceReAttach (struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_error *rerr,
+ remote_node_device_re_attach_args *args,
+ void *ret ATTRIBUTE_UNUSED)
+{
+ virNodeDevicePtr dev;
+ CHECK_CONN(client);
+
+ dev = virNodeDeviceLookupByName(conn, args->name);
+ if (dev == NULL) {
+ remoteDispatchFormatError(rerr, "%s", _("node_device not
found"));
+ return -1;
+ }
+
+ if (virNodeDeviceReAttach(dev) == -1) {
+ remoteDispatchConnError(rerr, conn);
+ return -1;
+ }
+
+ return 0;
+}
+
+
+static int
+remoteDispatchNodeDeviceReset (struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_error *rerr,
+ remote_node_device_reset_args *args,
+ void *ret ATTRIBUTE_UNUSED)
+{
+ virNodeDevicePtr dev;
+ CHECK_CONN(client);
+
+ dev = virNodeDeviceLookupByName(conn, args->name);
+ if (dev == NULL) {
+ remoteDispatchFormatError(rerr, "%s", _("node_device not
found"));
+ return -1;
+ }
+
+ if (virNodeDeviceReset(dev) == -1) {
+ remoteDispatchConnError(rerr, conn);
+ return -1;
+ }
+
+ return 0;
+}
+
+
/**************************
* Async Events
**************************/
diff --git a/qemud/remote_dispatch_args.h b/qemud/remote_dispatch_args.h
index a19ab79..03a7937 100644
--- a/qemud/remote_dispatch_args.h
+++ b/qemud/remote_dispatch_args.h
@@ -99,3 +99,6 @@
remote_node_device_get_parent_args val_remote_node_device_get_parent_args;
remote_node_device_num_of_caps_args val_remote_node_device_num_of_caps_args;
remote_node_device_list_caps_args val_remote_node_device_list_caps_args;
+ remote_node_device_dettach_args val_remote_node_device_dettach_args;
+ remote_node_device_re_attach_args val_remote_node_device_re_attach_args;
+ remote_node_device_reset_args val_remote_node_device_reset_args;
diff --git a/qemud/remote_dispatch_prototypes.h b/qemud/remote_dispatch_prototypes.h
index 3ffb164..4188c6a 100644
--- a/qemud/remote_dispatch_prototypes.h
+++ b/qemud/remote_dispatch_prototypes.h
@@ -520,6 +520,13 @@ static int remoteDispatchNetworkUndefine(
remote_error *err,
remote_network_undefine_args *args,
void *ret);
+static int remoteDispatchNodeDeviceDettach(
+ struct qemud_server *server,
+ struct qemud_client *client,
+ virConnectPtr conn,
+ remote_error *err,
+ remote_node_device_dettach_args *args,
+ void *ret);
static int remoteDispatchNodeDeviceDumpXml(
struct qemud_server *server,
struct qemud_client *client,
@@ -555,6 +562,20 @@ static int remoteDispatchNodeDeviceNumOfCaps(
remote_error *err,
remote_node_device_num_of_caps_args *args,
remote_node_device_num_of_caps_ret *ret);
+static int remoteDispatchNodeDeviceReAttach(
+ struct qemud_server *server,
+ struct qemud_client *client,
+ virConnectPtr conn,
+ remote_error *err,
+ remote_node_device_re_attach_args *args,
+ void *ret);
+static int remoteDispatchNodeDeviceReset(
+ struct qemud_server *server,
+ struct qemud_client *client,
+ virConnectPtr conn,
+ remote_error *err,
+ remote_node_device_reset_args *args,
+ void *ret);
static int remoteDispatchNodeGetCellsFreeMemory(
struct qemud_server *server,
struct qemud_client *client,
diff --git a/qemud/remote_dispatch_table.h b/qemud/remote_dispatch_table.h
index 60f0e1c..98be9f3 100644
--- a/qemud/remote_dispatch_table.h
+++ b/qemud/remote_dispatch_table.h
@@ -592,3 +592,18 @@
.args_filter = (xdrproc_t) xdr_remote_node_device_list_caps_args,
.ret_filter = (xdrproc_t) xdr_remote_node_device_list_caps_ret,
},
+{ /* NodeDeviceDettach => 118 */
+ .fn = (dispatch_fn) remoteDispatchNodeDeviceDettach,
+ .args_filter = (xdrproc_t) xdr_remote_node_device_dettach_args,
+ .ret_filter = (xdrproc_t) xdr_void,
+},
+{ /* NodeDeviceReAttach => 119 */
+ .fn = (dispatch_fn) remoteDispatchNodeDeviceReAttach,
+ .args_filter = (xdrproc_t) xdr_remote_node_device_re_attach_args,
+ .ret_filter = (xdrproc_t) xdr_void,
+},
+{ /* NodeDeviceReset => 120 */
+ .fn = (dispatch_fn) remoteDispatchNodeDeviceReset,
+ .args_filter = (xdrproc_t) xdr_remote_node_device_reset_args,
+ .ret_filter = (xdrproc_t) xdr_void,
+},
diff --git a/qemud/remote_protocol.c b/qemud/remote_protocol.c
index 249614a..b872469 100644
--- a/qemud/remote_protocol.c
+++ b/qemud/remote_protocol.c
@@ -2166,6 +2166,33 @@ xdr_remote_node_device_list_caps_ret (XDR *xdrs,
remote_node_device_list_caps_re
}
bool_t
+xdr_remote_node_device_dettach_args (XDR *xdrs, remote_node_device_dettach_args *objp)
+{
+
+ if (!xdr_remote_nonnull_string (xdrs, &objp->name))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_remote_node_device_re_attach_args (XDR *xdrs, remote_node_device_re_attach_args
*objp)
+{
+
+ if (!xdr_remote_nonnull_string (xdrs, &objp->name))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_remote_node_device_reset_args (XDR *xdrs, remote_node_device_reset_args *objp)
+{
+
+ if (!xdr_remote_nonnull_string (xdrs, &objp->name))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
xdr_remote_domain_events_register_ret (XDR *xdrs, remote_domain_events_register_ret
*objp)
{
diff --git a/qemud/remote_protocol.h b/qemud/remote_protocol.h
index 912d8e3..e73e5da 100644
--- a/qemud/remote_protocol.h
+++ b/qemud/remote_protocol.h
@@ -1211,6 +1211,21 @@ struct remote_node_device_list_caps_ret {
};
typedef struct remote_node_device_list_caps_ret remote_node_device_list_caps_ret;
+struct remote_node_device_dettach_args {
+ remote_nonnull_string name;
+};
+typedef struct remote_node_device_dettach_args remote_node_device_dettach_args;
+
+struct remote_node_device_re_attach_args {
+ remote_nonnull_string name;
+};
+typedef struct remote_node_device_re_attach_args remote_node_device_re_attach_args;
+
+struct remote_node_device_reset_args {
+ remote_nonnull_string name;
+};
+typedef struct remote_node_device_reset_args remote_node_device_reset_args;
+
struct remote_domain_events_register_ret {
int cb_registered;
};
@@ -1348,6 +1363,9 @@ enum remote_procedure {
REMOTE_PROC_NODE_DEVICE_GET_PARENT = 115,
REMOTE_PROC_NODE_DEVICE_NUM_OF_CAPS = 116,
REMOTE_PROC_NODE_DEVICE_LIST_CAPS = 117,
+ REMOTE_PROC_NODE_DEVICE_DETTACH = 118,
+ REMOTE_PROC_NODE_DEVICE_RE_ATTACH = 119,
+ REMOTE_PROC_NODE_DEVICE_RESET = 120,
};
typedef enum remote_procedure remote_procedure;
@@ -1574,6 +1592,9 @@ extern bool_t xdr_remote_node_device_num_of_caps_args (XDR *,
remote_node_devic
extern bool_t xdr_remote_node_device_num_of_caps_ret (XDR *,
remote_node_device_num_of_caps_ret*);
extern bool_t xdr_remote_node_device_list_caps_args (XDR *,
remote_node_device_list_caps_args*);
extern bool_t xdr_remote_node_device_list_caps_ret (XDR *,
remote_node_device_list_caps_ret*);
+extern bool_t xdr_remote_node_device_dettach_args (XDR *,
remote_node_device_dettach_args*);
+extern bool_t xdr_remote_node_device_re_attach_args (XDR *,
remote_node_device_re_attach_args*);
+extern bool_t xdr_remote_node_device_reset_args (XDR *,
remote_node_device_reset_args*);
extern bool_t xdr_remote_domain_events_register_ret (XDR *,
remote_domain_events_register_ret*);
extern bool_t xdr_remote_domain_events_deregister_ret (XDR *,
remote_domain_events_deregister_ret*);
extern bool_t xdr_remote_domain_event_ret (XDR *, remote_domain_event_ret*);
@@ -1779,6 +1800,9 @@ extern bool_t xdr_remote_node_device_num_of_caps_args ();
extern bool_t xdr_remote_node_device_num_of_caps_ret ();
extern bool_t xdr_remote_node_device_list_caps_args ();
extern bool_t xdr_remote_node_device_list_caps_ret ();
+extern bool_t xdr_remote_node_device_dettach_args ();
+extern bool_t xdr_remote_node_device_re_attach_args ();
+extern bool_t xdr_remote_node_device_reset_args ();
extern bool_t xdr_remote_domain_events_register_ret ();
extern bool_t xdr_remote_domain_events_deregister_ret ();
extern bool_t xdr_remote_domain_event_ret ();
diff --git a/qemud/remote_protocol.x b/qemud/remote_protocol.x
index 2a6035b..8f76064 100644
--- a/qemud/remote_protocol.x
+++ b/qemud/remote_protocol.x
@@ -1068,6 +1068,18 @@ struct remote_node_device_list_caps_ret {
remote_nonnull_string names<REMOTE_NODE_DEVICE_CAPS_LIST_MAX>;
};
+struct remote_node_device_dettach_args {
+ remote_nonnull_string name;
+};
+
+struct remote_node_device_re_attach_args {
+ remote_nonnull_string name;
+};
+
+struct remote_node_device_reset_args {
+ remote_nonnull_string name;
+};
+
/**
* Events Register/Deregister:
@@ -1223,7 +1235,10 @@ enum remote_procedure {
REMOTE_PROC_NODE_DEVICE_DUMP_XML = 114,
REMOTE_PROC_NODE_DEVICE_GET_PARENT = 115,
REMOTE_PROC_NODE_DEVICE_NUM_OF_CAPS = 116,
- REMOTE_PROC_NODE_DEVICE_LIST_CAPS = 117
+ REMOTE_PROC_NODE_DEVICE_LIST_CAPS = 117,
+ REMOTE_PROC_NODE_DEVICE_DETTACH = 118,
+ REMOTE_PROC_NODE_DEVICE_RE_ATTACH = 119,
+ REMOTE_PROC_NODE_DEVICE_RESET = 120
};
/* Custom RPC structure. */
diff --git a/src/remote_internal.c b/src/remote_internal.c
index eda6177..0f651f4 100644
--- a/src/remote_internal.c
+++ b/src/remote_internal.c
@@ -4812,6 +4812,75 @@ done:
return rv;
}
+static int
+remoteNodeDeviceDettach (virNodeDevicePtr dev)
+{
+ int rv = -1;
+ remote_node_device_dettach_args args;
+ struct private_data *priv = dev->conn->privateData;
+
+ remoteDriverLock(priv);
+
+ args.name = dev->name;
+
+ if (call (dev->conn, priv, 0, REMOTE_PROC_NODE_DEVICE_DETTACH,
+ (xdrproc_t) xdr_remote_node_device_dettach_args, (char *) &args,
+ (xdrproc_t) xdr_void, (char *) NULL) == -1)
+ goto done;
+
+ rv = 0;
+
+done:
+ remoteDriverUnlock(priv);
+ return rv;
+}
+
+static int
+remoteNodeDeviceReAttach (virNodeDevicePtr dev)
+{
+ int rv = -1;
+ remote_node_device_re_attach_args args;
+ struct private_data *priv = dev->conn->privateData;
+
+ remoteDriverLock(priv);
+
+ args.name = dev->name;
+
+ if (call (dev->conn, priv, 0, REMOTE_PROC_NODE_DEVICE_RE_ATTACH,
+ (xdrproc_t) xdr_remote_node_device_re_attach_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;
+ remote_node_device_reset_args args;
+ struct private_data *priv = dev->conn->privateData;
+
+ remoteDriverLock(priv);
+
+ args.name = dev->name;
+
+ if (call (dev->conn, priv, 0, REMOTE_PROC_NODE_DEVICE_RESET,
+ (xdrproc_t) xdr_remote_node_device_reset_args, (char *) &args,
+ (xdrproc_t) xdr_void, (char *) NULL) == -1)
+ goto done;
+
+ rv = 0;
+
+done:
+ remoteDriverUnlock(priv);
+ return rv;
+}
+
/*----------------------------------------------------------------------*/
@@ -6741,6 +6810,9 @@ static virDriver driver = {
.domainEventDeregister = remoteDomainEventDeregister,
.domainMigratePrepare2 = remoteDomainMigratePrepare2,
.domainMigrateFinish2 = remoteDomainMigrateFinish2,
+ .nodeDeviceDettach = remoteNodeDeviceDettach,
+ .nodeDeviceReAttach = remoteNodeDeviceReAttach,
+ .nodeDeviceReset = remoteNodeDeviceReset,
};
static virNetworkDriver network_driver = {
--
1.6.0.6