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 1452454 - libvirt attach nvdimm device with invalid access type
Summary: libvirt attach nvdimm device with invalid access type
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.4
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: chhu
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-05-19 05:01 UTC by chhu
Modified: 2017-08-02 01:34 UTC (History)
6 users (show)

Fixed In Version: libvirt-3.2.0-6.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-02 01:34:35 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2017:1846 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2017-08-01 18:02:50 UTC

Description chhu 2017-05-19 05:01:21 UTC
Description of problem:
libvirt attach nvdimm device with invalid access type

Version-Release number of selected component (if applicable):
libvirt-3.2.0-5.el7.x86_64
qemu-kvm-rhev-2.9.0-4.el7.x86_64
kernel-3.10.0-660.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Create nvdimm file on the host:
     # truncate -s 512M /tmp/nvdimm
     # truncate -s 256M /tmp/nvdimm2

2. Start a guest with one nvdimm device successfully.
 <maxMemory slots='16' unit='M'>2048</maxMemory>
  <memory unit='M'>1024</memory>
  <currentMemory unit='M'>512</currentMemory>
  <vcpu placement='static'>4</vcpu>
  .......
  <cpu mode='host-model' check='partial'>
    <model fallback='allow'/>
    <topology sockets='2' cores='1' threads='1'/>
    <numa>
      <cell id='0' cpus='0-1' memory='512' unit='M'/>
      <cell id='1' cpus='2-3' memory='512' unit='M'/>
    </numa>
  </cpu>
......
         <memory model='nvdimm' access='shared'>
      <source>
        <path>/tmp/nvdimm</path>
      </source>
      <target>
        <size unit='M'>512</size>
        <node>1</node>
        <label>
          <size unit='KiB'>256</size>
        </label>
      </target>
      <address type='dimm' slot='0'/>
    </memory>
  </devices>

3. Try to attach a nvdimm device with access='shar', attached the device, the access='(null)'
# cat  nvdimm.xml
   <memory model='nvdimm' access='shar'>
      <source>
        <path>/tmp/nvdimm2</path>
      </source>
      <target>
        <size unit='M'>256</size>
        <node>1</node>
         <label>
          <size unit='KiB'>128</size>
        </label>
      </target>
      <address type='dimm' slot='1'/>
    </memory>

# virsh attach-device r7-4 nvdimm.xml
Device attached successfully

# virsh dumpxml r7-4 | grep nvdimm -A 15
    <memory model='nvdimm' access='shared'>
      <source>
        <path>/tmp/nvdimm</path>
      </source>
      <target>
        <size unit='KiB'>524288</size>
        <node>1</node>
        <label>
          <size unit='KiB'>256</size>
        </label>
      </target>
      <alias name='nvdimm0'/>
      <address type='dimm' slot='0' base='0x100000000'/>
    </memory>
    <memory model='nvdimm' access='(null)'>
      <source>
        <path>/tmp/nvdimm2</path>
      </source>
      <target>
        <size unit='KiB'>262144</size>
        <node>1</node>
        <label>
          <size unit='KiB'>128</size>
        </label>
      </target>
      <alias name='nvdimm1'/>
      <address type='dimm' slot='1' base='0x11ffc0000'/>
    </memory>

Actual results:
Attached nvdimm device with access='shar' in step3, and the access='null' in dumpxml.

Expected results:
Get error in step3, as the access type should be 'shared' or 'private'.

Comment 2 Peter Krempa 2017-05-19 10:21:40 UTC
Fixed upstream:

commit 85d62624c5d02c38e00a275dc2b2957584454908
Author: Peter Krempa <pkrempa>
Date:   Fri May 19 10:25:00 2017 +0200

    conf: Don't assign value from ..TypeFromString directly to enum
    
    Enums are unsigned, so it's impossible to check whether the helper
    returned -1 for invalid conversions.

Comment 5 chhu 2017-06-09 05:56:41 UTC
Verified on packages:
libvirt-3.2.0-9.el7.x86_64
qemu-img-rhev-2.9.0-9.el7.x86_64
kernel-3.10.0-679.el7.x86_64

Test steps:
1. Create nvdimm file on the host:
     # truncate -s 512M /tmp/nvdimm
     # truncate -s 256M /tmp/nvdimm2

2. Start a guest with one nvdimm device successfully.
 <maxMemory slots='16' unit='M'>2048</maxMemory>
  <memory unit='M'>1024</memory>
  <currentMemory unit='M'>512</currentMemory>
  <vcpu placement='static'>4</vcpu>
  .......
  <cpu mode='host-model' check='partial'>
    <model fallback='allow'/>
    <topology sockets='2' cores='2' threads='1'/>
    <numa>
      <cell id='0' cpus='0-1' memory='512' unit='M'/>
      <cell id='1' cpus='2-3' memory='512' unit='M'/>
    </numa>
  </cpu>
......
         <memory model='nvdimm' access='shared'>
      <source>
        <path>/tmp/nvdimm</path>
      </source>
      <target>
        <size unit='M'>512</size>
        <node>0</node>
        <label>
          <size unit='KiB'>256</size>
        </label>
      </target>
      <address type='dimm' slot='0'/>
    </memory>
  </devices>

3. Try to attach a nvdimm device with access='shar', failed with error message.
# cat nvdimm.xml
   <memory model='nvdimm' access='shar'>
      <source>
        <path>/tmp/nvdimm2</path>
      </source>
      <target>
        <size unit='M'>256</size>
        <node>1</node>
         <label>
          <size unit='KiB'>128</size>
        </label>
      </target>
      <address type='dimm' slot='1'/>
    </memory>

# virsh attach-device r7t nvdimm.xml
error: Failed to attach device from nvdimm.xml
error: XML error: invalid access mode 'shar'

4. Edit the access='shared', attach the nvdimm device to the guest.
# virsh attach-device r7t nvdimm.xml
Device attached successfully

Comment 6 errata-xmlrpc 2017-08-02 01:34:35 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://access.redhat.com/errata/RHEA-2017:1846


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