This implement handling of <source domain=''/> parameter introduced in
previous patch.
Lookup on domain name (to get domain ID) requires libxlDriverPrivate
object, so it must be passed down to libxlMakeDisk and libxlMakeNet from
top level callers.
Signed-off-by: Marek Marczykowski-Górecki <marmarek(a)invisiblethingslab.com>
---
Changes in v2:
- rebase on 1.0.6+
- fix indentation
- make libxl_name_to_domid switch more defensive
Changes in v3:
- rebase on 1.2.12+
- leave name->XID resolution to libxl itself, which greatly simplify
the code (but requires Xen at least 4.3)
src/libxl/libxl_conf.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 0555b91..1811a83 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -971,6 +971,18 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk, libxl_device_disk *x_disk)
return -1;
}
+ if (l_disk->src->domain_name) {
+#ifdef LIBXL_HAVE_DEVICE_BACKEND_DOMNAME
+ if (VIR_STRDUP(x_disk->backend_domname, l_disk->src->domain_name) <
0)
+ return -1;
+#else
+ virReportError(VIR_ERR_XML_DETAIL, "%s",
+ _("this version of libxenlight does not "
+ "support backend domain name"));
+ return -1;
+#endif
+ }
+
return 0;
}
@@ -1098,6 +1110,18 @@ libxlMakeNic(virDomainDefPtr def,
return -1;
}
+ if (l_nic->domain_name) {
+#ifdef LIBXL_HAVE_DEVICE_BACKEND_DOMNAME
+ if (VIR_STRDUP(x_nic->backend_domname, l_nic->domain_name) < 0)
+ return -1;
+#else
+ virReportError(VIR_ERR_XML_DETAIL, "%s",
+ _("this version of libxenlight does not "
+ "support backend domain name"));
+ return -1;
+#endif
+ }
+
return 0;
}
--
1.8.3.1