提交 55cb8f5b 编写于 作者: M Matthias Bolte

remote generator, client: Add more special case handling

For virDomainDestroy and virDrvSupportsFeature.
上级 0882f7a2
......@@ -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";
}
......
......@@ -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,
......
......@@ -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 */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册