[Pkg-libvirt-commits] [SCM] Libguestfs Debian packaging branch, experimental, updated. debian/1%1.21.40-1
Richard W.M. Jones
rjones at redhat.com
Sat Jun 1 11:04:32 UTC 2013
The following commit has been merged in the experimental branch:
commit 2ce06ec808ce1c9ca9e6190f3ddc043b43e3b576
Author: Mike Kelly <pioto at pioto.org>
Date: Tue May 7 10:50:08 2013 -0400
rbd: send mon_host for rbd drives
This is how the servers are passed to kvm.
diff --git a/src/drives.c b/src/drives.c
index 0e62ca8..0a6d956 100644
--- a/src/drives.c
+++ b/src/drives.c
@@ -1086,12 +1086,37 @@ guestfs___drive_source_qemu_param (guestfs_h *g, const struct drive_source *src)
return ret;
}
- case drive_protocol_rbd:
- /* XXX Although libvirt allows multiple hosts to be specified,
- * it's unclear how these are ever passed to Ceph. Perhaps via
- * environment variables?
- */
- return safe_asprintf (g, "rbd:%s", src->u.exportname);
+ case drive_protocol_rbd: {
+ /* build the list of all the mon hosts */
+ CLEANUP_FREE char *mon_host = NULL;
+ size_t n = 0;
+ for (int i = 0; i < src->nr_servers; i++) {
+ n += strlen (src->servers[i].u.hostname);
+ n += 8; /* for slashes, colons, & port numbers */
+ }
+ n++; /* for \0 */
+ mon_host = safe_malloc (g, sizeof (char *) * n);
+ n = 0;
+ for (int i = 0; i < src->nr_servers; i++) {
+ for (int j = 0; j < strlen (src->servers[i].u.hostname); j++) {
+ mon_host[n++] = src->servers[i].u.hostname[j];
+ }
+ mon_host[n++] = '\\';
+ mon_host[n++] = ':';
+ CLEANUP_FREE char *port = safe_asprintf (g, "%d", src->servers[i].port);
+ for (int j = 0; j < strlen (port); j++) {
+ mon_host[n++] = port[j];
+ }
+ /* join each host with \; */
+ if (i != src->nr_servers - 1) {
+ mon_host[n++] = '\\';
+ mon_host[n++] = ';';
+ }
+ }
+ mon_host[n] = '\0';
+
+ return safe_asprintf (g, "rbd:%s:mon_host=%s", src->u.exportname, mon_host);
+ }
case drive_protocol_sheepdog:
if (src->nr_servers == 0)
--
Libguestfs Debian packaging
More information about the Pkg-libvirt-commits
mailing list