mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
Change name of the domain upon successful rename
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
e755186c5c
commit
53704bf24e
@ -8038,6 +8038,47 @@ remoteDomainInterfaceAddresses(virDomainPtr dom,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
remoteDomainRename(virDomainPtr dom, const char *new_name, unsigned int flags)
|
||||
{
|
||||
int rv = -1;
|
||||
struct private_data *priv = dom->conn->privateData;
|
||||
remote_domain_rename_args args;
|
||||
remote_domain_rename_ret ret;
|
||||
char *tmp = NULL;
|
||||
|
||||
if (VIR_STRDUP(tmp, new_name) < 0)
|
||||
return -1;
|
||||
|
||||
remoteDriverLock(priv);
|
||||
|
||||
make_nonnull_domain(&args.dom, dom);
|
||||
args.new_name = new_name ? (char **)&new_name : NULL;
|
||||
args.flags = flags;
|
||||
|
||||
memset(&ret, 0, sizeof(ret));
|
||||
|
||||
if (call(dom->conn, priv, 0, REMOTE_PROC_DOMAIN_RENAME,
|
||||
(xdrproc_t)xdr_remote_domain_rename_args, (char *)&args,
|
||||
(xdrproc_t)xdr_remote_domain_rename_ret, (char *)&ret) == -1) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
rv = ret.retcode;
|
||||
|
||||
if (rv == 0) {
|
||||
VIR_FREE(dom->name);
|
||||
dom->name = tmp;
|
||||
tmp = NULL;
|
||||
}
|
||||
|
||||
done:
|
||||
remoteDriverUnlock(priv);
|
||||
VIR_FREE(tmp);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
/* get_nonnull_domain and get_nonnull_network turn an on-wire
|
||||
* (name, uuid) pair into virDomainPtr or virNetworkPtr object.
|
||||
* These can return NULL if underlying memory allocations fail,
|
||||
|
@ -5708,7 +5708,7 @@ enum remote_procedure {
|
||||
REMOTE_PROC_DOMAIN_SET_USER_PASSWORD = 357,
|
||||
|
||||
/**
|
||||
* @generate: both
|
||||
* @generate: server
|
||||
* @acl: domain:write
|
||||
* @acl: domain:save
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user