From 8110a8249d1b3c48f69d642d15d4894b7fcf05c4 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 21 Mar 2013 12:53:51 +0100 Subject: [PATCH] domain: make port optional for network disks Only sheepdog actually required it in the code, and we can use 7000 as the default---the same value that QEMU uses for the simple "sheepdog:VOLUME" syntax. With this change, the schema can be fixed to allow no port. Signed-off-by: Paolo Bonzini --- docs/formatdomain.html.in | 6 ++++++ docs/schemas/domaincommon.rng | 8 +++++--- src/conf/domain_conf.c | 5 ----- src/qemu/qemu_command.c | 3 ++- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index f17b808e9b..fd3381827c 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1700,31 +1700,37 @@ Protocol Meaning Number of hosts + Default port nbd a server running nbd-server only one + 10809 iscsi an iSCSI server only one + 3260 rbd monitor servers of RBD one or more + 6789 sheepdog one of the sheepdog servers (default is localhost:7000) zero or one + 7000 gluster a server running glusterd daemon only one + 24007 gluster supports "tcp", "rdma", "unix" as valid values for the diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 3240e1cd8c..1b49b5aee2 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -1114,9 +1114,11 @@ - - - + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b06cae5793..8f76e8eacd 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4111,11 +4111,6 @@ virDomainDiskDefParseXML(virCapsPtr caps, goto error; } hosts[nhosts - 1].port = virXMLPropString(child, "port"); - if (!hosts[nhosts - 1].port) { - virReportError(VIR_ERR_XML_ERROR, - "%s", _("missing port for host")); - goto error; - } } } child = child->next; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 313db2ca6e..5422508ffb 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2763,7 +2763,8 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED, } else { /* only one host is supported now */ virBufferAsprintf(&opt, "file=sheepdog:%s:%s:", - disk->hosts->name, disk->hosts->port); + disk->hosts->name, + disk->hosts->port ? disk->hosts->port : "7000"); virBufferEscape(&opt, ',', ",", "%s,", disk->src); } break; -- 2.47.2