Hi Richard,<div><br></div><div>You can create a hook on RUNNING and then check the VM history to detect if it has reached that state after a migration. Use $TEMPLATE as one of the arguments to get the VM information. You have the life-cycle reference here [1,2].</div>
<div><br></div><div>Below is a sample xml of a VM migrated from (1 localhost) to (0 vm). Note that the HISTORY record with SEQ 0 has a REASON value of 3, that means that the execution on that host ended because the user requested it.</div>
<div><br></div><div>Possible values for the REASON element are (see [3]):</div><div><br></div><div><div><font face="'courier new', monospace"> enum MigrationReason</font></div><div><font face="'courier new', monospace"> {</font></div>
<div><font face="'courier new', monospace"> NONE, /** < Normal termination in host */</font></div><div><font face="'courier new', monospace"> ERROR, /** < The VM was migrated because of an error */</font></div>
<div><font face="'courier new', monospace"> STOP_RESUME,/** < The VM was migrated because of a stop/resume request*/</font></div><div><font face="'courier new', monospace"> USER, /** < The VM was migrated because of an explicit request */</font></div>
<div><font face="'courier new', monospace"> CANCEL /** < The VM was migrated because of an explicit cancel */</font></div><div><font face="'courier new', monospace"> };</font></div></div>
<div><br></div><div><br></div><div><font face="'courier new', monospace"><VM></font></div><div><font face="'courier new', monospace">...</font></div><div><div><font face="'courier new', monospace"> <HISTORY_RECORDS></font></div>
<div><font face="'courier new', monospace"> <HISTORY></font></div><div><font face="'courier new', monospace"> <SEQ>0</SEQ></font></div><div><font face="'courier new', monospace"> <HOSTNAME>localhost</HOSTNAME></font></div>
<div><font face="'courier new', monospace"> <VM_DIR>/var/lib/one/</VM_DIR></font></div><div><font face="'courier new', monospace"> <HID>1</HID></font></div><div><font face="'courier new', monospace"> <STIME>1324391103</STIME></font></div>
<div><font face="'courier new', monospace"> <ETIME>1324392594</ETIME></font></div><div><font face="'courier new', monospace"> <VMMMAD>vmm_dummy</VMMMAD></font></div><div>
<font face="'courier new', monospace"> <TMMAD>tm_shared</TMMAD></font></div>
<div><font face="'courier new', monospace"> <PSTIME>1324391103</PSTIME></font></div><div><font face="'courier new', monospace"> <PETIME>1324391103</PETIME></font></div><div>
<font face="'courier new', monospace"> <RSTIME>1324391103</RSTIME></font></div><div><font face="'courier new', monospace"> <RETIME>1324392594</RETIME></font></div><div><font face="'courier new', monospace"> <ESTIME>0</ESTIME></font></div>
<div><font face="'courier new', monospace"> <EETIME>0</EETIME></font></div><div><font face="'courier new', monospace"> <REASON>3</REASON></font></div><div><font face="'courier new', monospace"> </HISTORY></font></div>
<div><font face="'courier new', monospace"> <HISTORY></font></div><div><font face="'courier new', monospace"> <SEQ>1</SEQ></font></div><div><font face="'courier new', monospace"> <HOSTNAME>vm</HOSTNAME></font></div>
<div><font face="'courier new', monospace"> <VM_DIR>/var/lib/one/</VM_DIR></font></div><div><font face="'courier new', monospace"> <HID>0</HID></font></div><div><font face="'courier new', monospace"> <STIME>1324392594</STIME></font></div>
<div><font face="'courier new', monospace"> <ETIME>0</ETIME></font></div><div><font face="'courier new', monospace"> <VMMMAD>vmm_dummy</VMMMAD></font></div><div><font face="'courier new', monospace"> <TMMAD>tm_shared</TMMAD></font></div>
<div><font face="'courier new', monospace"> <PSTIME>1324392594</PSTIME></font></div><div><font face="'courier new', monospace"> <PETIME>1324392594</PETIME></font></div><div>
<font face="'courier new', monospace"> <RSTIME>1324392594</RSTIME></font></div><div><font face="'courier new', monospace"> <RETIME>0</RETIME></font></div><div><font face="'courier new', monospace"> <ESTIME>0</ESTIME></font></div>
<div><font face="'courier new', monospace"> <EETIME>0</EETIME></font></div><div><font face="'courier new', monospace"> <REASON>0</REASON></font></div><div><font face="'courier new', monospace"> </HISTORY></font></div>
<div><font face="'courier new', monospace"> </HISTORY_RECORDS></font></div></div><div><font face="'courier new', monospace"></VM></font></div><div><br></div><div>Regards.</div><div><br></div>
<div>
[1] <a href="http://opennebula.org/documentation:rel3.0:vm_guide_2#virtual_machine_life-cycle">http://opennebula.org/documentation:rel3.0:vm_guide_2#virtual_machine_life-cycle</a></div><div>[2] <a href="http://opennebula.org/_media/documentation:rel3.0:states-complete.png">http://opennebula.org/_media/documentation:rel3.0:states-complete.png</a></div>
<div>[3] <a href="http://dev.opennebula.org/projects/opennebula/repository/revisions/one-3.0/entry/include/History.h">http://dev.opennebula.org/projects/opennebula/repository/revisions/one-3.0/entry/include/History.h</a><br clear="all">
<span style="border-collapse:collapse;color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px">--<br>Carlos Martín, MSc<br>Project Engineer<br>OpenNebula - The Open Source Toolkit for Data Center Virtualization<br>
<a href="http://www.OpenNebula.org" target="_blank">www.OpenNebula.org</a> | <a href="mailto:cmartin@opennebula.org" target="_blank">cmartin@opennebula.org</a> | <a href="http://twitter.com/opennebula" target="_blank">@OpenNebula</a></span><span style="border-collapse:collapse;color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px"><a href="mailto:cmartin@opennebula.org" style="color:rgb(42,93,176)" target="_blank"></a></span><br>
<br><br><div class="gmail_quote">On Sat, Dec 17, 2011 at 11:15 PM, richard -rw- weinberger <span dir="ltr"><<a href="mailto:richard.weinberger@gmail.com">richard.weinberger@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Ruben,<br>
<div class="im"><br>
On Sat, Dec 17, 2011 at 10:52 PM, Ruben S. Montero <<a href="mailto:rubensm@dacya.ucm.es">rubensm@dacya.ucm.es</a>> wrote:<br>
> Hi Richard,<br>
><br>
> This is now ready in 3.2 beta1. The networking hooks have been moved to a<br>
> driver form with better integration with the VM life-cycle. Among other<br>
> things this fixes the issues with live migrations stop/resumes etc...<br>
<br>
</div>Good to know. But I guess 3.2 is not yet production ready.<br>
<br>
Is there a way to install iptables rules for a guest upon migration on 3.0?<br>
I don't fear writing my own scripts...<br>
<div class="HOEnZb"><div class="h5"><br>
--<br>
Thanks,<br>
//richard<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opennebula.org">Users@lists.opennebula.org</a><br>
<a href="http://lists.opennebula.org/listinfo.cgi/users-opennebula.org" target="_blank">http://lists.opennebula.org/listinfo.cgi/users-opennebula.org</a><br>
</div></div></blockquote></div><br></div>