On 03/27/13 17:25, Laine Stump wrote:
On 03/27/2013 11:39 AM, Peter Krempa wrote:On 03/27/13 16:22, Laine Stump wrote:On 03/21/2013 12:42 PM, Peter Krempa wrote:The man page states that with --config the next boot is affected. This can be understood as if _only_ the next bood was affected. This isn't true if the machine is running.Are you certain of that? My understanding was that when --config was specified, *only* the persistent config should be changed, but not the live state, regardless of whether or not the domain is running. Otherwise, there is no way to change just the persistent config of a running domain.Yes, that's why I'm doing this. Before this patch --config meant "modify the persistent config along with the live change" and there was no way to use this virsh command to change the next-boot config if the domain was running.Or is your explanation incorrect, and the code correct? Here is what I *thought* was the meaning of these options: --config - only change the persistent config, but not the live state. The command should fail for a transient domain. --live - only change the live state, but not the persistent config. The command should fail for a domain that isn't running. --current - useless (really, I mean that) because its meaning is different depending on whether or not the domain is runningYes those we understand in the same way.--persistent - deprecated synonym for --configThis used to be the synonym for config, but this might be undestood as the option you are missing later on ...no option - also useless because it means the same thing as --current What's missing: a way to say "change both live state and persistent config as appropriate"Well, this patch would abuse the --persistent flag for this purpose. It adds _CONFIG always and _LIVE in case the domain is up.After discussing it on the list, in the name of consistency I actually very reluctantly implemented this same logic for virsh net-update even though I thought it was terrible. Did I get it wrong?No, you've got it correct. Well, except for --persistent but I'm less sure about that than you.So what is the *real* meaning of each of these options? (and are you sure you're not changing the meaning of any of them?)Except for --persistent, the meaning seems to be well defined now and used appropriately in new places. The problem is with the legacy API's that didn't take up on this approach yet.I'm concerned about changing the meaning of any existing option, which creates trouble for any existing script that uses the options. An example of the effects of this can be seen in this thread: https://www.redhat.com/archives/libvirt-users/2013-March/msg00108.html In short, netfilter changed the meaning of the iptables commandline --ctdir option which, although it was incorrect, had already been in release versions for 2 years. By changing this option, with no way to detect presence/absence of the change short of this very heroic effort by stefanb: https://www.redhat.com/archives/libvir-list/2013-March/msg01403.html they effectively made it unusable except in cases of packages that are closely tied to a specific version of kernel/netfilter. Although it's not listed in a .h file anywhere, commandline options *are* part of a public API, and shouldn't be changed after they've been in an official release (unless they were broken to the point that nobody would have been able to use them anyway).
Looking through really old versions of virsh I found that the --persistent flag was used in the meaning "make this live change also affect next boot" afterwards we decided to shed --persistent for --config with a pure rename. this change introduced the discrepancy between the original use of --persistent and the new meaning of --config.
Right now, I don't feel like introducing yet another set of domain modification scope flags and I'd rather fix all the improper uses of --config to be uniform and try to preserve the original meaning of the --persistent flag as it seems useful to me.
Summary of the changed behavior: 1.) --persistent behaves like it has since it was introduced 2.) --persistent is documented again3.) --config no longer influences the live guest (it isn't doing so in other places, this behavior is known from other places and (sort-of) documented) 4.) the user is able to force use of the new API that has better specified behavior as in the case of the api without flags.
In case we decide against this slight change (on running domain --config won't longer influence the running state) my approach to fix the user confusion will be very different. I'll leave the code in place as-is and I will only document that the --config flag behaves differently on these API's compared to other places.
The reason I started doing this is user confusion because of the different meaning and bad docs.
I don't really care that much about the change, but it's always nice to have stuff done in a consistent way, so I proposed this.