-
Notifications
You must be signed in to change notification settings - Fork 519
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1537 from arnaldo2792/vmware-machine-id
systemd: generate stable machine IDs for VMWare guests
- Loading branch information
Showing
10 changed files
with
95 additions
and
64 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
packages/systemd/9001-use-absolute-path-for-var-run-symlink.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
From 6504eb5947e0896d9f35147597509895d752bc0e Mon Sep 17 00:00:00 2001 | ||
From 91604d466e49e8529482336a979b990a9588b722 Mon Sep 17 00:00:00 2001 | ||
From: Ben Cressey <[email protected]> | ||
Date: Tue, 17 Sep 2019 01:35:51 +0000 | ||
Subject: [PATCH 9001/9008] use absolute path for /var/run symlink | ||
|
2 changes: 1 addition & 1 deletion
2
packages/systemd/9002-core-add-separate-timeout-for-system-shutdown.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
From e28a86ad4928509953dea794e61020c14996858c Mon Sep 17 00:00:00 2001 | ||
From 6931413055f6f9a70f906f6a2df8a24e901a47e5 Mon Sep 17 00:00:00 2001 | ||
From: Ben Cressey <[email protected]> | ||
Date: Tue, 10 Mar 2020 20:30:10 +0000 | ||
Subject: [PATCH 9002/9008] core: add separate timeout for system shutdown | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
From f59750b48ee9dfc33a451629add411eba967e643 Mon Sep 17 00:00:00 2001 | ||
From de6bf41d3da21515ff34152c8a9fb6ae23a028c2 Mon Sep 17 00:00:00 2001 | ||
From: Ben Cressey <[email protected]> | ||
Date: Thu, 16 Apr 2020 15:10:41 +0000 | ||
Subject: [PATCH 9003/9008] repart: always use random UUIDs | ||
|
@@ -22,10 +22,10 @@ Signed-off-by: Ben Cressey <[email protected]> | |
2 files changed, 14 insertions(+), 92 deletions(-) | ||
|
||
diff --git a/meson.build b/meson.build | ||
index 580964c..781b0a2 100644 | ||
index f406d59..c16b50c 100644 | ||
--- a/meson.build | ||
+++ b/meson.build | ||
@@ -1375,8 +1375,7 @@ substs.set('DEFAULT_LLMNR_MODE', default_llmnr) | ||
@@ -1374,8 +1374,7 @@ substs.set('DEFAULT_LLMNR_MODE', default_llmnr) | ||
|
||
want_repart = get_option('repart') | ||
if want_repart != 'false' | ||
|
@@ -36,7 +36,7 @@ index 580964c..781b0a2 100644 | |
error('repart support was requested, but dependencies are not available') | ||
endif | ||
diff --git a/src/partition/repart.c b/src/partition/repart.c | ||
index 6d7e519..dfc2c79 100644 | ||
index 6db413e..f771c33 100644 | ||
--- a/src/partition/repart.c | ||
+++ b/src/partition/repart.c | ||
@@ -13,9 +13,6 @@ | ||
|
80 changes: 80 additions & 0 deletions
80
packages/systemd/9004-machine-id-setup-generate-stable-ID-under-Xen-and-VM.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
From 59744095bbd3fa229fabae98ee11c4e5e6502a8b Mon Sep 17 00:00:00 2001 | ||
From: Arnaldo Garcia Rincon <[email protected]> | ||
Date: Tue, 7 Jul 2020 22:38:20 +0000 | ||
Subject: [PATCH 9004/9008] machine-id-setup: generate stable ID under Xen and | ||
VMWare | ||
|
||
Signed-off-by: Arnaldo Garcia Rincon <[email protected]> | ||
--- | ||
man/machine-id.xml | 3 ++- | ||
src/core/machine-id-setup.c | 26 +++++++++++++++++++++++++- | ||
2 files changed, 27 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/man/machine-id.xml b/man/machine-id.xml | ||
index f61634f..06aa223 100644 | ||
--- a/man/machine-id.xml | ||
+++ b/man/machine-id.xml | ||
@@ -101,7 +101,8 @@ | ||
to use the D-Bus machine ID from <filename>/var/lib/dbus/machine-id</filename>, the | ||
value of the kernel command line option <varname>container_uuid</varname>, the KVM DMI | ||
<filename>product_uuid</filename> or the devicetree <filename>vm,uuid</filename> | ||
- (on KVM systems), and finally a randomly generated UUID.</para> | ||
+ (on KVM systems), the hypervisor UUID from <filename>/sys/hypervisor/uuid</filename> | ||
+ (under Xen), and finally a randomly generated UUID.</para> | ||
|
||
<para>After the machine ID is established, | ||
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry> | ||
diff --git a/src/core/machine-id-setup.c b/src/core/machine-id-setup.c | ||
index 6d15f9c..16f8b8c 100644 | ||
--- a/src/core/machine-id-setup.c | ||
+++ b/src/core/machine-id-setup.c | ||
@@ -31,6 +31,8 @@ static int generate_machine_id(const char *root, sd_id128_t *ret) { | ||
const char *dbus_machine_id; | ||
_cleanup_close_ int fd = -1; | ||
int r; | ||
+ int virtualization_type; | ||
+ | ||
|
||
assert(ret); | ||
|
||
@@ -60,7 +62,11 @@ static int generate_machine_id(const char *root, sd_id128_t *ret) { | ||
return 0; | ||
} | ||
|
||
- } else if (detect_vm() == VIRTUALIZATION_KVM) { | ||
+ } | ||
+ | ||
+ virtualization_type = detect_vm(); | ||
+ | ||
+ if (virtualization_type == VIRTUALIZATION_KVM) { | ||
|
||
/* If we are not running in a container, see if we are | ||
* running in qemu/kvm and a machine ID was passed in | ||
@@ -75,6 +81,24 @@ static int generate_machine_id(const char *root, sd_id128_t *ret) { | ||
log_info("Initializing machine ID from KVM UUID."); | ||
return 0; | ||
} | ||
+ | ||
+ } else if (virtualization_type == VIRTUALIZATION_XEN) { | ||
+ | ||
+ /* If we're running under Xen, check for a UUID from | ||
+ * the hypervisor. */ | ||
+ | ||
+ if (id128_read("/sys/hypervisor/uuid", ID128_UUID, ret) >= 0) { | ||
+ log_info("Initializing machine ID from Xen UUID."); | ||
+ return 0; | ||
+ } | ||
+ } else if (virtualization_type == VIRTUALIZATION_VMWARE) { | ||
+ /* If we're running under VMware, attempt to use the | ||
+ * product uuid. */ | ||
+ | ||
+ if (id128_read("/sys/class/dmi/id/product_uuid", ID128_UUID, ret) >= 0) { | ||
+ log_info("Initializing machine ID from VMware UUID."); | ||
+ return 0; | ||
+ } | ||
} | ||
} | ||
|
||
-- | ||
2.30.2 | ||
|
49 changes: 0 additions & 49 deletions
49
packages/systemd/9004-machine-id-setup-generate-stable-ID-under-Xen.patch
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
From 1da3740ea90f03f8357c165e8e409e4ff2f48830 Mon Sep 17 00:00:00 2001 | ||
From 02a6f0a9c8f4dd758eb0754bae2dadb5579f0a2f Mon Sep 17 00:00:00 2001 | ||
From: Ben Cressey <[email protected]> | ||
Date: Thu, 9 Jul 2020 20:00:36 +0000 | ||
Subject: [PATCH 9005/9008] core: mount /etc with specific label | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
From 4aa9be06f1765b7c5f74447aad09b888127b6429 Mon Sep 17 00:00:00 2001 | ||
From e01966709aa6beeb85df234be0e75eb9722778ba Mon Sep 17 00:00:00 2001 | ||
From: Ben Cressey <[email protected]> | ||
Date: Thu, 12 Nov 2020 16:18:15 +0000 | ||
Subject: [PATCH 9006/9008] journal: disable keyed hashes for compatibility | ||
|
@@ -14,10 +14,10 @@ Signed-off-by: Ben Cressey <[email protected]> | |
1 file changed, 2 insertions(+), 3 deletions(-) | ||
|
||
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c | ||
index 6bee5da..791145e 100644 | ||
index 1dbe818..531b9df 100644 | ||
--- a/src/journal/journal-file.c | ||
+++ b/src/journal/journal-file.c | ||
@@ -3463,13 +3463,12 @@ int journal_file_open( | ||
@@ -3383,13 +3383,12 @@ int journal_file_open( | ||
#endif | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
From 0551622158173ffd60367805b7e1dbd75b2ead0f Mon Sep 17 00:00:00 2001 | ||
From f15c27de1ba9c3f841359f25d945d67a9eb8c396 Mon Sep 17 00:00:00 2001 | ||
From: Erikson Tung <[email protected]> | ||
Date: Wed, 27 Jan 2021 14:43:47 -0800 | ||
Subject: [PATCH 9007/9008] pkg-config: stop hardcoding prefix to /usr | ||
|
@@ -11,7 +11,7 @@ the prefix needs to be configurable. | |
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/src/core/systemd.pc.in b/src/core/systemd.pc.in | ||
index b5cc8f9..ec4992b 100644 | ||
index f2c0455..c50821b 100644 | ||
--- a/src/core/systemd.pc.in | ||
+++ b/src/core/systemd.pc.in | ||
@@ -11,7 +11,7 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
From be47b1641896bd83c571925c8ad6b8119cffbc3b Mon Sep 17 00:00:00 2001 | ||
From 7dd380c3c32d7c3c3bd90d494dbbb9fa0e3ab1fb Mon Sep 17 00:00:00 2001 | ||
From: Arnaldo Garcia Rincon <[email protected]> | ||
Date: Wed, 21 Apr 2021 00:46:32 +0000 | ||
Subject: [PATCH 9008/9008] virt: add "Amazon EC2" to dmi vendor table | ||
|
@@ -15,7 +15,7 @@ Signed-off-by: Arnaldo Garcia Rincon <[email protected]> | |
1 file changed, 1 insertion(+) | ||
|
||
diff --git a/src/basic/virt.c b/src/basic/virt.c | ||
index 7d78a40..36b470e 100644 | ||
index 1b90f4b..364e7c6 100644 | ||
--- a/src/basic/virt.c | ||
+++ b/src/basic/virt.c | ||
@@ -158,6 +158,7 @@ static int detect_vm_dmi(void) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters