Am 23.02.23 um 16:01 schrieb DERUMIER, Alexandre: > >>> + die "No more available blocks in virtiomem to balance all >>> requested memory\n" >>> + if $target_total < 0; >> >> I fee like this message is a bit confusing. This can only happen on >> unplug, right? > yes,unplug only. (when guest os set memory block as unmovable). > I don't see case where it doesn't work on hotplug. > >> And reading that "no more blocks are available" sounds >> like a paradox then. It's rather that no more blocks can be >> unplugged. >> >> If we really want to, if the $target_total is negative, we could set >> it >> to 0 (best to do it at the call-side already) and try to unplug >> everything else? We won't reach the goal anymore, but we could still >> get >> closer to it in some cases. > > yes, good idea > >> Would need a bit more adaptation to avoid an >> endless loop: we also need to stop if all devices reached their >> current >> goal this round (and no new errors appeared), e.g. >> balance_virtiomem() >> could just have that info as its return value. >> > > I think we should still die with an error message in this case,(maybe > at the end of balance_virtiomem). We still have some memory not removed > in all cases if target_memory was < 0; >
Sure, we still should die at the end. > something like: > > > my sub balance_virtiomem { > my ($vmid, $virtiomems, $blocksize, $target_total) = @_; > > my $nb_virtiomem = scalar(grep { !$_->{error} } values $virtiomems- >> %*); > > print"try to balance memory on $nb_virtiomem virtiomems\n"; > > my $target_total_err = undef; > if($target_total < 0) { > $target_total = 0; > $target_total_err = 1; > } > > ... > while ($total_finished != $nb_virtiomem) { > ... > } > ... > > die "No more virtiomem devices left to try to balance the remaining > memory\n" > if $target_total_err; > } > > Yes, like this we make one final round, which is good enough IMHO. _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel