]> xenbits.xensource.com Git - people/pauldu/qemu.git/commitdiff
nbd: use "" as a default export name if none provided
authorDaniel P. Berrange <berrange@redhat.com>
Wed, 10 Feb 2016 18:41:10 +0000 (18:41 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 16 Feb 2016 16:16:20 +0000 (17:16 +0100)
If the user does not provide an export name and the server
is running the new style protocol, where export names are
mandatory, use "" as the default export name if the user
has not specified any. "" is defined in the NBD protocol
as the default name to use in such scenarios.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1455129674-17255-13-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
nbd/client.c
nbd/server.c

index be5f08da469fa278d305418afa16b4bf6de0e758..5e47ac7792df04d19be9f26ded82d2fdf81eb82e 100644 (file)
@@ -315,8 +315,8 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint32_t *flags,
             goto fail;
         }
         if (!name) {
-            error_setg(errp, "Server requires an export name");
-            goto fail;
+            TRACE("Using default NBD export name \"\"");
+            name = "";
         }
         if (fixedNewStyle) {
             /* Check our desired export is present in the
index 3d2fb1055fe023334b1b061d808622bf1b55c63b..9fee1d4fa4eec4e5d350a82f11443109b5f9eeb3 100644 (file)
@@ -220,6 +220,7 @@ static int nbd_negotiate_send_rep_list(QIOChannel *ioc, NBDExport *exp)
     uint64_t magic, name_len;
     uint32_t opt, type, len;
 
+    TRACE("Advertizing export name '%s'", exp->name ? exp->name : "");
     name_len = strlen(exp->name);
     magic = cpu_to_be64(NBD_REP_MAGIC);
     if (nbd_negotiate_write(ioc, &magic, sizeof(magic)) != sizeof(magic)) {