[Fusioninventory-user] Container OpenVZ (Proxmox) and UUID

Guillaume Rousse guillomovitch at gmail.com
Tue Jun 2 07:28:22 UTC 2015


Le 26/05/2015 15:41, Matthieu.Marc at ensam.eu a écrit :
> Finally I managed to make it working patching two files : Vmsystem.pm and Virtuozzo.pm to make the UUID of the guest = UUID + "-" + CT_ID.
>
> Le patch was made for 2.3.16 version.
>
> To be able to make it working, dmidecode must be working on the guest. To do so, yo must configure the guest with the two following command (stop the guest first) :
>
>    vzctl set $VEID --devnodes mem:r --save
>    vzctl set $ VEID  --capability sys_rawio:on --save
>
> If someone found another way to get an identifier of the host from the guest, the two previous command would be useless.
Rather than changing guest ID to include host ID so as to make it 
globally unique (whereas it is currently host-specific), I think just 
populating the dedicated host ID attribute (UUID) on the guest would be 
enough, and far less intrusive.

Of course, the algorithm used on GLPI side to establish the relationship 
beween host and guest should be:
- virtual machine ID (HARDWARE/VMID element) on the guest should match 
virtual machine ID (VIRTUALMACHINE/VMID) on the host
- physical machine ID (HARDWARE/UUID element) on the guest should match 
physical machine ID (VIRTUALMACHINE/UUID) on the host

The first condition in enough only for virtualization technologies that 
use globaly unique virtual machine identifiers.

David ?
-- 
Guillaume
-------------- next part --------------
diff --git a/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Vmsystem.pm b/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Vmsystem.pm
index e827905..c86b1a9 100644
--- a/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Vmsystem.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Vmsystem.pm
@@ -76,11 +76,14 @@ sub doInventory {
         });
     }
 
+    # guest ID
     my $vmid = $type eq 'Virtuozzo' ?
         _getOpenVZVmID(logger => $logger) : undef;
 
-    my $uuid = $type eq 'Xen' ? _getXenUUID(logger => $logger) :
-               $type eq 'LXC' ? _getLibvirtLXC_UUID(logger => $logger) :
+    # host ID
+    my $uuid = $type eq 'Xen'       ? _getXenUUID(logger => $logger)         :
+               $type eq 'LXC'       ? _getLibvirtLXC_UUID(logger => $logger) :
+               $type eq 'Virtuozzo' ? $inventory->{content}{HARDWARE}{UUID}  :
                undef;
 
     $inventory->setHardware({


More information about the Fusioninventory-user mailing list