From 037b3feba79a4e537c9a6a089e0c7e30bab9c0b4 Mon Sep 17 00:00:00 2001 From: Matt Bilker Date: Mon, 29 Jul 2024 10:15:23 +0000 Subject: [PATCH] utils: fix Proxmox format - Closes #34 --- src/utils.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/utils.rs b/src/utils.rs index 1395e4a..30e6c6a 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -36,8 +36,11 @@ pub fn from_c_str(value: &[u8]) -> Cow<'_, str> { /// All except the last segment must be zero #[cfg(feature = "proxmox")] pub fn uuid_to_vmid(uuid: Uuid) -> Option { - // Ensure that the first parts of the uuid are only 0 - if uuid.0 != 0 || uuid.1 != 0 || uuid.2 != 0 || uuid.3[0] != 0 || uuid.3[1] != 0 { + // Following https://forum.proxmox.com/threads/automatically-assign-uuid-to-a-vgpu-instance.98994/#post-427480 + // + // The format is `-0000-0000-0000-`. Ensure the parts that should be + // zero are in fact zero. + if uuid.1 != 0 || uuid.2 != 0 || uuid.3[0] != 0 || uuid.3[1] != 0 { return None; }