提交 53704bf2 编写于 作者: M Martin Kletzander

Change name of the domain upon successful rename

Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
上级 e755186c
......@@ -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
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册