mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 21:34:54 +03:00
remote generator: Handle virDomainCreateWithFlags
Add special case code for updating a given domain object instead of returning a new one.
This commit is contained in:
parent
6df05081cb
commit
a125f82ff4
@ -893,36 +893,6 @@ cleanup:
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
remoteDispatchDomainCreateWithFlags(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_create_with_flags_args *args,
|
|
||||||
remote_domain_create_with_flags_ret *ret)
|
|
||||||
{
|
|
||||||
int rv = -1;
|
|
||||||
virDomainPtr dom = NULL;
|
|
||||||
|
|
||||||
if (!(dom = get_nonnull_domain(conn, args->dom)))
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (virDomainCreateWithFlags(dom, args->flags) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
make_nonnull_domain(&ret->dom, dom);
|
|
||||||
|
|
||||||
rv = 0;
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
if (rv < 0)
|
|
||||||
remoteDispatchError(rerr);
|
|
||||||
if (dom)
|
|
||||||
virDomainFree(dom);
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
remoteDispatchDomainGetSecurityLabel(struct qemud_server *server ATTRIBUTE_UNUSED,
|
remoteDispatchDomainGetSecurityLabel(struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||||
struct qemud_client *client ATTRIBUTE_UNUSED,
|
struct qemud_client *client ATTRIBUTE_UNUSED,
|
||||||
|
@ -450,6 +450,13 @@ elsif ($opt_b) {
|
|||||||
} elsif ($ret_member =~ m/^remote_nonnull_(domain|network|storage_pool|storage_vol|interface|node_device|secret|nwfilter|domain_snapshot) (\S+);/) {
|
} elsif ($ret_member =~ m/^remote_nonnull_(domain|network|storage_pool|storage_vol|interface|node_device|secret|nwfilter|domain_snapshot) (\S+);/) {
|
||||||
my $type_name = name_to_ProcName($1);
|
my $type_name = name_to_ProcName($1);
|
||||||
|
|
||||||
|
if ($call->{ProcName} eq "DomainCreateWithFlags") {
|
||||||
|
# SPECIAL: virDomainCreateWithFlags updates the given
|
||||||
|
# domain object instead of returning a new one
|
||||||
|
push(@ret_list, "make_nonnull_$1(&ret->$2, $2);");
|
||||||
|
$single_ret_var = undef;
|
||||||
|
$single_ret_by_ref = 1;
|
||||||
|
} else {
|
||||||
push(@vars_list, "vir${type_name}Ptr $2 = NULL");
|
push(@vars_list, "vir${type_name}Ptr $2 = NULL");
|
||||||
push(@ret_list, "make_nonnull_$1(&ret->$2, $2);");
|
push(@ret_list, "make_nonnull_$1(&ret->$2, $2);");
|
||||||
push(@free_list,
|
push(@free_list,
|
||||||
@ -458,6 +465,7 @@ elsif ($opt_b) {
|
|||||||
$single_ret_var = $2;
|
$single_ret_var = $2;
|
||||||
$single_ret_by_ref = 0;
|
$single_ret_by_ref = 0;
|
||||||
$single_ret_check = " == NULL";
|
$single_ret_check = " == NULL";
|
||||||
|
}
|
||||||
} elsif ($ret_member =~ m/^int (\S+)<(\S+)>;/) {
|
} elsif ($ret_member =~ m/^int (\S+)<(\S+)>;/) {
|
||||||
push(@vars_list, "int len");
|
push(@vars_list, "int len");
|
||||||
push(@ret_list, "ret->$1.$1_len = len;");
|
push(@ret_list, "ret->$1.$1_len = len;");
|
||||||
@ -679,7 +687,12 @@ elsif ($opt_b) {
|
|||||||
if ($single_ret_by_ref) {
|
if ($single_ret_by_ref) {
|
||||||
print " if (vir$prefix$proc_name(";
|
print " if (vir$prefix$proc_name(";
|
||||||
print join(', ', @args_list);
|
print join(', ', @args_list);
|
||||||
print ", &$single_ret_var) < 0)\n";
|
|
||||||
|
if (defined $single_ret_var) {
|
||||||
|
print ", &$single_ret_var";
|
||||||
|
}
|
||||||
|
|
||||||
|
print ") < 0)\n";
|
||||||
} else {
|
} else {
|
||||||
print " if (($single_ret_var = vir$prefix$proc_name(";
|
print " if (($single_ret_var = vir$prefix$proc_name(";
|
||||||
print join(', ', @args_list);
|
print join(', ', @args_list);
|
||||||
@ -979,6 +992,15 @@ elsif ($opt_k) {
|
|||||||
$priv_name = "${name}PrivateData";
|
$priv_name = "${name}PrivateData";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($call->{ProcName} eq "DomainCreateWithFlags") {
|
||||||
|
# SPECIAL: virDomainCreateWithFlags updates the given
|
||||||
|
# domain object instead of returning a new one
|
||||||
|
push(@ret_list, "dom->id = ret.dom.id;");
|
||||||
|
push(@ret_list, "xdr_free((xdrproc_t)xdr_$call->{ret}, (char *)&ret);");
|
||||||
|
push(@ret_list, "rv = 0;");
|
||||||
|
$single_ret_var = "int rv = -1";
|
||||||
|
$single_ret_type = "int";
|
||||||
|
} else {
|
||||||
if ($name eq "domain_snapshot") {
|
if ($name eq "domain_snapshot") {
|
||||||
push(@ret_list, "rv = get_nonnull_$name(dom, ret.$arg_name);");
|
push(@ret_list, "rv = get_nonnull_$name(dom, ret.$arg_name);");
|
||||||
} else {
|
} else {
|
||||||
@ -988,6 +1010,7 @@ elsif ($opt_k) {
|
|||||||
push(@ret_list, "xdr_free((xdrproc_t)xdr_$call->{ret}, (char *)&ret);");
|
push(@ret_list, "xdr_free((xdrproc_t)xdr_$call->{ret}, (char *)&ret);");
|
||||||
$single_ret_var = "vir${type_name}Ptr rv = NULL";
|
$single_ret_var = "vir${type_name}Ptr rv = NULL";
|
||||||
$single_ret_type = "vir${type_name}Ptr";
|
$single_ret_type = "vir${type_name}Ptr";
|
||||||
|
}
|
||||||
} elsif ($ret_member =~ m/^int (\S+);/) {
|
} elsif ($ret_member =~ m/^int (\S+);/) {
|
||||||
my $arg_name = $1;
|
my $arg_name = $1;
|
||||||
|
|
||||||
|
@ -2440,38 +2440,6 @@ done:
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
remoteDomainCreateWithFlags (virDomainPtr domain, unsigned int flags)
|
|
||||||
{
|
|
||||||
int rv = -1;
|
|
||||||
remote_domain_create_with_flags_args args;
|
|
||||||
remote_domain_create_with_flags_ret ret;
|
|
||||||
struct private_data *priv = domain->conn->privateData;
|
|
||||||
|
|
||||||
remoteDriverLock(priv);
|
|
||||||
|
|
||||||
make_nonnull_domain (&args.dom, domain);
|
|
||||||
args.flags = flags;
|
|
||||||
|
|
||||||
memset (&ret, 0, sizeof ret);
|
|
||||||
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS,
|
|
||||||
(xdrproc_t) xdr_remote_domain_create_with_flags_args,
|
|
||||||
(char *) &args,
|
|
||||||
(xdrproc_t) xdr_remote_domain_create_with_flags_ret,
|
|
||||||
(char *) &ret) == -1)
|
|
||||||
goto done;
|
|
||||||
|
|
||||||
domain->id = ret.dom.id;
|
|
||||||
xdr_free ((xdrproc_t) &xdr_remote_domain_create_with_flags_ret,
|
|
||||||
(char *) &ret);
|
|
||||||
|
|
||||||
rv = 0;
|
|
||||||
|
|
||||||
done:
|
|
||||||
remoteDriverUnlock(priv);
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
remoteDomainGetSchedulerType (virDomainPtr domain, int *nparams)
|
remoteDomainGetSchedulerType (virDomainPtr domain, int *nparams)
|
||||||
{
|
{
|
||||||
|
@ -2270,7 +2270,7 @@ enum remote_procedure {
|
|||||||
REMOTE_PROC_DOMAIN_SNAPSHOT_DELETE = 193, /* autogen autogen */
|
REMOTE_PROC_DOMAIN_SNAPSHOT_DELETE = 193, /* autogen autogen */
|
||||||
REMOTE_PROC_DOMAIN_GET_BLOCK_INFO = 194, /* autogen autogen */
|
REMOTE_PROC_DOMAIN_GET_BLOCK_INFO = 194, /* autogen autogen */
|
||||||
REMOTE_PROC_DOMAIN_EVENT_IO_ERROR_REASON = 195, /* autogen autogen */
|
REMOTE_PROC_DOMAIN_EVENT_IO_ERROR_REASON = 195, /* autogen autogen */
|
||||||
REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS = 196, /* skipgen skipgen */
|
REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS = 196, /* autogen autogen */
|
||||||
REMOTE_PROC_DOMAIN_SET_MEMORY_PARAMETERS = 197, /* skipgen skipgen */
|
REMOTE_PROC_DOMAIN_SET_MEMORY_PARAMETERS = 197, /* skipgen skipgen */
|
||||||
REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS = 198, /* skipgen skipgen */
|
REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS = 198, /* skipgen skipgen */
|
||||||
REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS = 199, /* autogen autogen */
|
REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS = 199, /* autogen autogen */
|
||||||
|
Loading…
Reference in New Issue
Block a user