Author | 李峰 |
---|---|
Date | 2020-08-28 |
lifeng68@huawei.com |
The Driver module needs to support overlay2 and devicemapper drivers to achieve the following functions:
The quota function also needs to be implemented for the overlay2 driver.
int graphdriver_init(const char *name, const char *isulad_root, char **storage_opts,
size_t storage_opts_len);
int graphdriver_create_rw(const char *id, const char *parent, struct driver_create_opts *create_opts);
int graphdriver_create_ro(const char *id, const char *parent, const struct driver_create_opts *create_opts);
int graphdriver_rm_layer(const char *id)
char *graphdriver_mount_layer(const char *id, const struct driver_mount_opts *mount_opts)
int graphdriver_umount_layer(const char *id)
bool graphdriver_layer_exists(const char *id)
int graphdriver_apply_diff(const char *id, const struct io_read_wrapper *content, int64_t *layer_size)
int graphdriver_get_layer_metadata(const char *id, json_map_string_string *map_info)
struct graphdriver_status *graphdriver_get_status(void)
int graphdriver_cleanup(void)
Driver initialization initialization process:
Overlay module initialization process:
Devicemapper module initialization process:
struct driver_create_opts {
char *mount_label;
json_map_string_string *storage_opt;
};
struct driver_create_opts {
char *mount_label;
json_map_string_string *storage_opt;
};
Call the actual driver rm_layer interface according to the incoming ID to delete the corresponding layer.
struct driver_mount_opts {
char *mount_label;
char **options;
size_t options_len;
};
Call the actual driver umount_layer interface according to the incoming ID to umount the corresponding layer.
Call the actual driver exists interface according to the incoming ID to query whether the corresponding layer exists.
struct io_read_wrapper {
void *context;
io_read_func_t read;
io_close_func_t close;
};
Call the actual driver apply_diff interface according to the incoming ID to decompress the data.
Overlay driver: When decompressing data, special processing is required for the overlay .whout file.
If it is a file starting with .wh., it is marked as deleted and needs to be converted to char data, and the file needs to be skipped for subsequent decompression. For example, after deleting the home directory, the corresponding layer data is decompressed locally, and the corresponding home needs to create a character device with the same name.
drwxr-xr-x 4 root root 55 Mar 16 15:52 .
drwxrwxrwt. 26 root root 4096 Mar 26 12:02 ..
drwxr-xr-x 2 root root 38 Mar 16 12:49 etc
c--------- 1 root root 0, 0 Mar 16 15:52 home
-rw-r--r-- 1 root root 140543 Mar 13 12:12 index.html
dr-xr-x--- 2 root root 26 Mar 13 12:13 root
The decompressed data should be chrooted to the corresponding directory to prevent soft link attacks.
Call the actual driver get_layer_metadata interface according to the incoming ID to query the metadata of the corresponding layer.
The metadata supported by overlay query is as follows:
key | value |
---|---|
WorkDir | the work path of the overlay layer |
MergedDir | the work path of the overlay layer |
UpperDir | the diff path of the overlay layer |
LowerDir | the underlying path of the overlay layer, including all the underlying paths, divided by: |
struct graphdriver_status {
char *driver_name;
char *backing_fs;
char *status;
};
Query the status of the driver.
The driver status that supports query is as follows:
key | value |
---|---|
driver_name | driver name |
backing_fs | the name of the file system where storage is located |
status | corresponds to the status of the underlying driver the status return information supported by overlay is: Backing Filesystem Supports d_type: true |
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Опубликовать ( 0 )