Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3f9cd01867 | |||
| a7a6d5f38e |
@@ -75,6 +75,9 @@ Vitastor поддерживает QEMU-драйвер, протоколы UBLK,
|
||||
- [NFS](docs/usage/nfs.ru.md) кластерная файловая система и псевдо-ФС прокси
|
||||
- [Безопасность](docs/usage/security.ru.md)
|
||||
- [Администрирование](docs/usage/admin.ru.md)
|
||||
- Тесты
|
||||
- [Хаос тест хранилища](docs/tests/blockstore-chaos.ru.md)
|
||||
- [Хаос тест PG](docs/tests/pg-chaos.ru.md)
|
||||
- Производительность
|
||||
- [Понимание сути производительности](docs/performance/understanding.ru.md)
|
||||
- [Теоретический максимум](docs/performance/theoretical.ru.md)
|
||||
|
||||
@@ -622,6 +622,11 @@ end_free:
|
||||
close(fd);
|
||||
}
|
||||
|
||||
static void vitastor_err_exit(void *opaque, int retval, const char *errstr)
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static int vitastor_file_open(BlockDriverState *bs, QDict *options, int flags, Error **errp)
|
||||
{
|
||||
VitastorRPC task;
|
||||
@@ -659,7 +664,9 @@ static int vitastor_file_open(BlockDriverState *bs, QDict *options, int flags, E
|
||||
strarray_push_kv(&opt, "rdma_gid_index", qdict_get_try_str(options, "rdma-gid-index"));
|
||||
strarray_push_kv(&opt, "rdma_mtu", qdict_get_try_str(options, "rdma-mtu"));
|
||||
strarray_push_kv(&opt, "client_writeback_allowed", (flags & BDRV_O_NOCACHE) ? "0" : "1");
|
||||
#if defined VITASTOR_C_API_VERSION && VITASTOR_C_API_VERSION >= 6
|
||||
strarray_push_kv(&opt, "client_exit_on_error", "0");
|
||||
#endif
|
||||
strarray_push_kv(&opt, "__version_check_buffer", version_buffer);
|
||||
client->proxy = vitastor_c_create_uring_json(opt.items, opt.len);
|
||||
client->auto_loop = 0;
|
||||
@@ -716,6 +723,7 @@ static int vitastor_file_open(BlockDriverState *bs, QDict *options, int flags, E
|
||||
#endif
|
||||
BDRV_POLL_WHILE(bs, !task.complete);
|
||||
}
|
||||
#if defined VITASTOR_C_API_VERSION && VITASTOR_C_API_VERSION >= 6
|
||||
if ((ret = vitastor_c_is_failed(client->proxy, &errstr)))
|
||||
{
|
||||
error_setg(errp, errstr);
|
||||
@@ -723,6 +731,8 @@ static int vitastor_file_open(BlockDriverState *bs, QDict *options, int flags, E
|
||||
vitastor_close(bs);
|
||||
return -ret;
|
||||
}
|
||||
vitastor_c_on_fatal_error(client->proxy, vitastor_err_exit, NULL);
|
||||
#endif
|
||||
client->image = image;
|
||||
if (client->image)
|
||||
{
|
||||
|
||||
@@ -251,6 +251,14 @@ int vitastor_c_is_failed(vitastor_c *client, char **errstr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void vitastor_c_on_fatal_error(vitastor_c *client, VitastorErrorHandler cb, void *opaque)
|
||||
{
|
||||
client->cli->set_on_fatal_error_hook([=](int retval, const std::string & error)
|
||||
{
|
||||
cb(opaque, retval, error.c_str());
|
||||
});
|
||||
}
|
||||
|
||||
void vitastor_c_on_ready(vitastor_c *client, VitastorIOHandler cb, void *opaque)
|
||||
{
|
||||
client->cli->on_ready([=]()
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#define VITASTOR_QEMU_PROXY_H
|
||||
|
||||
// C API wrapper version
|
||||
#define VITASTOR_C_API_VERSION 5
|
||||
#define VITASTOR_C_API_VERSION 6
|
||||
|
||||
#ifndef POOL_ID_BITS
|
||||
#define POOL_ID_BITS 16
|
||||
@@ -33,6 +33,7 @@ typedef struct vitastor_c vitastor_c;
|
||||
|
||||
typedef void VitastorReadHandler(void *opaque, long retval, uint64_t version);
|
||||
typedef void VitastorIOHandler(void *opaque, long retval);
|
||||
typedef void VitastorErrorHandler(void *opaque, int retval, const char *errstr);
|
||||
typedef void VitastorReadBitmapHandler(void *opaque, long retval, uint8_t *bitmap);
|
||||
|
||||
// QEMU
|
||||
@@ -54,6 +55,7 @@ void* vitastor_c_get_internal_client(vitastor_c *client);
|
||||
void vitastor_c_destroy(vitastor_c *client);
|
||||
int vitastor_c_is_ready(vitastor_c *client);
|
||||
int vitastor_c_is_failed(vitastor_c *client, char **errstr);
|
||||
void vitastor_c_on_fatal_error(vitastor_c *client, VitastorErrorHandler cb, void *opaque);
|
||||
void vitastor_c_on_ready(vitastor_c *client, VitastorIOHandler cb, void *opaque);
|
||||
int vitastor_c_uring_register_eventfd(vitastor_c *client);
|
||||
void vitastor_c_uring_wait_ready(vitastor_c *client);
|
||||
|
||||
Reference in New Issue
Block a user