[libvirt] [PATCH 3/5] Implement RPC part of interface config API.
--- qemud/remote.c | 235 qemud/remote_dispatch_args.h |8 + qemud/remote_dispatch_prototypes.h | 63 +++ qemud/remote_dispatch_ret.h|6 + qemud/remote_dispatch_table.h | 45 + qemud/remote_protocol.c| 147 +++ qemud/remote_protocol.h| 123 + qemud/remote_protocol.x| 86 +- src/datatypes.c| 160 src/datatypes.h|6 + src/libvirt.c | 10 - src/remote_internal.c | 352 12 files changed, 1230 insertions(+), 11 deletions(-) diff --git a/qemud/remote.c b/qemud/remote.c index a92dea9..4881fc2 100644 --- a/qemud/remote.c +++ b/qemud/remote.c @@ -60,10 +60,12 @@ static void remoteDispatchFormatError (remote_error *rerr, ATTRIBUTE_FORMAT(printf, 2, 3); static virDomainPtr get_nonnull_domain (virConnectPtr conn, remote_nonnull_domain domain); static virNetworkPtr get_nonnull_network (virConnectPtr conn, remote_nonnull_network network); +static virInterfacePtr get_nonnull_interface (virConnectPtr conn, remote_nonnull_interface interface); static virStoragePoolPtr get_nonnull_storage_pool (virConnectPtr conn, remote_nonnull_storage_pool pool); static virStorageVolPtr get_nonnull_storage_vol (virConnectPtr conn, remote_nonnull_storage_vol vol); static void make_nonnull_domain (remote_nonnull_domain *dom_dst, virDomainPtr dom_src); static void make_nonnull_network (remote_nonnull_network *net_dst, virNetworkPtr net_src); +static void make_nonnull_interface (remote_nonnull_interface *interface_dst, virInterfacePtr interface_src); static void make_nonnull_storage_pool (remote_nonnull_storage_pool *pool_dst, virStoragePoolPtr pool_src); static void make_nonnull_storage_vol (remote_nonnull_storage_vol *vol_dst, virStorageVolPtr vol_src); static void make_nonnull_node_device (remote_nonnull_node_device *dev_dst, virNodeDevicePtr dev_src); @@ -2559,6 +2561,225 @@ remoteDispatchNumOfNetworks (struct qemud_server *server ATTRIBUTE_UNUSED, } +/*-*/ +static int +remoteDispatchNumOfInterfaces (struct qemud_server *server ATTRIBUTE_UNUSED, + struct qemud_client *client ATTRIBUTE_UNUSED, + virConnectPtr conn, + remote_error *rerr, + void *args ATTRIBUTE_UNUSED, + remote_num_of_interfaces_ret *ret) +{ + +ret-num = virConnectNumOfInterfaces (conn); +if (ret-num == -1) { +remoteDispatchConnError(rerr, conn); +return -1; +} + +return 0; +} + +static int +remoteDispatchListInterfaces (struct qemud_server *server ATTRIBUTE_UNUSED, + struct qemud_client *client ATTRIBUTE_UNUSED, + virConnectPtr conn, + remote_error *rerr, + remote_list_interfaces_args *args, + remote_list_interfaces_ret *ret) +{ + +if (args-maxnames REMOTE_INTERFACE_NAME_LIST_MAX) { +remoteDispatchFormatError (rerr, + %s, _(maxnames REMOTE_INTERFACE_NAME_LIST_MAX)); +return -1; +} + +/* Allocate return buffer. */ +if (VIR_ALLOC_N(ret-names.names_val, args-maxnames) 0) { +remoteDispatchOOMError(rerr); +return -1; +} + +ret-names.names_len = +virConnectListInterfaces (conn, + ret-names.names_val, args-maxnames); +if (ret-names.names_len == -1) { +VIR_FREE(ret-names.names_len); +remoteDispatchConnError(rerr, conn); +return -1; +} + +return 0; +} + +static int +remoteDispatchInterfaceLookupByName (struct qemud_server *server ATTRIBUTE_UNUSED, + struct qemud_client *client ATTRIBUTE_UNUSED, + virConnectPtr conn, + remote_error *rerr, + remote_interface_lookup_by_name_args *args, + remote_interface_lookup_by_name_ret *ret) +{ +virInterfacePtr interface; + +interface = virInterfaceLookupByName (conn, args-name); +if (interface == NULL) { +remoteDispatchConnError(rerr, conn); +return -1; +} + +make_nonnull_interface (ret-interface, interface); +virInterfaceFree(interface); +return 0; +} + +static int +remoteDispatchInterfaceLookupByMacString (struct qemud_server *server ATTRIBUTE_UNUSED, + struct qemud_client *client ATTRIBUTE_UNUSED, + virConnectPtr conn, +
[libvirt] [PATCH 3/5] Implement RPC part of interface config API.
--- qemud/remote.c | 235 qemud/remote_dispatch_args.h |8 + qemud/remote_dispatch_prototypes.h | 63 +++ qemud/remote_dispatch_ret.h|6 + qemud/remote_dispatch_table.h | 50 + qemud/remote_protocol.c| 156 qemud/remote_protocol.h| 127 + qemud/remote_protocol.x| 90 +- src/datatypes.c| 154 src/datatypes.h|6 + src/libvirt.c | 10 - src/remote_internal.c | 351 12 files changed, 1245 insertions(+), 11 deletions(-) diff --git a/qemud/remote.c b/qemud/remote.c index 8d24a3a..6dfd83a 100644 --- a/qemud/remote.c +++ b/qemud/remote.c @@ -60,10 +60,12 @@ static void remoteDispatchFormatError (remote_error *rerr, ATTRIBUTE_FORMAT(printf, 2, 3); static virDomainPtr get_nonnull_domain (virConnectPtr conn, remote_nonnull_domain domain); static virNetworkPtr get_nonnull_network (virConnectPtr conn, remote_nonnull_network network); +static virInterfacePtr get_nonnull_interface (virConnectPtr conn, remote_nonnull_interface interface); static virStoragePoolPtr get_nonnull_storage_pool (virConnectPtr conn, remote_nonnull_storage_pool pool); static virStorageVolPtr get_nonnull_storage_vol (virConnectPtr conn, remote_nonnull_storage_vol vol); static void make_nonnull_domain (remote_nonnull_domain *dom_dst, virDomainPtr dom_src); static void make_nonnull_network (remote_nonnull_network *net_dst, virNetworkPtr net_src); +static void make_nonnull_interface (remote_nonnull_interface *interface_dst, virInterfacePtr interface_src); static void make_nonnull_storage_pool (remote_nonnull_storage_pool *pool_dst, virStoragePoolPtr pool_src); static void make_nonnull_storage_vol (remote_nonnull_storage_vol *vol_dst, virStorageVolPtr vol_src); static void make_nonnull_node_device (remote_nonnull_node_device *dev_dst, virNodeDevicePtr dev_src); @@ -2559,6 +2561,225 @@ remoteDispatchNumOfNetworks (struct qemud_server *server ATTRIBUTE_UNUSED, } +/*-*/ +static int +remoteDispatchNumOfInterfaces (struct qemud_server *server ATTRIBUTE_UNUSED, + struct qemud_client *client ATTRIBUTE_UNUSED, + virConnectPtr conn, + remote_error *rerr, + void *args ATTRIBUTE_UNUSED, + remote_num_of_interfaces_ret *ret) +{ + +ret-num = virConnectNumOfInterfaces (conn); +if (ret-num == -1) { +remoteDispatchConnError(rerr, conn); +return -1; +} + +return 0; +} + +static int +remoteDispatchListInterfaces (struct qemud_server *server ATTRIBUTE_UNUSED, + struct qemud_client *client ATTRIBUTE_UNUSED, + virConnectPtr conn, + remote_error *rerr, + remote_list_interfaces_args *args, + remote_list_interfaces_ret *ret) +{ + +if (args-maxnames REMOTE_INTERFACE_NAME_LIST_MAX) { +remoteDispatchFormatError (rerr, + %s, _(maxnames REMOTE_INTERFACE_NAME_LIST_MAX)); +return -1; +} + +/* Allocate return buffer. */ +if (VIR_ALLOC_N(ret-names.names_val, args-maxnames) 0) { +remoteDispatchOOMError(rerr); +return -1; +} + +ret-names.names_len = +virConnectListInterfaces (conn, + ret-names.names_val, args-maxnames); +if (ret-names.names_len == -1) { +VIR_FREE(ret-names.names_len); +remoteDispatchConnError(rerr, conn); +return -1; +} + +return 0; +} + +static int +remoteDispatchInterfaceLookupByName (struct qemud_server *server ATTRIBUTE_UNUSED, + struct qemud_client *client ATTRIBUTE_UNUSED, + virConnectPtr conn, + remote_error *rerr, + remote_interface_lookup_by_name_args *args, + remote_interface_lookup_by_name_ret *ret) +{ +virInterfacePtr interface; + +interface = virInterfaceLookupByName (conn, args-name); +if (interface == NULL) { +remoteDispatchConnError(rerr, conn); +return -1; +} + +make_nonnull_interface (ret-interface, interface); +virInterfaceFree(interface); +return 0; +} + +static int +remoteDispatchInterfaceLookupByMac (struct qemud_server *server ATTRIBUTE_UNUSED, +struct qemud_client *client ATTRIBUTE_UNUSED, +virConnectPtr conn, +remote_error *rerr, +
Re: [libvirt] [PATCH 3/5] Implement RPC part of interface config API.
On Fri, May 08, 2009 at 01:52:25PM -0400, Laine Stump wrote: --- qemud/remote.c | 235 qemud/remote_dispatch_args.h |8 + qemud/remote_dispatch_prototypes.h | 63 +++ qemud/remote_dispatch_ret.h|6 + qemud/remote_dispatch_table.h | 50 + qemud/remote_protocol.c| 156 qemud/remote_protocol.h| 127 + qemud/remote_protocol.x| 90 +- src/datatypes.c| 154 src/datatypes.h|6 + src/libvirt.c | 10 - src/remote_internal.c | 351 12 files changed, 1245 insertions(+), 11 deletions(-) ACK, this all looks fine. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 3/5] Implement RPC part of interface config API.
--- qemud/remote.c | 235 qemud/remote_dispatch_args.h |8 + qemud/remote_dispatch_prototypes.h | 63 +++ qemud/remote_dispatch_ret.h|6 + qemud/remote_dispatch_table.h | 50 + qemud/remote_protocol.c| 156 qemud/remote_protocol.h| 127 + qemud/remote_protocol.x| 90 +- src/datatypes.c| 154 src/datatypes.h|6 + src/libvirt.c | 10 - src/remote_internal.c | 351 12 files changed, 1245 insertions(+), 11 deletions(-) diff --git a/qemud/remote.c b/qemud/remote.c index 8d24a3a..6dfd83a 100644 --- a/qemud/remote.c +++ b/qemud/remote.c @@ -60,10 +60,12 @@ static void remoteDispatchFormatError (remote_error *rerr, ATTRIBUTE_FORMAT(printf, 2, 3); static virDomainPtr get_nonnull_domain (virConnectPtr conn, remote_nonnull_domain domain); static virNetworkPtr get_nonnull_network (virConnectPtr conn, remote_nonnull_network network); +static virInterfacePtr get_nonnull_interface (virConnectPtr conn, remote_nonnull_interface interface); static virStoragePoolPtr get_nonnull_storage_pool (virConnectPtr conn, remote_nonnull_storage_pool pool); static virStorageVolPtr get_nonnull_storage_vol (virConnectPtr conn, remote_nonnull_storage_vol vol); static void make_nonnull_domain (remote_nonnull_domain *dom_dst, virDomainPtr dom_src); static void make_nonnull_network (remote_nonnull_network *net_dst, virNetworkPtr net_src); +static void make_nonnull_interface (remote_nonnull_interface *interface_dst, virInterfacePtr interface_src); static void make_nonnull_storage_pool (remote_nonnull_storage_pool *pool_dst, virStoragePoolPtr pool_src); static void make_nonnull_storage_vol (remote_nonnull_storage_vol *vol_dst, virStorageVolPtr vol_src); static void make_nonnull_node_device (remote_nonnull_node_device *dev_dst, virNodeDevicePtr dev_src); @@ -2559,6 +2561,225 @@ remoteDispatchNumOfNetworks (struct qemud_server *server ATTRIBUTE_UNUSED, } +/*-*/ +static int +remoteDispatchNumOfInterfaces (struct qemud_server *server ATTRIBUTE_UNUSED, + struct qemud_client *client ATTRIBUTE_UNUSED, + virConnectPtr conn, + remote_error *rerr, + void *args ATTRIBUTE_UNUSED, + remote_num_of_interfaces_ret *ret) +{ + +ret-num = virConnectNumOfInterfaces (conn); +if (ret-num == -1) { +remoteDispatchConnError(rerr, conn); +return -1; +} + +return 0; +} + +static int +remoteDispatchListInterfaces (struct qemud_server *server ATTRIBUTE_UNUSED, + struct qemud_client *client ATTRIBUTE_UNUSED, + virConnectPtr conn, + remote_error *rerr, + remote_list_interfaces_args *args, + remote_list_interfaces_ret *ret) +{ + +if (args-maxnames REMOTE_INTERFACE_NAME_LIST_MAX) { +remoteDispatchFormatError (rerr, + %s, _(maxnames REMOTE_INTERFACE_NAME_LIST_MAX)); +return -1; +} + +/* Allocate return buffer. */ +if (VIR_ALLOC_N(ret-names.names_val, args-maxnames) 0) { +remoteDispatchOOMError(rerr); +return -1; +} + +ret-names.names_len = +virConnectListInterfaces (conn, + ret-names.names_val, args-maxnames); +if (ret-names.names_len == -1) { +VIR_FREE(ret-names.names_len); +remoteDispatchConnError(rerr, conn); +return -1; +} + +return 0; +} + +static int +remoteDispatchInterfaceLookupByName (struct qemud_server *server ATTRIBUTE_UNUSED, + struct qemud_client *client ATTRIBUTE_UNUSED, + virConnectPtr conn, + remote_error *rerr, + remote_interface_lookup_by_name_args *args, + remote_interface_lookup_by_name_ret *ret) +{ +virInterfacePtr interface; + +interface = virInterfaceLookupByName (conn, args-name); +if (interface == NULL) { +remoteDispatchConnError(rerr, conn); +return -1; +} + +make_nonnull_interface (ret-interface, interface); +virInterfaceFree(interface); +return 0; +} + +static int +remoteDispatchInterfaceLookupByMac (struct qemud_server *server ATTRIBUTE_UNUSED, +struct qemud_client *client ATTRIBUTE_UNUSED, +virConnectPtr conn, +remote_error *rerr, +