]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
machine-id-setup: generate machine-id from DMI product ID on Amazon EC2
authorBertrand Jacquin <bertrand@jacquin.bzh>
Sun, 11 Oct 2020 21:25:56 +0000 (22:25 +0100)
committerNoah Meyerhans <nmeyerha@amazon.com>
Fri, 30 Apr 2021 19:26:22 +0000 (12:26 -0700)
Amazon EC2 Nitro hypervisor is technically based on KVM[1].

[1] https://aws.amazon.com/ec2/faqs/

src/shared/machine-id-setup.c

index dd4c74b19c960ad17b807b351ac422c61e007aec..d2f989272ddd12563dd5f99ff7ecf592824841e1 100644 (file)
@@ -60,13 +60,14 @@ static int generate_machine_id(const char *root, sd_id128_t *ret) {
                                 return 0;
                         }
 
-                } else if (detect_vm() == VIRTUALIZATION_KVM) {
+                } else if (IN_SET(detect_vm(), VIRTUALIZATION_KVM, VIRTUALIZATION_AMAZON, VIRTUALIZATION_QEMU)) {
 
-                        /* If we are not running in a container, see if we are running in qemu/kvm and a
-                         * machine ID was passed in via -uuid on the qemu/kvm command line */
+                        /* If we are not running in a container, see if we are running in a VM that provides
+                         * a system UUID via the SMBIOS/DMI interfaces.  Such environments include QEMU/KVM
+                         * with the -uuid on the qemu command line or the Amazon EC2 Nitro hypervisor. */
 
                         if (id128_get_product(ret) >= 0) {
-                                log_info("Initializing machine ID from KVM UUID.");
+                                log_info("Initializing machine ID from VM UUID.");
                                 return 0;
                         }
                 }