diff --git a/daemon/remote.c b/daemon/remote.c index e5e4f29cee644c12a280656f777867995c81a5a4..7cd4a438d64070c4c8ec8d6bae60e43321d9b7ac 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -493,35 +493,6 @@ cleanup: return rv; } -static int -remoteDispatchGetMaxVcpus(struct qemud_server *server ATTRIBUTE_UNUSED, - struct qemud_client *client ATTRIBUTE_UNUSED, - virConnectPtr conn, - remote_message_header *hdr ATTRIBUTE_UNUSED, - remote_error *rerr, - remote_get_max_vcpus_args *args, - remote_get_max_vcpus_ret *ret) -{ - char *type; - int rv = -1; - - if (!conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); - goto cleanup; - } - - type = args->type ? *args->type : NULL; - if ((ret->max_vcpus = virConnectGetMaxVcpus(conn, type)) < 0) - goto cleanup; - - rv = 0; - -cleanup: - if (rv < 0) - remoteDispatchError(rerr); - return rv; -} - static int remoteDispatchNodeGetInfo(struct qemud_server *server ATTRIBUTE_UNUSED, struct qemud_client *client ATTRIBUTE_UNUSED, @@ -1359,46 +1330,6 @@ cleanup: return rv; } -static int -remoteDispatchDomainMigratePerform(struct qemud_server *server ATTRIBUTE_UNUSED, - struct qemud_client *client ATTRIBUTE_UNUSED, - virConnectPtr conn, - remote_message_header *hdr ATTRIBUTE_UNUSED, - remote_error *rerr, - remote_domain_migrate_perform_args *args, - void *ret ATTRIBUTE_UNUSED) -{ - virDomainPtr dom = NULL; - char *dname; - int rv = -1; - - if (!conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); - goto cleanup; - } - - if (!(dom = get_nonnull_domain(conn, args->dom))) - goto cleanup; - - dname = args->dname == NULL ? NULL : *args->dname; - - if (virDomainMigratePerform(dom, - args->cookie.cookie_val, - args->cookie.cookie_len, - args->uri, - args->flags, dname, args->resource) < 0) - goto cleanup; - - rv = 0; - -cleanup: - if (rv < 0) - remoteDispatchError(rerr); - if (dom) - virDomainFree(dom); - return rv; -} - static int remoteDispatchDomainMigratePrepare2(struct qemud_server *server ATTRIBUTE_UNUSED, struct qemud_client *client ATTRIBUTE_UNUSED, @@ -3139,37 +3070,6 @@ cleanup: return rv; } -static int -remoteDispatchFindStoragePoolSources(struct qemud_server *server ATTRIBUTE_UNUSED, - struct qemud_client *client ATTRIBUTE_UNUSED, - virConnectPtr conn, - remote_message_header *hdr ATTRIBUTE_UNUSED, - remote_error *rerr, - remote_find_storage_pool_sources_args *args, - remote_find_storage_pool_sources_ret *ret) -{ - int rv = -1; - - if (!conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); - goto cleanup; - } - - if (!(ret->xml = - virConnectFindStoragePoolSources(conn, - args->type, - args->srcSpec ? *args->srcSpec : NULL, - args->flags))) - goto cleanup; - - rv = 0; - -cleanup: - if (rv < 0) - remoteDispatchError(rerr); - return rv; -} - static int remoteDispatchStoragePoolGetInfo(struct qemud_server *server ATTRIBUTE_UNUSED, struct qemud_client *client ATTRIBUTE_UNUSED, @@ -3307,36 +3207,6 @@ cleanup: * NODE INFO APIS **************************************************************/ -static int -remoteDispatchNodeNumOfDevices(struct qemud_server *server ATTRIBUTE_UNUSED, - struct qemud_client *client ATTRIBUTE_UNUSED, - virConnectPtr conn, - remote_message_header *hdr ATTRIBUTE_UNUSED, - remote_error *rerr, - remote_node_num_of_devices_args *args, - remote_node_num_of_devices_ret *ret) -{ - int rv = -1; - - if (!conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); - goto cleanup; - } - - if ((ret->num = virNodeNumOfDevices(conn, - args->cap ? *args->cap : NULL, - args->flags)) < 0) - goto cleanup; - - rv = 0; - -cleanup: - if (rv < 0) - remoteDispatchError(rerr); - return rv; -} - - static int remoteDispatchNodeListDevices(struct qemud_server *server ATTRIBUTE_UNUSED, struct qemud_client *client ATTRIBUTE_UNUSED, diff --git a/daemon/remote_dispatch_bodies.c b/daemon/remote_dispatch_bodies.c index 0d35a9b24c76ede9dca8331717b15bf7a7b1a74b..41594ded706bbf48977dc9f0484899fd9edb64fe 100644 --- a/daemon/remote_dispatch_bodies.c +++ b/daemon/remote_dispatch_bodies.c @@ -1017,7 +1017,42 @@ cleanup: return rv; } -/* remoteDispatchDomainMigratePerform has to be implemented manually */ +static int +remoteDispatchDomainMigratePerform( + struct qemud_server *server ATTRIBUTE_UNUSED, + struct qemud_client *client ATTRIBUTE_UNUSED, + virConnectPtr conn, + remote_message_header *hdr ATTRIBUTE_UNUSED, + remote_error *rerr, + remote_domain_migrate_perform_args *args, + void *ret ATTRIBUTE_UNUSED) +{ + int rv = -1; + virDomainPtr dom = NULL; + char *dname; + + if (!conn) { + virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + goto cleanup; + } + + if (!(dom = get_nonnull_domain(conn, args->dom))) + goto cleanup; + + dname = args->dname ? *args->dname : NULL; + + if (virDomainMigratePerform(dom, args->cookie.cookie_val, args->cookie.cookie_len, args->uri, args->flags, dname, args->resource) < 0) + goto cleanup; + + rv = 0; + +cleanup: + if (rv < 0) + remoteDispatchError(rerr); + if (dom) + virDomainFree(dom); + return rv; +} /* remoteDispatchDomainMigratePrepare has to be implemented manually */ @@ -1907,7 +1942,38 @@ cleanup: return rv; } -/* remoteDispatchFindStoragePoolSources has to be implemented manually */ +static int +remoteDispatchFindStoragePoolSources( + struct qemud_server *server ATTRIBUTE_UNUSED, + struct qemud_client *client ATTRIBUTE_UNUSED, + virConnectPtr conn, + remote_message_header *hdr ATTRIBUTE_UNUSED, + remote_error *rerr, + remote_find_storage_pool_sources_args *args, + remote_find_storage_pool_sources_ret *ret) +{ + int rv = -1; + char *srcSpec; + char *xml; + + if (!conn) { + virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + goto cleanup; + } + + srcSpec = args->srcSpec ? *args->srcSpec : NULL; + + if ((xml = virConnectFindStoragePoolSources(conn, args->type, srcSpec, args->flags)) == NULL) + goto cleanup; + + ret->xml = xml; + rv = 0; + +cleanup: + if (rv < 0) + remoteDispatchError(rerr); + return rv; +} static int remoteDispatchGetCapabilities( @@ -1999,7 +2065,38 @@ cleanup: return rv; } -/* remoteDispatchGetMaxVcpus has to be implemented manually */ +static int +remoteDispatchGetMaxVcpus( + struct qemud_server *server ATTRIBUTE_UNUSED, + struct qemud_client *client ATTRIBUTE_UNUSED, + virConnectPtr conn, + remote_message_header *hdr ATTRIBUTE_UNUSED, + remote_error *rerr, + remote_get_max_vcpus_args *args, + remote_get_max_vcpus_ret *ret) +{ + int rv = -1; + char *type; + int max_vcpus; + + if (!conn) { + virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + goto cleanup; + } + + type = args->type ? *args->type : NULL; + + if ((max_vcpus = virConnectGetMaxVcpus(conn, type)) < 0) + goto cleanup; + + ret->max_vcpus = max_vcpus; + rv = 0; + +cleanup: + if (rv < 0) + remoteDispatchError(rerr); + return rv; +} static int remoteDispatchGetSysinfo( @@ -3171,7 +3268,38 @@ cleanup: /* remoteDispatchNodeListDevices has to be implemented manually */ -/* remoteDispatchNodeNumOfDevices has to be implemented manually */ +static int +remoteDispatchNodeNumOfDevices( + struct qemud_server *server ATTRIBUTE_UNUSED, + struct qemud_client *client ATTRIBUTE_UNUSED, + virConnectPtr conn, + remote_message_header *hdr ATTRIBUTE_UNUSED, + remote_error *rerr, + remote_node_num_of_devices_args *args, + remote_node_num_of_devices_ret *ret) +{ + int rv = -1; + char *cap; + int num; + + if (!conn) { + virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + goto cleanup; + } + + cap = args->cap ? *args->cap : NULL; + + if ((num = virNodeNumOfDevices(conn, cap, args->flags)) < 0) + goto cleanup; + + ret->num = num; + rv = 0; + +cleanup: + if (rv < 0) + remoteDispatchError(rerr); + return rv; +} static int remoteDispatchNumOfDefinedDomains( diff --git a/daemon/remote_generator.pl b/daemon/remote_generator.pl index 9621db5154e408b69cecf55fdf01198a9e95cf6f..e088efb2158ea2ddae9e13d3d9b3656e80267153 100755 --- a/daemon/remote_generator.pl +++ b/daemon/remote_generator.pl @@ -241,7 +241,6 @@ elsif ($opt_b) { @ungeneratable = ("Close", "DomainEventsDeregisterAny", "DomainEventsRegisterAny", - "DomainMigratePerform", "DomainMigratePrepareTunnel", "DomainOpenConsole", "DomainPinVcpu", @@ -280,8 +279,6 @@ elsif ($opt_b) { "DomainMigratePrepare", "DomainMigratePrepare2", "DomainSnapshotListNames", - "FindStoragePoolSources", - "GetMaxVcpus", "GetType", "ListDefinedDomains", "ListDefinedInterfaces", @@ -299,7 +296,6 @@ elsif ($opt_b) { "NodeGetInfo", "NodeGetSecurityModel", "NodeListDevices", - "NodeNumOfDevices", "SecretGetValue", "StoragePoolGetInfo", "StoragePoolListVolumes", @@ -348,6 +344,7 @@ elsif ($opt_b) { my $has_node_device = 0; my @vars_list = (); + my @optionals_list = (); my @getters_list = (); my @args_list = (); my @ret_list = (); @@ -470,6 +467,10 @@ elsif ($opt_b) { if ($1 eq "remote_uuid") { push(@args_list, "(unsigned char *) args->$2"); + } elsif ($1 eq "remote_string") { + push(@vars_list, "char *$2"); + push(@optionals_list, "$2"); + push(@args_list, "$2"); } else { push(@args_list, "args->$2"); } @@ -619,6 +620,14 @@ elsif ($opt_b) { print "\n"; } + foreach my $optional (@optionals_list) { + print " $optional = args->$optional ? *args->$optional : NULL;\n"; + } + + if (@optionals_list) { + print "\n"; + } + if ($calls{$_}->{ret} eq "void") { print " if (vir$calls{$_}->{ProcName}("; print join(', ', @args_list); @@ -638,8 +647,10 @@ elsif ($opt_b) { } if ($calls{$_}->{ProcName} eq "GetSysinfo" or + $calls{$_}->{ProcName} eq "GetMaxVcpus" or $calls{$_}->{ProcName} eq "DomainXMLFromNative" or - $calls{$_}->{ProcName} eq "DomainXMLToNative") { + $calls{$_}->{ProcName} eq "DomainXMLToNative" or + $calls{$_}->{ProcName} eq "FindStoragePoolSources") { $prefix = "Connect" } elsif ($calls{$_}->{ProcName} eq "SupportsFeature") { $prefix = "Drv"