提交 59d13aae 编写于 作者: W Wen Congyang 提交者: Eric Blake

report error when specifying wrong desturi

When we do peer2peer migration, the dest uri is an address of the
target host as seen from the source machine. So we must specify
the ip or hostname of target host in dest uri. If we do not specify
it, report an error to the user.
Signed-off-by: NWen Congyang <wency@cn.fujitsu.com>
上级 0444ce1b
......@@ -3571,12 +3571,29 @@ virDomainMigratePeer2Peer (virDomainPtr domain,
const char *uri,
unsigned long bandwidth)
{
xmlURIPtr tempuri = NULL;
if (!domain->conn->driver->domainMigratePerform) {
virLibConnError (domain->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
virDispatchError(domain->conn);
return -1;
}
tempuri = xmlParseURI(uri);
if (!tempuri) {
virLibConnError (domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
virDispatchError(domain->conn);
return -1;
}
if (!tempuri->server || STRPREFIX(tempuri->server, "localhost")) {
virLibConnError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
virDispatchError(domain->conn);
xmlFreeURI(tempuri);
return -1;
}
xmlFreeURI(tempuri);
/* Perform the migration. The driver isn't supposed to return
* until the migration is complete.
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册