[libvirt] [PATCH] Make virsh setmaxmem balloon only when successful.

Chris Lalancette clalance at redhat.com
Tue Jul 20 13:52:24 UTC 2010

On 07/20/10 - 09:38:45AM, Jiri Denemark wrote:
> But when we decide to do that and shrink current memory in case it's bigger
> than the new maximum, what should we do if the shrinking fails? The command
> would fail while the maximum amount of memory for the domain was in fact
> updated correctly. Perhaps we should rollback and restore the old maximum if
> shrinking fails?
> I think we need to either fix virsh man page or the code or even both.
> Personally, I'd vote for removing SetMemory call from setmaxmem command and
> just doing what man page says but I'm not sure we can do that since people may
> rely on current behavior even though it differs from what's documented.

Yes, this command is a bit sticky with respect to handling errors.  First, I
don't think that we can change the current behavior; it *is* logical, and like
you say, I think people will probably be depending on it.  Second, I think
we should probably do like you say and if the shrink fails, then rollback the
max change.  Of course the rollback could fail, in which case everything is
confused, but I think that will be a much rarer situation than the ballooning
failing.  I'll put this on my TODO list.

> Anyway, the behavior with your patch is much better than before, so ACK to the
> patch. We can discuss and fix the rest in a separate patch.

Thanks, I've pushed this now.

Chris Lalancette

More information about the libvir-list mailing list