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

Matthieu.Marc at ensam.eu Matthieu.Marc at ensam.eu
Tue May 26 13:41:44 UTC 2015


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.

The patch :

diff -Naur FusionInventory-Agent-2.3.16.orig/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Virtuozzo.pm FusionInventory-Agent-2.3.16/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Virtuozzo.pm
--- FusionInventory-Agent-2.3.16.orig/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Virtuozzo.pm	2014-07-31 13:05:11.000000000 +0200
+++ FusionInventory-Agent-2.3.16/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Virtuozzo.pm	2015-05-26 15:33:13.139834860 +0200
@@ -87,6 +87,13 @@
             }
         }
 
+	if (
+            defined $ctid && 
+	    defined $inventory->{content}{HARDWARE}{UUID}			 
+	) {
+           $ctid = $inventory->{content}{HARDWARE}{UUID} . "-" . $ctid;
+        }
+
         $inventory->addEntry(
             section => 'VIRTUALMACHINES',
             entry => {
diff -Naur FusionInventory-Agent-2.3.16.orig/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Vmsystem.pm FusionInventory-Agent-2.3.16/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Vmsystem.pm
--- FusionInventory-Agent-2.3.16.orig/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Vmsystem.pm	2014-10-24 17:50:21.000000000 +0200
+++ FusionInventory-Agent-2.3.16/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Vmsystem.pm	2015-05-26 15:36:21.911842686 +0200
@@ -83,6 +83,16 @@
                $type eq 'LXC' ? _getLibvirtLXC_UUID(logger => $logger) :
                undef;
 
+    if ( 
+        $type eq 'Virtuozzo'  &&
+        defined $vmid &&
+        defined $inventory->{content}{HARDWARE}{UUID}
+    ) {
+       $uuid = $inventory->{content}{HARDWARE}{UUID} . "-" . $vmid;
+       $vmid = $uuid;
+       undef $inventory->{content}{BIOS}{SSN};
+    }
+
     $inventory->setHardware({
         VMSYSTEM => $type,
         UUID     => $uuid,




-----Message d'origine-----
De : Fusioninventory-user [mailto:fusioninventory-user-bounces+matthieu.marc=ensam.eu at lists.alioth.debian.org] De la part de Matthieu.Marc at ensam.eu
Envoyé : mardi 26 mai 2015 15:18
À : fusioninventory-user at lists.alioth.debian.org
Objet : Re: [Fusioninventory-user] Container OpenVZ (Proxmox) and UUID

I have the same problem using 2.3.16.

I am starting trying modifying UUID of the guest container in ./lib/FusionInventory/Agent/Task/Inventory/Virtualization/Vmsystem.pm :

my $vmid = $type eq 'Virtuozzo' ?
        _getOpenVZVmID(logger => $logger) : undef;

    my $uuid = $type eq 'Xen' ? _getXenUUID(logger => $logger) :
               $type eq 'LXC' ? _getLibvirtLXC_UUID(logger => $logger) :
               undef;

 # BEGIN NEW
    if ( 
       $type eq 'Virtuozzo' && defined $vmid 
    ) {
       $uuid = $inventory->{content}{HARDWARE}{UUID} . "-" . $vmid;
       $vmid = $uuid;
    }
# END NEW

    $inventory->setHardware({
        VMSYSTEM => $type,
        UUID     => $uuid,
        VMID     => $vmid
    });

So that the UUID of the guest is  UUID + "-"  + VM_ID

But when importing the guest, it override the host. (the UUID of the host and of the guest are not equal anymore).

Cordialy


-----Message d'origine-----
De : Fusioninventory-user [mailto:fusioninventory-user-bounces+matthieu.marc=ensam.eu at lists.alioth.debian.org] De la part de Kevin Roy Envoyé : mardi 26 mai 2015 15:08 À : FusionInventory User discussion Objet : Re: [Fusioninventory-user] Container OpenVZ (Proxmox) and UUID

On 26 May 2015 at 14:32,  <Matthieu.Marc at ensam.eu> wrote:
> It seems to be only for KVM. I am using OpenVZ :-(

Ok my bad ;) ... i overlooked the subject in your mail.

It seems you are using a really old version (2.2.3) of fusioninventory-agent. Can you test with a more recent version (the latest version is actually 2.3.16) and see if it can fix your issue ?

--
Kevin Roy

_______________________________________________
Fusioninventory-user mailing list
Fusioninventory-user at lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/fusioninventory-user

_______________________________________________
Fusioninventory-user mailing list
Fusioninventory-user at lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/fusioninventory-user



More information about the Fusioninventory-user mailing list