From ccf2cbb9076c340c5e98b1519e3f6f3eb1b94d3f Mon Sep 17 00:00:00 2001 From: site0801 <0801site@gmail.com> Date: Tue, 5 Sep 2023 11:11:23 +0900 Subject: [PATCH] Support sharing of /dev/kmsg with the container --- server/pkg/api/server_add_instance.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/server/pkg/api/server_add_instance.go b/server/pkg/api/server_add_instance.go index 15127b9..2351f2b 100644 --- a/server/pkg/api/server_add_instance.go +++ b/server/pkg/api/server_add_instance.go @@ -62,7 +62,8 @@ func (s *ShoesLXDMultiServer) AddInstance(ctx context.Context, req *pb.AddInstan reqInstance := api.InstancesPost{ InstancePut: api.InstancePut{ - Config: s.getInstanceConfig(req.SetupScript, req.ResourceType), + Config: s.getInstanceConfig(req.SetupScript, req.ResourceType), + Devices: s.getInstanceDevices(), }, Name: instanceName, Source: *instanceSource, @@ -146,6 +147,18 @@ lxc.cap.drop=` return instanceConfig } +func (s *ShoesLXDMultiServer) getInstanceDevices() map[string]map[string]string { + instanceDevices := map[string]map[string]string{ + "kmsg": { + "path": "/dev/kmsg", + "source": "/dev/kmsg", + "type": "unix-char", + }, + } + + return instanceDevices +} + type targetHost struct { host lxdclient.LXDHost resource lxdclient.Resource