yeahuh / rpms / qemu-kvm

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