Revision 60beb341

b/block/iscsi.c
1003 1003
    return ret;
1004 1004
}
1005 1005

  
1006
/* TODO Convert to fine grained options */
1007
static QemuOptsList runtime_opts = {
1008
    .name = "iscsi",
1009
    .head = QTAILQ_HEAD_INITIALIZER(runtime_opts.head),
1010
    .desc = {
1011
        {
1012
            .name = "filename",
1013
            .type = QEMU_OPT_STRING,
1014
            .help = "URL to the iscsi image",
1015
        },
1016
        { /* end of list */ }
1017
    },
1018
};
1019

  
1006 1020
/*
1007 1021
 * We support iscsi url's on the form
1008 1022
 * iscsi://[<username>%<password>@]<host>[:<port>]/<targetname>/<lun>
1009 1023
 */
1010
static int iscsi_open(BlockDriverState *bs, const char *filename,
1024
static int iscsi_open(BlockDriverState *bs, const char *dummy,
1011 1025
                      QDict *options, int flags)
1012 1026
{
1013 1027
    IscsiLun *iscsilun = bs->opaque;
......
1016 1030
    struct scsi_task *task = NULL;
1017 1031
    struct scsi_inquiry_standard *inq = NULL;
1018 1032
    char *initiator_name = NULL;
1033
    QemuOpts *opts;
1034
    Error *local_err = NULL;
1035
    const char *filename;
1019 1036
    int ret;
1020 1037

  
1021 1038
    if ((BDRV_SECTOR_SIZE % 512) != 0) {
......
1025 1042
        return -EINVAL;
1026 1043
    }
1027 1044

  
1045
    opts = qemu_opts_create_nofail(&runtime_opts);
1046
    qemu_opts_absorb_qdict(opts, options, &local_err);
1047
    if (error_is_set(&local_err)) {
1048
        qerror_report_err(local_err);
1049
        error_free(local_err);
1050
        ret = -EINVAL;
1051
        goto out;
1052
    }
1053

  
1054
    filename = qemu_opt_get(opts, "filename");
1055

  
1056

  
1028 1057
    iscsi_url = iscsi_parse_full_url(iscsi, filename);
1029 1058
    if (iscsi_url == NULL) {
1030 1059
        error_report("Failed to parse URL : %s", filename);
......
1126 1155
#endif
1127 1156

  
1128 1157
out:
1158
    qemu_opts_del(opts);
1129 1159
    if (initiator_name != NULL) {
1130 1160
        g_free(initiator_name);
1131 1161
    }
......
1190 1220
    int64_t total_size = 0;
1191 1221
    BlockDriverState bs;
1192 1222
    IscsiLun *iscsilun = NULL;
1223
    QDict *bs_options;
1193 1224

  
1194 1225
    memset(&bs, 0, sizeof(BlockDriverState));
1195 1226

  
......
1204 1235
    bs.opaque = g_malloc0(sizeof(struct IscsiLun));
1205 1236
    iscsilun = bs.opaque;
1206 1237

  
1207
    ret = iscsi_open(&bs, filename, NULL, 0);
1238
    bs_options = qdict_new();
1239
    qdict_put(bs_options, "filename", qstring_from_str(filename));
1240
    ret = iscsi_open(&bs, NULL, bs_options, 0);
1241
    QDECREF(bs_options);
1242

  
1208 1243
    if (ret != 0) {
1209 1244
        goto out;
1210 1245
    }

Also available in: Unified diff