On Fri, Oct 02, 2015 at 10:52:42 +0300, Nikolay Shirokovskiy wrote:
Refactor dconnuri local server URI check to common API.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
src/libvirt-domain.c | 44 ++++++++++++++++++++++++--------------------
1 files changed, 24 insertions(+), 20 deletions(-)
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 697d58d..2e43062 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -3293,6 +3293,28 @@ virDomainMigrateVersion3Params(virDomainPtr domain,
}
+static int ATTRIBUTE_NONNULL(1)
+virDomainMigrateCheckNotLocal(const char *dconnuri)
+{
+ virURIPtr tempuri = NULL;
+ int ret = -1;
+
+ if (!(tempuri = virURIParse(dconnuri)))
+ goto cleanup;
+ if (!tempuri->server || STRPREFIX(tempuri->server, "localhost")) {
+ virReportInvalidArg(dconnuri, "%s",
+ _("Attempt to migrate guest to the same host
%s"));
+ goto cleanup;
+ }
+
+ ret = 0;
+ cleanup:
+
We usually put an empty line before the label, not after it.
+ virURIFree(tempuri);
+ return ret;
+}
Jirka