qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [PATCH RFC v2 2/6] replication: add shared-disk and sha


From: Hailiang Zhang
Subject: Re: [Qemu-block] [PATCH RFC v2 2/6] replication: add shared-disk and shared-disk-id options
Date: Wed, 18 Jan 2017 14:54:56 +0800
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1

On 2017/1/17 19:25, Stefan Hajnoczi wrote:
On Mon, Dec 05, 2016 at 04:35:00PM +0800, zhanghailiang wrote:
@@ -85,6 +99,9 @@ static int replication_open(BlockDriverState *bs, QDict 
*options,
      QemuOpts *opts = NULL;
      const char *mode;
      const char *top_id;
+    const char *shared_disk_id;
+    BlockBackend *blk;
+    BlockDriverState *tmp_bs;

      ret = -EINVAL;
      opts = qemu_opts_create(&replication_runtime_opts, NULL, 0, &error_abort);
@@ -119,6 +136,25 @@ static int replication_open(BlockDriverState *bs, QDict 
*options,
                     "The option mode's value should be primary or secondary");
          goto fail;
      }
+    s->is_shared_disk = qemu_opt_get_bool(opts, REPLICATION_SHARED_DISK,
+                                          false);
+    if (s->is_shared_disk && (s->mode == REPLICATION_MODE_PRIMARY)) {
+        shared_disk_id = qemu_opt_get(opts, REPLICATION_SHARED_DISK_ID);
+        if (!shared_disk_id) {
+            error_setg(&local_err, "Missing shared disk blk");
+            goto fail;
+        }
+        s->shared_disk_id = g_strdup(shared_disk_id);
+        blk = blk_by_name(s->shared_disk_id);
+        if (!blk) {
+            g_free(s->shared_disk_id);
+            error_setg(&local_err, "There is no %s block", s->shared_disk_id);
+            goto fail;

Please move the g_free() to the fail label to prevent future code
changes from introducing a memory leak.


OK, I will fix it in next version, thanks very much.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]