machine-image: introduce two different classes of images

This distuingishes two different classes of images, one for the purpose
of npsawn-like containers, i.e. "machines", and one for portable
services.

This distinction is mostly about search paths. We look for machine
images in /var/lib/machines and for portable images in
/var/lib/portables.
This commit is contained in:
Lennart Poettering
2018-05-24 17:01:57 +02:00
parent 3e36211be0
commit 5ef46e5f65
8 changed files with 52 additions and 36 deletions
+2 -2
View File
@@ -435,7 +435,7 @@ int image_object_find(sd_bus *bus, const char *path, const char *interface, void
if (r < 0)
return r;
r = image_find(e, &image);
r = image_find(IMAGE_MACHINE, e, &image);
if (r <= 0)
return r;
@@ -478,7 +478,7 @@ int image_node_enumerator(sd_bus *bus, const char *path, void *userdata, char **
if (!images)
return -ENOMEM;
r = image_discover(images);
r = image_discover(IMAGE_MACHINE, images);
if (r < 0)
return r;
+12 -12
View File
@@ -145,7 +145,7 @@ static int method_get_image(sd_bus_message *message, void *userdata, sd_bus_erro
if (r < 0)
return r;
r = image_find(name, NULL);
r = image_find(IMAGE_MACHINE, name, NULL);
if (r == 0)
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_IMAGE, "No image '%s' known", name);
if (r < 0)
@@ -545,7 +545,7 @@ static int method_list_images(sd_bus_message *message, void *userdata, sd_bus_er
if (!images)
return -ENOMEM;
r = image_discover(images);
r = image_discover(IMAGE_MACHINE, images);
if (r < 0)
return r;
@@ -738,7 +738,7 @@ static int method_remove_image(sd_bus_message *message, void *userdata, sd_bus_e
if (!image_name_is_valid(name))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Image name '%s' is invalid.", name);
r = image_find(name, &i);
r = image_find(IMAGE_MACHINE, name, &i);
if (r < 0)
return r;
if (r == 0)
@@ -762,7 +762,7 @@ static int method_rename_image(sd_bus_message *message, void *userdata, sd_bus_e
if (!image_name_is_valid(old_name))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Image name '%s' is invalid.", old_name);
r = image_find(old_name, &i);
r = image_find(IMAGE_MACHINE, old_name, &i);
if (r < 0)
return r;
if (r == 0)
@@ -786,7 +786,7 @@ static int method_clone_image(sd_bus_message *message, void *userdata, sd_bus_er
if (!image_name_is_valid(old_name))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Image name '%s' is invalid.", old_name);
r = image_find(old_name, &i);
r = image_find(IMAGE_MACHINE, old_name, &i);
if (r < 0)
return r;
if (r == 0)
@@ -810,7 +810,7 @@ static int method_mark_image_read_only(sd_bus_message *message, void *userdata,
if (!image_name_is_valid(name))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Image name '%s' is invalid.", name);
r = image_find(name, &i);
r = image_find(IMAGE_MACHINE, name, &i);
if (r < 0)
return r;
if (r == 0)
@@ -834,7 +834,7 @@ static int method_get_image_hostname(sd_bus_message *message, void *userdata, sd
if (!image_name_is_valid(name))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Image name '%s' is invalid.", name);
r = image_find(name, &i);
r = image_find(IMAGE_MACHINE, name, &i);
if (r < 0)
return r;
if (r == 0)
@@ -858,7 +858,7 @@ static int method_get_image_machine_id(sd_bus_message *message, void *userdata,
if (!image_name_is_valid(name))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Image name '%s' is invalid.", name);
r = image_find(name, &i);
r = image_find(IMAGE_MACHINE, name, &i);
if (r < 0)
return r;
if (r == 0)
@@ -882,7 +882,7 @@ static int method_get_image_machine_info(sd_bus_message *message, void *userdata
if (!image_name_is_valid(name))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Image name '%s' is invalid.", name);
r = image_find(name, &i);
r = image_find(IMAGE_MACHINE, name, &i);
if (r < 0)
return r;
if (r == 0)
@@ -906,7 +906,7 @@ static int method_get_image_os_release(sd_bus_message *message, void *userdata,
if (!image_name_is_valid(name))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Image name '%s' is invalid.", name);
r = image_find(name, &i);
r = image_find(IMAGE_MACHINE, name, &i);
if (r < 0)
return r;
if (r == 0)
@@ -1070,7 +1070,7 @@ static int method_clean_pool(sd_bus_message *message, void *userdata, sd_bus_err
goto child_fail;
}
r = image_discover(images);
r = image_discover(IMAGE_MACHINE, images);
if (r < 0)
goto child_fail;
@@ -1211,7 +1211,7 @@ static int method_set_image_limit(sd_bus_message *message, void *userdata, sd_bu
if (!image_name_is_valid(name))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Image name '%s' is invalid.", name);
r = image_find(name, &i);
r = image_find(IMAGE_MACHINE, name, &i);
if (r < 0)
return r;
if (r == 0)