qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v7 4/6] block: convert ThrottleGroup to object w


From: Manos Pitsidianakis
Subject: Re: [Qemu-devel] [PATCH v7 4/6] block: convert ThrottleGroup to object with QOM
Date: Tue, 22 Aug 2017 16:31:57 +0300
User-agent: NeoMutt/20170609-57-1e93be (1.8.3)

On Tue, Aug 22, 2017 at 03:25:41PM +0200, Alberto Garcia wrote:
+/* This function edits throttle_groups and must be called under the global
+ * mutex */
+static void throttle_group_obj_complete(UserCreatable *obj, Error **errp)
+{
+    ThrottleGroup *tg = THROTTLE_GROUP(obj);
+    ThrottleConfig cfg;
+
+    /* set group name to object id if it exists */
+    if (!tg->name && tg->parent_obj.parent) {
+        tg->name = object_get_canonical_path_component(OBJECT(obj));
+    }
+    /* We must have a group name at this point */
+    assert(tg->name);
+
+    /* error if name is duplicate */
+    if (throttle_group_exists(tg->name)) {
+            error_setg(errp, "A group with this name already exists");
+            return;
+    }
+
+    /* check validity */
+    throttle_get_config(&tg->ts, &cfg);
+    if (!throttle_is_valid(&cfg, errp)) {
+        return;
+    }

My fault here because I suggested its removal, but I actually think we
still need to call throttle_config() here so bkt->max is initialized in
throttle_fix_bucket(). I'll take care of updating this call once my
patches to remove throttle_fix_bucket() are applied, but for now we
still need it.

Oh yes, that is the reason I originally had done it but forgot why.

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]