thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
ddf19c
From 58b7d33e1bc17b89103ceaa39f5722a69b35d810 Mon Sep 17 00:00:00 2001
ddf19c
From: Maxim Levitsky <mlevitsk@redhat.com>
ddf19c
Date: Wed, 11 Mar 2020 10:51:45 +0000
ddf19c
Subject: [PATCH 04/20] iscsi: Drop iscsi_co_create_opts()
ddf19c
ddf19c
RH-Author: Maxim Levitsky <mlevitsk@redhat.com>
ddf19c
Message-id: <20200311105147.13208-5-mlevitsk@redhat.com>
ddf19c
Patchwork-id: 94226
ddf19c
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 4/6] iscsi: Drop iscsi_co_create_opts()
ddf19c
Bugzilla: 1640894
ddf19c
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
ddf19c
RH-Acked-by: John Snow <jsnow@redhat.com>
ddf19c
RH-Acked-by: Max Reitz <mreitz@redhat.com>
ddf19c
ddf19c
From: Max Reitz <mreitz@redhat.com>
ddf19c
ddf19c
The generic fallback implementation effectively does the same.
ddf19c
ddf19c
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
ddf19c
Signed-off-by: Max Reitz <mreitz@redhat.com>
ddf19c
Message-Id: <20200122164532.178040-5-mreitz@redhat.com>
ddf19c
Signed-off-by: Max Reitz <mreitz@redhat.com>
ddf19c
(cherry picked from commit 80f0900905b555f00d644894c786b6d66ac2e00e)
ddf19c
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
ddf19c
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ddf19c
---
ddf19c
 block/iscsi.c | 56 --------------------------------------------------------
ddf19c
 1 file changed, 56 deletions(-)
ddf19c
ddf19c
diff --git a/block/iscsi.c b/block/iscsi.c
ddf19c
index cbd5729..b45da65 100644
ddf19c
--- a/block/iscsi.c
ddf19c
+++ b/block/iscsi.c
ddf19c
@@ -2164,58 +2164,6 @@ static int coroutine_fn iscsi_co_truncate(BlockDriverState *bs, int64_t offset,
ddf19c
     return 0;
ddf19c
 }
ddf19c
 
ddf19c
-static int coroutine_fn iscsi_co_create_opts(const char *filename, QemuOpts *opts,
ddf19c
-                                             Error **errp)
ddf19c
-{
ddf19c
-    int ret = 0;
ddf19c
-    int64_t total_size = 0;
ddf19c
-    BlockDriverState *bs;
ddf19c
-    IscsiLun *iscsilun = NULL;
ddf19c
-    QDict *bs_options;
ddf19c
-    Error *local_err = NULL;
ddf19c
-
ddf19c
-    bs = bdrv_new();
ddf19c
-
ddf19c
-    /* Read out options */
ddf19c
-    total_size = DIV_ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0),
ddf19c
-                              BDRV_SECTOR_SIZE);
ddf19c
-    bs->opaque = g_new0(struct IscsiLun, 1);
ddf19c
-    iscsilun = bs->opaque;
ddf19c
-
ddf19c
-    bs_options = qdict_new();
ddf19c
-    iscsi_parse_filename(filename, bs_options, &local_err);
ddf19c
-    if (local_err) {
ddf19c
-        error_propagate(errp, local_err);
ddf19c
-        ret = -EINVAL;
ddf19c
-    } else {
ddf19c
-        ret = iscsi_open(bs, bs_options, 0, NULL);
ddf19c
-    }
ddf19c
-    qobject_unref(bs_options);
ddf19c
-
ddf19c
-    if (ret != 0) {
ddf19c
-        goto out;
ddf19c
-    }
ddf19c
-    iscsi_detach_aio_context(bs);
ddf19c
-    if (iscsilun->type != TYPE_DISK) {
ddf19c
-        ret = -ENODEV;
ddf19c
-        goto out;
ddf19c
-    }
ddf19c
-    if (bs->total_sectors < total_size) {
ddf19c
-        ret = -ENOSPC;
ddf19c
-        goto out;
ddf19c
-    }
ddf19c
-
ddf19c
-    ret = 0;
ddf19c
-out:
ddf19c
-    if (iscsilun->iscsi != NULL) {
ddf19c
-        iscsi_destroy_context(iscsilun->iscsi);
ddf19c
-    }
ddf19c
-    g_free(bs->opaque);
ddf19c
-    bs->opaque = NULL;
ddf19c
-    bdrv_unref(bs);
ddf19c
-    return ret;
ddf19c
-}
ddf19c
-
ddf19c
 static int iscsi_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
ddf19c
 {
ddf19c
     IscsiLun *iscsilun = bs->opaque;
ddf19c
@@ -2486,8 +2434,6 @@ static BlockDriver bdrv_iscsi = {
ddf19c
     .bdrv_parse_filename    = iscsi_parse_filename,
ddf19c
     .bdrv_file_open         = iscsi_open,
ddf19c
     .bdrv_close             = iscsi_close,
ddf19c
-    .bdrv_co_create_opts    = iscsi_co_create_opts,
ddf19c
-    .create_opts            = &iscsi_create_opts,
ddf19c
     .bdrv_reopen_prepare    = iscsi_reopen_prepare,
ddf19c
     .bdrv_reopen_commit     = iscsi_reopen_commit,
ddf19c
     .bdrv_co_invalidate_cache = iscsi_co_invalidate_cache,
ddf19c
@@ -2525,8 +2471,6 @@ static BlockDriver bdrv_iser = {
ddf19c
     .bdrv_parse_filename    = iscsi_parse_filename,
ddf19c
     .bdrv_file_open         = iscsi_open,
ddf19c
     .bdrv_close             = iscsi_close,
ddf19c
-    .bdrv_co_create_opts    = iscsi_co_create_opts,
ddf19c
-    .create_opts            = &iscsi_create_opts,
ddf19c
     .bdrv_reopen_prepare    = iscsi_reopen_prepare,
ddf19c
     .bdrv_reopen_commit     = iscsi_reopen_commit,
ddf19c
     .bdrv_co_invalidate_cache  = iscsi_co_invalidate_cache,
ddf19c
-- 
ddf19c
1.8.3.1
ddf19c