From c686a94b6ee6f59a08acfd443922ebeaafdb9c8d Mon Sep 17 00:00:00 2001 From: Joel Colledge Date: Mon, 8 Nov 2021 13:28:38 +0100 Subject: [PATCH] vm run: avoid adding empty "mounts" section to user-data An empty "mounts" section causes cloud-init to fail to start. It gets far enough that the VM is accessible, but still registers as a failed unit in systemd. Prevent this by only writing the "mounts" section when there are actual mounts. --- internal/virter/cloudconfig.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/virter/cloudconfig.go b/internal/virter/cloudconfig.go index d4c3e61..4c3157f 100644 --- a/internal/virter/cloudconfig.go +++ b/internal/virter/cloudconfig.go @@ -35,10 +35,12 @@ fqdn: {{ .VMName }}.{{ .DomainSuffix }} {{- else }} fqdn: {{ .VMName }} {{- end }} +{{- if .Mount }} mounts: {{- range .Mount }} - [ "{{ . }}", "{{ . }}", "virtiofs"] {{- end }} +{{- end }} ` func (v *Virter) metaData(vmName string) (string, error) {