aboutsummaryrefslogtreecommitdiff
path: root/qmp.c
diff options
context:
space:
mode:
authorLin Ma <lma@suse.com>2015-03-30 16:36:28 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2015-04-01 10:06:38 +0200
commitd6edb15576643ab348a9f73e115c2e037edf7460 (patch)
tree54365e3a269416ad3fac1efee0a9c320754f9185 /qmp.c
parent033a20359aaf93f4d8aa2be12558901e8e028baa (diff)
qom: Add can_be_deleted callback to UserCreatableClass
If backends implement the can_be_deleted and it returns false, Then the qmp_object_del won't delete the given backends. Signed-off-by: Lin Ma <lma@suse.com> Message-Id: <1427704589-7688-2-git-send-email-lma@suse.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'qmp.c')
-rw-r--r--qmp.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/qmp.c b/qmp.c
index c479e7751c..e6c70504df 100644
--- a/qmp.c
+++ b/qmp.c
@@ -711,6 +711,11 @@ void qmp_object_del(const char *id, Error **errp)
error_setg(errp, "object id not found");
return;
}
+
+ if (!user_creatable_can_be_deleted(USER_CREATABLE(obj), errp)) {
+ error_setg(errp, "%s is in use, can not be deleted", id);
+ return;
+ }
object_unparent(obj);
}