Browse Source

Some config parsing fixes

master
Vitaliy Filippov 2 months ago
parent
commit
818ae5d61d
  1. 3
      src/messenger.cpp
  2. 2
      src/osd.cpp
  3. 6
      src/qemu_driver.c
  4. 2
      tests/test_vm_start.sh

3
src/messenger.cpp

@ -525,7 +525,8 @@ json11::Json osd_messenger_t::read_config(const json11::Json & config)
int fd = open(config_path, O_RDONLY);
if (fd < 0)
{
fprintf(stderr, "Error reading %s: %s\n", config_path, strerror(errno));
if (errno != ENOENT)
fprintf(stderr, "Error reading %s: %s\n", config_path, strerror(errno));
return config;
}
struct stat st;

2
src/osd.cpp

@ -112,6 +112,8 @@ void osd_t::parse_config(const json11::Json & config)
immediate_commit = IMMEDIATE_ALL;
else if (config["immediate_commit"] == "small")
immediate_commit = IMMEDIATE_SMALL;
else
immediate_commit = IMMEDIATE_NONE;
if (!config["autosync_interval"].is_null())
{
// Allow to set it to 0

6
src/qemu_driver.c

@ -199,9 +199,9 @@ static int vitastor_file_open(BlockDriverState *bs, QDict *options, int flags, E
client->etcd_host = g_strdup(qdict_get_try_str(options, "etcd_host"));
client->etcd_prefix = g_strdup(qdict_get_try_str(options, "etcd_prefix"));
client->rdma_device = g_strdup(qdict_get_try_str(options, "rdma_device"));
client->rdma_port_num = qdict_get_int(options, "rdma_port_num");
client->rdma_gid_index = qdict_get_int(options, "rdma_gid_index");
client->rdma_mtu = qdict_get_int(options, "rdma_mtu");
client->rdma_port_num = qdict_get_try_int(options, "rdma_port_num", 0);
client->rdma_gid_index = qdict_get_try_int(options, "rdma_gid_index", 0);
client->rdma_mtu = qdict_get_try_int(options, "rdma_mtu", 0);
client->proxy = vitastor_proxy_create(
bdrv_get_aio_context(bs), client->config_path, client->etcd_host, client->etcd_prefix,
client->rdma_device, client->rdma_port_num, client->rdma_gid_index, client->rdma_mtu

2
tests/test_vm_start.sh

@ -46,7 +46,7 @@ $ETCDCTL put /vitastor/config/inode/1/1 '{"name":"debian9@0","size":'$((2048*102
$ETCDCTL put /vitastor/config/inode/1/2 '{"parent_id":1,"name":"debian9","size":'$((2048*1024*1024))'}'
qemu-system-x86_64 -enable-kvm -m 1024 \
-drive 'file=vitastor:etcd_host=127.0.0.1\:$ETCD_PORT/v3:image=debian9',format=raw,if=none,id=drive-virtio-disk0,cache=none \
-drive 'file=vitastor:etcd_host=127.0.0.1\:'$ETCD_PORT'/v3:image=debian9',format=raw,if=none,id=drive-virtio-disk0,cache=none \
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1,write-cache=off,physical_block_size=4096,logical_block_size=512 \
-vnc 0.0.0.0:0

Loading…
Cancel
Save