1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-31 05:47:30 +03:00

machine: add MachineImage interface

Follow-up for fb0ea6a6a36b5fa97e6c57d608bb9f7acb63c8b2.
Fixes #34772.
This commit is contained in:
Yu Watanabe 2024-10-15 17:39:00 +09:00
parent d115bd5ab4
commit 7a3ee9217e
5 changed files with 16 additions and 2 deletions

View File

@ -15,6 +15,7 @@
#include "socket-util.h"
#include "user-util.h"
#include "varlink-io.systemd.Machine.h"
#include "varlink-io.systemd.MachineImage.h"
#include "varlink-io.systemd.UserDatabase.h"
typedef struct LookupParameters {
@ -687,9 +688,12 @@ static int manager_varlink_init_machine(Manager *m) {
sd_varlink_server_set_userdata(s, m);
r = sd_varlink_server_add_interface(s, &vl_interface_io_systemd_Machine);
r = sd_varlink_server_add_interface_many(
s,
&vl_interface_io_systemd_Machine,
&vl_interface_io_systemd_MachineImage);
if (r < 0)
return log_error_errno(r, "Failed to add Machine interface to varlink server: %m");
return log_error_errno(r, "Failed to add Machine and MachineImage interfaces to varlink server: %m");
r = sd_varlink_server_bind_method_many(
s,

View File

@ -184,6 +184,7 @@ shared_sources = files(
'varlink-io.systemd.Import.c',
'varlink-io.systemd.Journal.c',
'varlink-io.systemd.Machine.c',
'varlink-io.systemd.MachineImage.c',
'varlink-io.systemd.ManagedOOM.c',
'varlink-io.systemd.MountFileSystem.c',
'varlink-io.systemd.NamespaceResource.c',

View File

@ -2,6 +2,7 @@
#include "sd-varlink-idl.h"
#include "bus-polkit.h"
#include "varlink-io.systemd.MachineImage.h"
static SD_VARLINK_DEFINE_METHOD_FULL(

View File

@ -15,6 +15,7 @@
#include "varlink-io.systemd.Import.h"
#include "varlink-io.systemd.Journal.h"
#include "varlink-io.systemd.Machine.h"
#include "varlink-io.systemd.MachineImage.h"
#include "varlink-io.systemd.ManagedOOM.h"
#include "varlink-io.systemd.MountFileSystem.h"
#include "varlink-io.systemd.NamespaceResource.h"
@ -190,6 +191,8 @@ TEST(parse_format) {
print_separator();
test_parse_format_one(&vl_interface_io_systemd_Machine);
print_separator();
test_parse_format_one(&vl_interface_io_systemd_MachineImage);
print_separator();
test_parse_format_one(&vl_interface_xyz_test);
}

View File

@ -256,6 +256,11 @@ done
long_running_machine_start
varlinkctl introspect /run/systemd/machine/io.systemd.Machine io.systemd.Machine
varlinkctl introspect /run/systemd/machine/io.systemd.Machine io.systemd.MachineImage
varlinkctl introspect /run/systemd/machine/io.systemd.MachineImage io.systemd.Machine
varlinkctl introspect /run/systemd/machine/io.systemd.MachineImage io.systemd.MachineImage
# test io.systemd.Machine.List
varlinkctl --more call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.List '{}' | grep 'long-running'
varlinkctl --more call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.List '{}' | grep '.host'