From 55cb8f5baa04c0315a6b35c1b43fb924943f4580 Mon Sep 17 00:00:00 2001 From: Matthias Bolte Date: Sat, 14 May 2011 15:56:03 +0200 Subject: [PATCH] remote generator, client: Add more special case handling For virDomainDestroy and virDrvSupportsFeature. --- daemon/remote_generator.pl | 14 +++++++++ src/remote/remote_driver.c | 55 ------------------------------------ src/remote/remote_protocol.x | 4 +-- 3 files changed, 16 insertions(+), 57 deletions(-) diff --git a/daemon/remote_generator.pl b/daemon/remote_generator.pl index dd5d482f6c..a3b842161e 100755 --- a/daemon/remote_generator.pl +++ b/daemon/remote_generator.pl @@ -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"; } diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 409f36ed58..08f5046a71 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -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, diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index 63fc778fcb..1ce77e39bc 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -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 */