1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-11 09:17:52 +03:00

remote generator, client: Add more special case handling

For virDomainDestroy and virDrvSupportsFeature.
This commit is contained in:
Matthias Bolte 2011-05-14 15:56:03 +02:00
parent 0882f7a200
commit 55cb8f5baa
3 changed files with 16 additions and 57 deletions

View File

@ -1065,6 +1065,15 @@ elsif ($opt_k) {
print "\n";
print " remoteDriverLock(priv);\n";
if ($call->{ProcName} eq "SupportsFeature") {
# SPECIAL: VIR_DRV_FEATURE_REMOTE feature is handled directly
print "\n";
print " if (feature == VIR_DRV_FEATURE_REMOTE) {\n";
print " rv = 1;\n";
print " goto done;\n";
print " }\n";
}
foreach my $args_check (@args_check_list) {
print "\n";
print " if ($args_check->{arg} > $args_check->{limit}) {\n";
@ -1140,6 +1149,11 @@ elsif ($opt_k) {
print "\n";
}
if ($call->{ProcName} eq "DomainDestroy") {
# SPECIAL: virDomainDestroy needs to reset the domain id explicitly
print " dom->id = -1;\n";
}
if ($multi_ret or !@ret_list) {
print " rv = 0;\n";
}

View File

@ -1591,37 +1591,6 @@ remoteClose (virConnectPtr conn)
return ret;
}
static int
remoteSupportsFeature (virConnectPtr conn, int feature)
{
int rv = -1;
remote_supports_feature_args args;
remote_supports_feature_ret ret;
struct private_data *priv = conn->privateData;
remoteDriverLock(priv);
/* VIR_DRV_FEATURE_REMOTE* features are handled directly. */
if (feature == VIR_DRV_FEATURE_REMOTE) {
rv = 1;
goto done;
}
args.feature = feature;
memset (&ret, 0, sizeof ret);
if (call (conn, priv, 0, REMOTE_PROC_SUPPORTS_FEATURE,
(xdrproc_t) xdr_remote_supports_feature_args, (char *) &args,
(xdrproc_t) xdr_remote_supports_feature_ret, (char *) &ret) == -1)
goto done;
rv = ret.supported;
done:
remoteDriverUnlock(priv);
return rv;
}
/* Unfortunately this function is defined to return a static string.
* Since the remote end always answers with the same type (for a
* single connection anyway) we cache the type in the connection's
@ -1811,30 +1780,6 @@ done:
return rv;
}
static int
remoteDomainDestroy (virDomainPtr domain)
{
int rv = -1;
remote_domain_destroy_args args;
struct private_data *priv = domain->conn->privateData;
remoteDriverLock(priv);
make_nonnull_domain (&args.dom, domain);
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_DESTROY,
(xdrproc_t) xdr_remote_domain_destroy_args, (char *) &args,
(xdrproc_t) xdr_void, (char *) NULL) == -1)
goto done;
rv = 0;
domain->id = -1;
done:
remoteDriverUnlock(priv);
return rv;
}
static int
remoteDomainSetMemoryParameters (virDomainPtr domain,
virMemoryParameterPtr params,

View File

@ -2058,7 +2058,7 @@ enum remote_procedure {
REMOTE_PROC_DOMAIN_CREATE_XML = 10, /* autogen autogen */
REMOTE_PROC_DOMAIN_DEFINE_XML = 11, /* autogen autogen */
REMOTE_PROC_DOMAIN_DESTROY = 12, /* autogen skipgen */
REMOTE_PROC_DOMAIN_DESTROY = 12, /* autogen autogen */
REMOTE_PROC_DOMAIN_DETACH_DEVICE = 13, /* autogen autogen */
REMOTE_PROC_DOMAIN_GET_XML_DESC = 14, /* autogen autogen */
REMOTE_PROC_DOMAIN_GET_AUTOSTART = 15, /* autogen autogen */
@ -2110,7 +2110,7 @@ enum remote_procedure {
REMOTE_PROC_DOMAIN_GET_SCHEDULER_PARAMETERS = 57, /* skipgen skipgen */
REMOTE_PROC_DOMAIN_SET_SCHEDULER_PARAMETERS = 58, /* skipgen skipgen */
REMOTE_PROC_GET_HOSTNAME = 59, /* autogen autogen */
REMOTE_PROC_SUPPORTS_FEATURE = 60, /* autogen skipgen */
REMOTE_PROC_SUPPORTS_FEATURE = 60, /* autogen autogen */
REMOTE_PROC_DOMAIN_MIGRATE_PREPARE = 61, /* skipgen skipgen */
REMOTE_PROC_DOMAIN_MIGRATE_PERFORM = 62, /* autogen autogen */