[lxc-devel] [distrobuilder/master] cloud-init: Update for virtual machines
stgraber on Github
lxc-bot at linuxcontainers.org
Mon Apr 20 20:52:11 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 363 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200420/480e903a/attachment.bin>
-------------- next part --------------
From 89bb2241445eb26927884b9c37a9a9bb25938031 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 20 Apr 2020 16:51:44 -0400
Subject: [PATCH] cloud-init: Update for virtual machines
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
generators/cloud-init.go | 2 +-
generators/cloud-init_test.go | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/generators/cloud-init.go b/generators/cloud-init.go
index 46c7468..b2bd017 100644
--- a/generators/cloud-init.go
+++ b/generators/cloud-init.go
@@ -123,7 +123,7 @@ local-hostname: {{ container.name }}
content = `{% if config_get("user.network-config", "") == "" %}version: 1
config:
- type: physical
- name: eth0
+ name: {% if instance.type == "virtual-machine" %}enp5s0{% else %}eth0{% endif %}
subnets:
- type: {% if config_get("user.network_mode", "") == "link-local" %}manual{% else %}dhcp{% endif %}
control: auto{% else %}{{ config_get("user.network-config", "") }}{% endif %}
diff --git a/generators/cloud-init_test.go b/generators/cloud-init_test.go
index 06ce41a..47d92f6 100644
--- a/generators/cloud-init_test.go
+++ b/generators/cloud-init_test.go
@@ -122,7 +122,7 @@ local-hostname: {{ container.name }}
`{% if config_get("user.network-config", "") == "" %}version: 1
config:
- type: physical
- name: eth0
+ name: {% if instance.type == "virtual-machine" %}enp5s0{% else %}eth0{% endif %}
subnets:
- type: {% if config_get("user.network_mode", "") == "link-local" %}manual{% else %}dhcp{% endif %}
control: auto{% else %}{{ config_get("user.network-config", "") }}{% endif %}
More information about the lxc-devel
mailing list