Execute some commands as soon as teleport finishes

Discussion about using the VirtualBox API, Tutorials, Samples.
Post Reply
phate867
Posts: 3
Joined: 6. Mar 2014, 21:10

Execute some commands as soon as teleport finishes

Post by phate867 »

Here's my problem: my guest is attached to a tap bridge interface connected to an openvswitch implementation, call it vnet0.

Now, I start a live migration to another host, meanwhile my guest keeps receiving data on this vnet0 as it should.

Problem is that, when this guest is migrated on another host, it has to find a vnet0 interface there too.
But this inteface can be occupied by another guest.

So, providing I can create as much vnetx interfaces as I want, I'd like to change this setting as soon as the migration process is completed.
That is, guest finished migrating on the destination host? Fine. Select the first free vnetx interface (or create one on the fly) and change the guest configuration changing vnet0 to vnet1, for example, where vnet1 is the first free tap interface I can find.

Isn't there a listener/callback method which would allow me to do that?I would put the code into there.

edit:
even better: isn't there some callback to execute commands when a guest system is powered on?It should work on teleport too and, on the same time, I could make some generic code to create a vnetx interface on the fly when a machine powers up and attach that machine to it.
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Execute some commands as soon as teleport finishes

Post by noteirak »

You need to register for events on the IVirtualbox object and filter on MachineStateChange events. You should get events for the teleport too.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Post Reply