Bug 1980199

Summary: virsh setmem --config doesn't work well when vm is not running
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: Jing Qi <jinqi>
Component: libvirtAssignee: Pavel Hrdina <phrdina>
Status: CLOSED ERRATA QA Contact: Jing Qi <jinqi>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.5CC: jdenemar, lmen, phrdina, virt-maint, xuzhang, yidliu
Target Milestone: rcKeywords: Regression, Triaged
Target Release: 8.5   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-7.6.0-1.module+el8.5.0+12097+2c77910b Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-16 07:55:01 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version: 7.6.0
Embargoed:

Description Jing Qi 2021-07-08 05:01:08 UTC
Description of problem:
virsh setmem --config doesn't work well when vm is not running

Version-Release number of selected component (if applicable):
libvirt-daemon-7.5.0-1.module+el8.5.0+11664+59f87560.x86_64
qemu-kvm-6.0.0-21.module+el8.5.0+11555+e0ab0d09.x86_64

How reproducible:
Always

Steps to Reproduce:

1. prepare a vm -
   <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>

2. virsh setmem avocado-vt-vm1 3G --config
error: Requested operation is not valid: domain is not running


Actual results:

setmem failed

Expected results:
setmem succeed

Additional info:
The cmd worked in other versions.

Comment 1 Pavel Hrdina 2021-07-23 09:30:16 UTC
Upstream commit:

commit dc721f99df82ccc652624fc2940251722d83f435
Author: Pavel Hrdina <phrdina>
Date:   Thu Jul 22 21:00:50 2021 +0200

    virsh: fix setmem flags logic

v7.5.0-195-gdc721f99df

Comment 2 Jing Qi 2021-07-28 05:14:14 UTC
Tested with libvirt upstream version v7.6.0-rc1 & qemu-6.0.0-11.fc35.x86_64

1. Create domain with below memory configuration in domain xml - 
<maxMemory slots='16' unit='KiB'>8388608</maxMemory>
  <memory unit='KiB'>3133439</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>
  
2.# virsh setmem pc 1G --config   

  No error.
3.# virsh edit pc

<maxMemory slots='16' unit='KiB'>8388608</maxMemory>
  <memory unit='KiB'>3133439</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>

Comment 3 Jing Qi 2021-08-03 02:21:02 UTC
Verified with libvirt-7.6.0-1.module+el8.5.0+12097+2c77910b.x86_64 & qemu-kvm-6.0.0-21.module+el8.5.0+11555+e0ab0d09.x86_64

Steps are the same with Comment 2.

Comment 6 errata-xmlrpc 2021-11-16 07:55:01 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (virt:av bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:4684