The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/7231

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===

From 3c6415b71795c64cba48210f954a1208c436fe3c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Mon, 20 Apr 2020 17:03:35 -0400
Subject: [PATCH 1/2] lxd/instances: Export type to templates
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 lxd/instance/drivers/driver_lxc.go  | 1 +
 lxd/instance/drivers/driver_qemu.go | 1 +
 2 files changed, 2 insertions(+)

diff --git a/lxd/instance/drivers/driver_lxc.go 
b/lxd/instance/drivers/driver_lxc.go
index 9dfa2d9dc3..5c7b72d378 100644
--- a/lxd/instance/drivers/driver_lxc.go
+++ b/lxd/instance/drivers/driver_lxc.go
@@ -5060,6 +5060,7 @@ func (c *lxc) templateApplyNow(trigger string) error {
        // Generate the container metadata
        containerMeta := make(map[string]string)
        containerMeta["name"] = c.name
+       containerMeta["type"] = "container"
        containerMeta["architecture"] = arch
 
        if c.ephemeral {
diff --git a/lxd/instance/drivers/driver_qemu.go 
b/lxd/instance/drivers/driver_qemu.go
index 99e41f78ce..35ee186f78 100644
--- a/lxd/instance/drivers/driver_qemu.go
+++ b/lxd/instance/drivers/driver_qemu.go
@@ -1417,6 +1417,7 @@ func (vm *qemu) templateApplyNow(trigger string, path 
string) error {
        // Generate the container metadata.
        instanceMeta := make(map[string]string)
        instanceMeta["name"] = vm.name
+       instanceMeta["type"] = "virtual-machine"
        instanceMeta["architecture"] = arch
 
        if vm.ephemeral {

From 76e19d2eaac67be4448b9a79ce3a52ac0fed4bca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Mon, 20 Apr 2020 18:41:04 -0400
Subject: [PATCH 2/2] lxd-agent: Reboot after cloud-init seed
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Getting systemd to properly order units showing up halfway through the
boot appears to be near impossible. So until we get some kind of
improved integration with cloud-init which doesn't require us seeding it
through text files, we'll just reboot to have it do its job like on a
clean boot.

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 lxd-agent/main_agent.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lxd-agent/main_agent.go b/lxd-agent/main_agent.go
index b285d95c16..7f64ccd163 100644
--- a/lxd-agent/main_agent.go
+++ b/lxd-agent/main_agent.go
@@ -85,6 +85,8 @@ func (c *cmdAgent) Run(cmd *cobra.Command, args []string) 
error {
 
        // Run cloud-init.
        if shared.PathExists("/etc/cloud") && 
shared.StringInSlice("/var/lib/cloud/seed/nocloud-net/meta-data", files) {
+               logger.Info("Seeding cloud-init")
+
                cloudInitPath := "/run/cloud-init"
                if shared.PathExists(cloudInitPath) {
                        logger.Info(fmt.Sprintf("Removing %q", cloudInitPath))
@@ -94,9 +96,7 @@ func (c *cmdAgent) Run(cmd *cobra.Command, args []string) 
error {
                        }
                }
 
-               logger.Info("Starting cloud-init")
-               shared.RunCommand("systemctl", "daemon-reload")
-               shared.RunCommand("systemctl", "start", "cloud-init.target")
+               shared.RunCommand("systemctl", "reboot")
        }
 
        // Mount shares from host.
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to