MySQL host record disappeared

My MySQL table got corrupted and lost from host_pool a host record. This caused opennebula to not dislay my host but wouldn’t allow me to readdit throwing error that host with that name already exists (not that I wanted to, I wanted to recover it).

What I did next is that I connected to mysql and duplicated a host record and changed oid and name, trouble is now that it reports that it has the same VM’s as the host that I duplicated. Is there a way to manually force a resyncronization for that host ?

I deleted /var/tmp/one on the problematic node and executed onehost sync --force on frontend, unfortunately the host still doesn’t have attached the VMs that it should have, instead it displays the VMs from the host I duplicated. I updated the body in host_pool with the correct VM ids and someway it adds them back :frowning:

This is the body of the host:

 <HOST><ID>5</ID><NAME>10.0.0.2</NAME><STATE>2</STATE><IM_MAD><![CDATA[kvm]]></IM_MAD><VM_MAD><![CDATA[kvm]]></VM_MAD><VN_MAD><![CDATA[dummy]]></VN_MAD><LAST_MON_TIME>1436402243</LAST_MON_TIME><CLUSTER_ID>-1</CLUSTER_ID><CLUSTER></CLUSTER><HOST_SHARE><DISK_USAGE>0</DISK_USAGE><MEM_USAGE>14680064</MEM_USAGE><CPU_USAGE>700</CPU_USAGE><MAX_DISK>922827</MAX_DISK><MAX_MEM>16333120</MAX_MEM><MAX_CPU>800</MAX_CPU><FREE_DISK>756936</FREE_DISK><FREE_MEM>3912280</FREE_MEM><FREE_CPU>790</FREE_CPU><USED_DISK>119008</USED_DISK><USED_MEM>12420840</USED_MEM><USED_CPU>9</USED_CPU><RUNNING_VMS>3</RUNNING_VMS><DATASTORES><DS><FREE_MB><![CDATA[756936]]></FREE_MB><ID><![CDATA[0]]></ID><TOTAL_MB><![CDATA[922827]]></TOTAL_MB><USED_MB><![CDATA[119008]]></USED_MB></DS></DATASTORES></HOST_SHARE><VMS><ID>35</ID><ID>37</ID><ID>44</ID></VMS><TEMPLATE><ARCH><![CDATA[x86_64]]></ARCH><CPUSPEED><![CDATA[2003]]></CPUSPEED><HOSTNAME><![CDATA[node2]]></HOSTNAME><HYPERVISOR><![CDATA[kvm]]></HYPERVISOR><MODELNAME><![CDATA[Intel(R) Xeon(R) CPU           L5420  @ 2.50GHz]]></MODELNAME><NETRX><![CDATA[7107945110]]></NETRX><NETTX><![CDATA[154711687563]]></NETTX><RESERVED_CPU><![CDATA[]]></RESERVED_CPU><RESERVED_MEM><![CDATA[]]></RESERVED_MEM><TOTAL_ZOMBIES><![CDATA[2]]></TOTAL_ZOMBIES><VERSION><![CDATA[4.12.1]]></VERSION><ZOMBIES><![CDATA[one-23, one-46]]></ZOMBIES></TEMPLATE></HOST>

The correct VMs are reported as zombies.

If I remove a host, will VMs suffer or get removed ? I’m thinking of removing the troubled host and add it back but the VMs are in production and I want to make sure nothing bad happens to them.

Hi,

I suspect you are meddling with the database contents with opennebula still running, and that’s why it complains about the name already taken, and why the host VMs are added back.

You can try the onedb fsck tool to see if it fixes the list of VMs for your hosts:
http://docs.opennebula.org/4.12/administration/references/onedb.html

Cheers

@cmartin You are totaly right!. onedb fsck also fixed my issue with the host, if only I knew of it before :frowning:

Command line works just fine now, sunstone on the other hand doesn’t show any data anymore even after restarting opennebula and opennebula-sunstone. nothing in the logs either, I’ll keep playing around, maybe I can fix it.

Thanks @cmartin for all your help!

Actually, I can see now sunstone works but with ~60s delay until it gets results wherever I go (viewing hosts, dashboard data, VM details, etc).