[lxc-devel] [distrobuilder/master] main: Fix build-lxd for VMs

monstermunchkin on Github lxc-bot at linuxcontainers.org
Mon Mar 2 17:23:05 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 447 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200302/99fad10e/attachment.bin>
-------------- next part --------------
From ef2260f5cfb0ac09a263633d896d3776f2113c87 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Mon, 2 Mar 2020 18:21:59 +0100
Subject: [PATCH] main: Fix build-lxd for VMs

This fixes an issue where the --vm flag would be ignored if running
build-lxd.

Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
 distrobuilder/main.go     | 1 +
 distrobuilder/main_lxd.go | 4 ----
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/distrobuilder/main.go b/distrobuilder/main.go
index 2d4c542..6fba06a 100644
--- a/distrobuilder/main.go
+++ b/distrobuilder/main.go
@@ -275,6 +275,7 @@ func (c *cmdGlobal) preRunBuild(cmd *cobra.Command, args []string) error {
 
 		if ok {
 			imageTargets |= shared.ImageTargetVM
+			c.definition.Targets.Type = "vm"
 		} else {
 			imageTargets |= shared.ImageTargetContainer
 		}
diff --git a/distrobuilder/main_lxd.go b/distrobuilder/main_lxd.go
index b2f51c4..2fa2648 100644
--- a/distrobuilder/main_lxd.go
+++ b/distrobuilder/main_lxd.go
@@ -53,10 +53,6 @@ func (c *cmdLXD) commandBuild() *cobra.Command {
 			}
 			defer cleanup()
 
-			if c.flagVM {
-				c.global.definition.Targets.Type = "vm"
-			}
-
 			return c.run(cmd, args, overlayDir)
 		},
 	}


More information about the lxc-devel mailing list