mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
filter: Add handle_event method for NetFilterClass
Filter needs to process the event of checkpoint/failover or other event passed by COLO frame. Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com> Signed-off-by: Zhang Chen <zhangckid@gmail.com> Signed-off-by: Zhang Chen <chen.zhang@intel.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
parent
d1955d2219
commit
5fbba3d659
3 changed files with 41 additions and 0 deletions
17
net/filter.c
17
net/filter.c
|
@ -17,6 +17,8 @@
|
|||
#include "net/vhost_net.h"
|
||||
#include "qom/object_interfaces.h"
|
||||
#include "qemu/iov.h"
|
||||
#include "net/colo.h"
|
||||
#include "migration/colo.h"
|
||||
|
||||
static inline bool qemu_can_skip_netfilter(NetFilterState *nf)
|
||||
{
|
||||
|
@ -245,11 +247,26 @@ static void netfilter_finalize(Object *obj)
|
|||
g_free(nf->netdev_id);
|
||||
}
|
||||
|
||||
static void default_handle_event(NetFilterState *nf, int event, Error **errp)
|
||||
{
|
||||
switch (event) {
|
||||
case COLO_EVENT_CHECKPOINT:
|
||||
break;
|
||||
case COLO_EVENT_FAILOVER:
|
||||
object_property_set_str(OBJECT(nf), "off", "status", errp);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void netfilter_class_init(ObjectClass *oc, void *data)
|
||||
{
|
||||
UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc);
|
||||
NetFilterClass *nfc = NETFILTER_CLASS(oc);
|
||||
|
||||
ucc->complete = netfilter_complete;
|
||||
nfc->handle_event = default_handle_event;
|
||||
}
|
||||
|
||||
static const TypeInfo netfilter_info = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue