fusioninventory / fusioninventory-agent

FusionInventory Agent
http://fusioninventory.org/
GNU General Public License v2.0
253 stars 125 forks source link

Missing VM network information using fusioninventory-esx #867

Open jeromedrouet opened 3 years ago

jeromedrouet commented 3 years ago

Hi,

VM network information (mac address, description) is missing from when importing .ocs inventory file generated by fusioninventory-esx (and using create_vm parameter to import them as usual computer using glpi plugin)

seems like .ocs inventory file provides only one "MAC" text field whereas fusioninventory plugin for glpi expects several NETWORKS->MACADDRESS/DESCRIPTION entries

related to https://github.com/fusioninventory/fusioninventory-for-glpi/issues/2779

regards,

jeromedrouet commented 3 years ago

adding patch to fix this issue add_vm_macaddress.patch.txt

g-bougard commented 3 years ago

Hi @jeromedrouet

thank you for your submission.

By the way, your patch is changing inventory specs and you're not showing any example of what this will change. So we can't really see the added value. Also as the spec is changed, this means the server won't support this and you won't see the change in GLPI.

jeromedrouet commented 3 years ago

"old" fashion inventory gives this as a virtualmachine :

    <VIRTUALMACHINES>
      <COMMENT></COMMENT>
      <MAC>00:50:56:xx:yy:zz</MAC>
      <MEMORY>4096</MEMORY>
      <NAME>Template_W2k16</NAME>
      <STATUS>off</STATUS>
      <UUID>4222e3a0-408d-4639-e036-xsxsxssxxsxssx</UUID>
      <VCPU>1</VCPU>
      <VMTYPE>VMware</VMTYPE>
    </VIRTUALMACHINES>

with the attached patch we get this :

    <VIRTUALMACHINES>
      <COMMENT></COMMENT>
      <MEMORY>4096</MEMORY>
      <NAME>TPL_W2k16</NAME>
      <NETWORKS>
        <DESCRIPTION>Network adapter 1</DESCRIPTION>
        <MACADDR>00:50:56:xx:yy:zz</MACADDR>
      </NETWORKS>
      <NETWORKS>
        <DESCRIPTION>Network adapter 2</DESCRIPTION>
        <MACADDR>00:50:56:aa:bb:cc</MACADDR>
      </NETWORKS>
      <STATUS>off</STATUS>
      <UUID>4222e3a0-408d-4639-e036-xsxsxssxxsxssx</UUID>>
      <VCPU>1</VCPU>
      <VMTYPE>VMware</VMTYPE>
    </VIRTUALMACHINES>

which is what is expected by the fusioninventory glpi plugin ( file inc/formatconvert.class.php, the section dealing with the create_vm option (line 1374 on version 9.4+2.4 of FusionInventory GLPI plugin)

with the patch using create_vm option set to true we do have "computer" creation from VM using fusioninventory-esx and they have the mac address of their NIC (they dont have any NICs without this patch)

this fix may be close to the "missing drives" issue linked above