On 01/22/2016 04:36 PM, zhanghailiang wrote:
Signed-off-by: zhanghailiang <address@hidden>
---
net/filter.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/filter.c b/net/filter.c
index a126a3b..4aafff0 100644
--- a/net/filter.c
+++ b/net/filter.c
@@ -323,11 +323,19 @@ static void netfilter_finalize(Object *obj)
g_free(nf->netdev_id);
}
+static bool netfilter_can_be_deleted(UserCreatable *uc, Error **errp)
+{
+ NetFilterState *nf = NETFILTER(uc);
+ /* Forbid the default filter to be deleted */
+ return !nf->is_default;
+}
+
static void netfilter_class_init(ObjectClass *oc, void *data)
{
UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc);
ucc->complete = netfilter_complete;
+ ucc->can_be_deleted = netfilter_can_be_deleted;
}
static const TypeInfo netfilter_info = {
This looks unnecessary. As I replied in previous mails, there's no need
to differ default netfilter from others. For COLO specifically, I know
it's a kind of mis-configuration you want to avoid, but that's not the
business of qemu. (Even if this is accepted, user could still mis
configure the netfitler that can break COLO).