On Wed 02 Dec 2020 06:51:21 PM CET, Kevin Wolf wrote: >> I had tried this already and it does work when inserting the filter (we >> know that 'hd0-file' is about to be detached from the parent so we can >> put it in the list) but I don't think it's so easy if we want to remove >> the filter, i.e. >> >> hd0 -> throttle -> hd0-file ======> hd0 -> hd0-file >> >> In this case we get a similar error, we want to make hd0-file a child of >> hd0 but it is being used by the throttle filter. >> >> Telling bdrv_check_update_perm() to ignore hd0's current child >> (throttle) won't solve the problem. > > Isn't this the very same case as removing e.g. a mirror filter from the > chain? I'm sure we have already solved this somewhere. > > Hm, no, it might actually be different in that the throttle node > survives this, so we do have to check that the resulting graph is > valid. Do we need a combined operation to remove the throttle node > from the graph and immediately delete it?
What kind of API are you thinking about? One basic problem with inserting filter nodes (as opposed to replacing a node with a different one) is that we have a protocol BDS used twice at the same time, e.g. hd0 -> hd0-file throttle -> hd0-file And then we would reopen hd0 and do the change, but ideally one would prefer to avoid having hd0-file twice. There's also the x-blockdev-change function (currently for Quorum only), I wonder if it could be a better fit for this use case. Berto