提交 02311028 编写于 作者: D Daniel Veillard

Implement node attach/reattach/reset in the remote driver

* qemud/remote.c qemud/remote_dispatch_args.h
  qemud/remote_dispatch_prototypes.h qemud/remote_dispatch_table.h
  qemud/remote_protocol.c qemud/remote_protocol.h
  qemud/remote_protocol.x src/remote_internal.c: Implement
  attach/reattach/reset in the remote driver, patch by Mark
  McLoughlin.
Daniel
上级 6427091f
Mon Mar 2 17:28:42 CET 2009 Daniel Veillard <veillard@redhat.com>
* qemud/remote.c qemud/remote_dispatch_args.h
qemud/remote_dispatch_prototypes.h qemud/remote_dispatch_table.h
qemud/remote_protocol.c qemud/remote_protocol.h
qemud/remote_protocol.x src/remote_internal.c: Implement
attach/reattach/reset in the remote driver, patch by Mark
McLoughlin.
Mon Mar 2 17:26:48 CET 2009 Daniel Veillard <veillard@redhat.com> Mon Mar 2 17:26:48 CET 2009 Daniel Veillard <veillard@redhat.com>
* src/virsh.c: add 3 new commands for node device detach, * src/virsh.c: add 3 new commands for node device detach,
......
...@@ -4172,6 +4172,84 @@ remoteDispatchNodeDeviceListCaps (struct qemud_server *server ATTRIBUTE_UNUSED, ...@@ -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 * Async Events
**************************/ **************************/
......
...@@ -99,3 +99,6 @@ ...@@ -99,3 +99,6 @@
remote_node_device_get_parent_args val_remote_node_device_get_parent_args; 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_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_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;
...@@ -520,6 +520,13 @@ static int remoteDispatchNetworkUndefine( ...@@ -520,6 +520,13 @@ static int remoteDispatchNetworkUndefine(
remote_error *err, remote_error *err,
remote_network_undefine_args *args, remote_network_undefine_args *args,
void *ret); 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( static int remoteDispatchNodeDeviceDumpXml(
struct qemud_server *server, struct qemud_server *server,
struct qemud_client *client, struct qemud_client *client,
...@@ -555,6 +562,20 @@ static int remoteDispatchNodeDeviceNumOfCaps( ...@@ -555,6 +562,20 @@ static int remoteDispatchNodeDeviceNumOfCaps(
remote_error *err, remote_error *err,
remote_node_device_num_of_caps_args *args, remote_node_device_num_of_caps_args *args,
remote_node_device_num_of_caps_ret *ret); 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( static int remoteDispatchNodeGetCellsFreeMemory(
struct qemud_server *server, struct qemud_server *server,
struct qemud_client *client, struct qemud_client *client,
......
...@@ -592,3 +592,18 @@ ...@@ -592,3 +592,18 @@
.args_filter = (xdrproc_t) xdr_remote_node_device_list_caps_args, .args_filter = (xdrproc_t) xdr_remote_node_device_list_caps_args,
.ret_filter = (xdrproc_t) xdr_remote_node_device_list_caps_ret, .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,
},
...@@ -2165,6 +2165,33 @@ xdr_remote_node_device_list_caps_ret (XDR *xdrs, remote_node_device_list_caps_re ...@@ -2165,6 +2165,33 @@ xdr_remote_node_device_list_caps_ret (XDR *xdrs, remote_node_device_list_caps_re
return TRUE; return TRUE;
} }
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 bool_t
xdr_remote_domain_events_register_ret (XDR *xdrs, remote_domain_events_register_ret *objp) xdr_remote_domain_events_register_ret (XDR *xdrs, remote_domain_events_register_ret *objp)
{ {
......
...@@ -1211,6 +1211,21 @@ struct remote_node_device_list_caps_ret { ...@@ -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; 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 { struct remote_domain_events_register_ret {
int cb_registered; int cb_registered;
}; };
...@@ -1348,6 +1363,9 @@ enum remote_procedure { ...@@ -1348,6 +1363,9 @@ enum remote_procedure {
REMOTE_PROC_NODE_DEVICE_GET_PARENT = 115, REMOTE_PROC_NODE_DEVICE_GET_PARENT = 115,
REMOTE_PROC_NODE_DEVICE_NUM_OF_CAPS = 116, 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,
}; };
typedef enum remote_procedure remote_procedure; 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 ...@@ -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_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_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_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_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_events_deregister_ret (XDR *, remote_domain_events_deregister_ret*);
extern bool_t xdr_remote_domain_event_ret (XDR *, remote_domain_event_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 (); ...@@ -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_num_of_caps_ret ();
extern bool_t xdr_remote_node_device_list_caps_args (); 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_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_register_ret ();
extern bool_t xdr_remote_domain_events_deregister_ret (); extern bool_t xdr_remote_domain_events_deregister_ret ();
extern bool_t xdr_remote_domain_event_ret (); extern bool_t xdr_remote_domain_event_ret ();
......
...@@ -1068,6 +1068,18 @@ struct remote_node_device_list_caps_ret { ...@@ -1068,6 +1068,18 @@ struct remote_node_device_list_caps_ret {
remote_nonnull_string names<REMOTE_NODE_DEVICE_CAPS_LIST_MAX>; 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: * Events Register/Deregister:
...@@ -1223,7 +1235,10 @@ enum remote_procedure { ...@@ -1223,7 +1235,10 @@ enum remote_procedure {
REMOTE_PROC_NODE_DEVICE_DUMP_XML = 114, REMOTE_PROC_NODE_DEVICE_DUMP_XML = 114,
REMOTE_PROC_NODE_DEVICE_GET_PARENT = 115, REMOTE_PROC_NODE_DEVICE_GET_PARENT = 115,
REMOTE_PROC_NODE_DEVICE_NUM_OF_CAPS = 116, 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. */ /* Custom RPC structure. */
......
...@@ -4813,6 +4813,75 @@ done: ...@@ -4813,6 +4813,75 @@ done:
return rv; 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;
}
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
...@@ -6742,6 +6811,9 @@ static virDriver driver = { ...@@ -6742,6 +6811,9 @@ static virDriver driver = {
.domainEventDeregister = remoteDomainEventDeregister, .domainEventDeregister = remoteDomainEventDeregister,
.domainMigratePrepare2 = remoteDomainMigratePrepare2, .domainMigratePrepare2 = remoteDomainMigratePrepare2,
.domainMigrateFinish2 = remoteDomainMigrateFinish2, .domainMigrateFinish2 = remoteDomainMigrateFinish2,
.nodeDeviceDettach = remoteNodeDeviceDettach,
.nodeDeviceReAttach = remoteNodeDeviceReAttach,
.nodeDeviceReset = remoteNodeDeviceReset,
}; };
static virNetworkDriver network_driver = { static virNetworkDriver network_driver = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册