coreos-base/afterburn: do not start coreos-metadata.service on qemu

QEMU is not supported by Afterburn, let's add an extra-check to be sure
that the service will not run on this platform.

On cloud-init provisioned system, units are wrote in '/etc' after a
certain moment, if a unit takes precedence on one in '/usr' the one in
'/usr' would have certainly already started. That's the case for
'coreos-metadata.service' (wrote in '/etc' by cloud-init but already
available in '/usr').

```
$ journalctl -u coreos-metadata.service
Sep 29 07:37:57 localhost systemd[1]: Starting coreos-metadata.service - Flatcar Metadata Agent...
Sep 29 07:37:57 localhost coreos-metadata[1266]: Error: failed to run
Sep 29 07:37:57 localhost coreos-metadata[1266]: Caused by:
Sep 29 07:37:57 localhost coreos-metadata[1266]:     0: fetching metadata from provider
Sep 29 07:37:57 localhost coreos-metadata[1266]:     1: unknown provider 'qemu'
Sep 29 07:37:57 localhost systemd[1]: coreos-metadata.service: Main process exited, code=exited, status=1/FAILURE
Sep 29 07:37:57 localhost systemd[1]: coreos-metadata.service: Failed with result 'exit-code'.
Sep 29 07:37:57 localhost systemd[1]: Failed to start coreos-metadata.service - Flatcar Metadata Agent.
Sep 29 07:37:58 core1 systemd[1]: coreos-metadata.service: Scheduled restart job, restart counter is at 1.
Sep 29 07:37:58 core1 systemd[1]: Stopped coreos-metadata.service - QEMU metadata agent.
Sep 29 07:37:58 core1 systemd[1]: Starting coreos-metadata.service - QEMU metadata agent...
Sep 29 07:37:58 core1 systemd[1]: coreos-metadata.service: Deactivated successfully.
Sep 29 07:37:58 core1 systemd[1]: Finished coreos-metadata.service - QEMU metadata agent.
```

Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
This commit is contained in:
Mathieu Tortuyaux 2023-09-29 09:19:01 +02:00
parent b36cb28768
commit bafe49f997
No known key found for this signature in database
GPG Key ID: AC5CCFB52545D9B8
2 changed files with 18 additions and 0 deletions

View File

@ -1,4 +1,22 @@
[Unit]
ConditionKernelCommandLine=|flatcar.oem.id=ec2
ConditionKernelCommandLine=|coreos.oem.id=ec2
ConditionKernelCommandLine=|flatcar.oem.id=azure
ConditionKernelCommandLine=|coreos.oem.id=azure
ConditionKernelCommandLine=|flatcar.oem.id=digitalocean
ConditionKernelCommandLine=|coreos.oem.id=digitalocean
ConditionKernelCommandLine=|flatcar.oem.id=gce
ConditionKernelCommandLine=|coreos.oem.id=gce
ConditionKernelCommandLine=|flatcar.oem.id=openstack
ConditionKernelCommandLine=|coreos.oem.id=openstack
ConditionKernelCommandLine=|flatcar.oem.id=packet
ConditionKernelCommandLine=|coreos.oem.id=packet
Description=Flatcar Metadata Agent
[Service]