RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1131897 - virDomainSetMemoryFlags doesn't process flag VIR_DOMAIN_MEM_MAXIMUM for LXC
Summary: virDomainSetMemoryFlags doesn't process flag VIR_DOMAIN_MEM_MAXIMUM for LXC
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.1
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Libvirt Maintainers
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-08-20 09:00 UTC by Jincheng Miao
Modified: 2015-03-05 07:42 UTC (History)
6 users (show)

Fixed In Version: libvirt-1.2.8-1.el7
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-03-05 07:42:57 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:0323 0 normal SHIPPED_LIVE Low: libvirt security, bug fix, and enhancement update 2015-03-05 12:10:54 UTC

Description Jincheng Miao 2014-08-20 09:00:40 UTC
Description of problem:
virsh always pass flag 'VIR_DOMAIN_MEM_MAXIMUM' to virDomainSetMemoryFlags(),
but lxc driver doesn't process this flag yet. 

This causes failed to setmaxmem with flags for LXC domain.

Version-Release number of selected component (if applicable):
libvirt-1.2.7-1.el7.x86_64
kernel-3.10.0-145.el7.x86_64


How reproducible:
100%

Steps to Reproduce:
1. define and start a lxc guest
# virsh -c lxc:// dumpxml helloworld
<domain type='lxc'>
  <name>helloworld</name>
  <uuid>ed1955f7-4e72-40ae-8265-c193e7436c8a</uuid>
  <memory unit='KiB'>102400</memory>
  <currentMemory unit='KiB'>102400</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64'>exe</type>
    <init>/bin/sh</init>
  </os>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/libexec/libvirt_lxc</emulator>
    <filesystem type='mount' accessmode='passthrough'>
      <source dir='/'/>
      <target dir='/'/>
    </filesystem>
    <console type='pty' tty='/dev/pts/3'>
      <source path='/dev/pts/3'/>
      <target type='lxc' port='0'/>
      <alias name='console0'/>
    </console>
  </devices>
  <seclabel type='none' model='selinux'/>
</domain>

2. set max memory
# virsh -c lxc:// setmaxmem helloworld 102500 --config
error: Unable to change MaxMemorySize
error: unsupported flags (0x4) in function lxcDomainSetMemoryFlags

Expect result:
setmaxmem works with '--config' '--live' '--current'.

Comment 1 Erik Skultety 2014-09-16 08:37:07 UTC
Fixed upstream:

commit bd3b76e35502928a490465bbc1251546c01f00c3
Author: Chen Hanxiao <chenhanxiao.com>
Date:   Thu Jul 31 11:41:10 2014 +0800

    LXC: resolve issues in lxcDomainSetMaxMemory
    
    This patch changes the setmaxmem function to support the '--live',
    '--config', and '--current' flags by revectoring the code through
    the setmem function using the VIR_DOMAIN_MEM_MAXIMUM flag. The
    setmem code is refactored to handle both cases depending on the flag.
    
    The changed maxmem code for the MEM_MAXIMUM path will not allow
    modification to the memory values of an active guest unless the --config
    switch is used.
    
    Signed-off-by: Chen Hanxiao <chenhanxiao.com>

v1.2.7-55-gbd3b76e

Comment 3 Shanzhi Yu 2014-11-20 08:13:59 UTC
Try to verify this bug with libvirt-1.2.8-7.el7.x86_64

Steps:

1. define a lxc and start it 
# virsh  -c lxc:/// list 
 Id    Name                           State
----------------------------------------------------
 2218  helloworld                     running

2. try setmaxmem with "--config" "--live" "--current"

2.1 lxc is running

# virsh  -c lxc:/// setmaxmem helloworld 512M  --live 
error: Unable to change MaxMemorySize
error: Requested operation is not valid: Cannot resize the max memory on an active domain

# virsh  -c lxc:/// setmaxmem helloworld 512M  --current
error: Unable to change MaxMemorySize
error: Requested operation is not valid: Cannot resize the max memory on an active domain

# virsh  -c lxc:/// setmaxmem helloworld 512M  --config


2.2 lxc is shut off

# virsh  -c lxc:/// setmaxmem helloworld 512M  --live 
error: Unable to change MaxMemorySize
error: Requested operation is not valid: domain is not running

# virsh  -c lxc:/// setmaxmem helloworld 512M  --current

# virsh  -c lxc:/// setmaxmem helloworld 512M  --config

setmaxmem with "--live/--current" to a active lxc or qemu guest is not supported right now(even the upstream). So the result is expected and I would change this bug to verified status.

Comment 5 errata-xmlrpc 2015-03-05 07:42:57 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, 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://rhn.redhat.com/errata/RHSA-2015-0323.html


Note You need to log in before you can comment on or make changes to this bug.