Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

facts: Detecting NVME partitions under Linux #39730

Merged
merged 1 commit into from
May 7, 2018

Conversation

ErwanAliasr1
Copy link
Contributor

SUMMARY

In the current state of the code, the nvme partitions are returned as empty as in :
"ansible_devices": {
"nvme0n1": {
"model": "SAMSUNG MZVLW256HEHP-000L7",
"partitions": {},

The parsing of the /sys/block/ try to find a disk named like :
as in sda1 for sda

But in the nvme context, the partition of nvme0n1 is named nvme0n1p1.
This add a possible 'p' between the diskname and the partname.

This patch simply add the option of having a 'p' between the diskname
and the partname.

The patch works on my host :
"model": "INTEL SSDPEDMD400G4",
"partitions": {
"nvme0n1p1": {
...
"size": "93.13 GB",
}

Fixes #38742
Signed-off-by: Erwan Velu erwan@redhat.com

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

fact

ANSIBLE VERSION

ansible 2.6.0
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/erwan/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Aug 4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]

ADDITIONAL INFORMATION

Before, there is no partitions for my nvme device, after it does show it.

"nvme0n1": {
"holders": [],
"host": "Non-Volatile memory controller: Intel Corporation PCIe Data Center SSD (rev 01)",
"links": {
"ids": [
"nvme-INTEL_SSDPEDMD400G4_CVFT623300HY400BGN",
"nvme-nvme.8086-43564654363233333030485934303042474e-494e54454c205353445045444d443430304734-00000001"
],
"labels": [],
"masters": [],
"uuids": []
},
"model": "INTEL SSDPEDMD400G4",
"partitions": {}
},

"nvme0n1": {
"holders": [],
"host": "Non-Volatile memory controller: Intel Corporation PCIe Data Center SSD (rev 01)",
"links": {
"ids": [
"nvme-INTEL_SSDPEDMD400G4_CVFT623300HY400BGN",
"nvme-nvme.8086-43564654363233333030485934303042474e-494e54454c205353445045444d443430304734-00000001"
],
"labels": [],
"masters": [],
"uuids": []
},
"model": "INTEL SSDPEDMD400G4",
"partitions": {
"nvme0n1p1": {
"holders": [],
"links": {
"ids": [
"lvm-pv-uuid-XN7bf3-l0QX-CEAi-cnWl-3QL5-FmeI-DhpLTO",
"nvme-INTEL_SSDPEDMD400G4_CVFT623300HY400BGN-part1",
"nvme-nvme.8086-43564654363233333030485934303042474e-494e54454c205353445045444d443430304734-00000001-part1"
],
"labels": [],
"masters": [],
"uuids": []
},
"sectors": "195312467",
"sectorsize": 512,
"size": "93.13 GB",
"start": "34",
"uuid": null
}
},

In the current state of the code, the nvme partitions are returned as empty as in :
        "ansible_devices": {
            "nvme0n1": {
                "model": "SAMSUNG MZVLW256HEHP-000L7",
                "partitions": {},

The parsing of the /sys/block/<diskname> try to find a disk named like :
    <diskname><x> as in sda1 for sda

But in the nvme context, the partition of nvme0n1 is named nvme0n1p1.
This add a possible 'p' between the diskname and the partname.

This patch simply add the option of having a 'p' between the diskname
and the partname.

The patch works on my host :
                "model": "INTEL SSDPEDMD400G4",
                "partitions": {
                    "nvme0n1p1": {
                         ...
                        "size": "93.13 GB",
                    }

Fixes ansible#38742
Signed-off-by: Erwan Velu <erwan@redhat.com>
@ansibot ansibot added bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels May 4, 2018
@mkrizek mkrizek requested a review from alikins May 4, 2018 11:02
@mkrizek mkrizek removed the needs_triage Needs a first human triage before being processed. label May 4, 2018
@ansibot

This comment has been minimized.

@ansibot ansibot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label May 4, 2018
@ErwanAliasr1
Copy link
Contributor Author

The issue reported is not related to my patch. Looks like this file needs some cleanup.
Can we go forward for a merge ?

@mattclay
Copy link
Member

mattclay commented May 4, 2018

The unrelated errors have been fixed. I've restarted CI for this PR.

@ErwanAliasr1
Copy link
Contributor Author

The failure is still unrelated to my changes. Can we merge it ? We need this patch ASAP to get a proper NVME support. Thx !

@evrardjp
Copy link
Contributor

evrardjp commented May 7, 2018

I'd prefer if we had testing, but I can't help on testing right now, so I'd rather this included, than this waiting for tests. Positive vote for me.

@gundalow gundalow merged commit 2214c74 into ansible:devel May 7, 2018
gundalow pushed a commit to gundalow/ansible that referenced this pull request May 7, 2018
In the current state of the code, the nvme partitions are returned as empty as in :
        "ansible_devices": {
            "nvme0n1": {
                "model": "SAMSUNG MZVLW256HEHP-000L7",
                "partitions": {},

The parsing of the /sys/block/<diskname> try to find a disk named like :
    <diskname><x> as in sda1 for sda

But in the nvme context, the partition of nvme0n1 is named nvme0n1p1.
This add a possible 'p' between the diskname and the partname.

This patch simply add the option of having a 'p' between the diskname
and the partname.

The patch works on my host :
                "model": "INTEL SSDPEDMD400G4",
                "partitions": {
                    "nvme0n1p1": {
                         ...
                        "size": "93.13 GB",
                    }

Fixes ansible#38742
Signed-off-by: Erwan Velu <erwan@redhat.com>
(cherry picked from commit 2214c74)
@ErwanAliasr1 ErwanAliasr1 deleted the 38742 branch May 7, 2018 15:46
abadger added a commit to abadger/ansible that referenced this pull request May 7, 2018
The pattern we're matching can have zero or one p.  Be more careful to
match exactly that.

Slight revision of ansible#39730
@abadger abadger mentioned this pull request May 7, 2018
abadger added a commit that referenced this pull request May 7, 2018
The pattern we're matching can have zero or one p.  Be more careful to
match exactly that.

Slight revision of #39730
abadger added a commit to gundalow/ansible that referenced this pull request May 7, 2018
The pattern we're matching can have zero or one p.  Be more careful to
match exactly that.

Slight revision of ansible#39730

(cherry picked from commit 7528398)
abadger pushed a commit that referenced this pull request May 7, 2018
* facts: Detecting NVME partitions under Linux (#39730)

In the current state of the code, the nvme partitions are returned as empty as in :
        "ansible_devices": {
            "nvme0n1": {
                "model": "SAMSUNG MZVLW256HEHP-000L7",
                "partitions": {},

The parsing of the /sys/block/<diskname> try to find a disk named like :
    <diskname><x> as in sda1 for sda

But in the nvme context, the partition of nvme0n1 is named nvme0n1p1.
This add a possible 'p' between the diskname and the partname.

This patch simply add the option of having a 'p' between the diskname
and the partname.

The patch works on my host :
                "model": "INTEL SSDPEDMD400G4",
                "partitions": {
                    "nvme0n1p1": {
                         ...
                        "size": "93.13 GB",
                    }

Fixes #38742
Signed-off-by: Erwan Velu <erwan@redhat.com>
(cherry picked from commit 2214c74)

* Use a more exact regex (#39811)

The pattern we're matching can have zero or one p.  Be more careful to
match exactly that.

Slight revision of #39730

(cherry picked from commit 7528398)
oolongbrothers pushed a commit to oolongbrothers/ansible that referenced this pull request May 12, 2018
In the current state of the code, the nvme partitions are returned as empty as in :
        "ansible_devices": {
            "nvme0n1": {
                "model": "SAMSUNG MZVLW256HEHP-000L7",
                "partitions": {},

The parsing of the /sys/block/<diskname> try to find a disk named like :
    <diskname><x> as in sda1 for sda

But in the nvme context, the partition of nvme0n1 is named nvme0n1p1.
This add a possible 'p' between the diskname and the partname.

This patch simply add the option of having a 'p' between the diskname
and the partname.

The patch works on my host :
                "model": "INTEL SSDPEDMD400G4",
                "partitions": {
                    "nvme0n1p1": {
                         ...
                        "size": "93.13 GB",
                    }

Fixes ansible#38742
Signed-off-by: Erwan Velu <erwan@redhat.com>
oolongbrothers pushed a commit to oolongbrothers/ansible that referenced this pull request May 12, 2018
The pattern we're matching can have zero or one p.  Be more careful to
match exactly that.

Slight revision of ansible#39730
oolongbrothers pushed a commit to oolongbrothers/ansible that referenced this pull request May 14, 2018
In the current state of the code, the nvme partitions are returned as empty as in :
        "ansible_devices": {
            "nvme0n1": {
                "model": "SAMSUNG MZVLW256HEHP-000L7",
                "partitions": {},

The parsing of the /sys/block/<diskname> try to find a disk named like :
    <diskname><x> as in sda1 for sda

But in the nvme context, the partition of nvme0n1 is named nvme0n1p1.
This add a possible 'p' between the diskname and the partname.

This patch simply add the option of having a 'p' between the diskname
and the partname.

The patch works on my host :
                "model": "INTEL SSDPEDMD400G4",
                "partitions": {
                    "nvme0n1p1": {
                         ...
                        "size": "93.13 GB",
                    }

Fixes ansible#38742
Signed-off-by: Erwan Velu <erwan@redhat.com>
oolongbrothers pushed a commit to oolongbrothers/ansible that referenced this pull request May 14, 2018
The pattern we're matching can have zero or one p.  Be more careful to
match exactly that.

Slight revision of ansible#39730
oolongbrothers pushed a commit to oolongbrothers/ansible that referenced this pull request May 14, 2018
In the current state of the code, the nvme partitions are returned as empty as in :
        "ansible_devices": {
            "nvme0n1": {
                "model": "SAMSUNG MZVLW256HEHP-000L7",
                "partitions": {},

The parsing of the /sys/block/<diskname> try to find a disk named like :
    <diskname><x> as in sda1 for sda

But in the nvme context, the partition of nvme0n1 is named nvme0n1p1.
This add a possible 'p' between the diskname and the partname.

This patch simply add the option of having a 'p' between the diskname
and the partname.

The patch works on my host :
                "model": "INTEL SSDPEDMD400G4",
                "partitions": {
                    "nvme0n1p1": {
                         ...
                        "size": "93.13 GB",
                    }

Fixes ansible#38742
Signed-off-by: Erwan Velu <erwan@redhat.com>
oolongbrothers pushed a commit to oolongbrothers/ansible that referenced this pull request May 14, 2018
The pattern we're matching can have zero or one p.  Be more careful to
match exactly that.

Slight revision of ansible#39730
tonal pushed a commit to tonal/ansible that referenced this pull request May 15, 2018
In the current state of the code, the nvme partitions are returned as empty as in :
        "ansible_devices": {
            "nvme0n1": {
                "model": "SAMSUNG MZVLW256HEHP-000L7",
                "partitions": {},

The parsing of the /sys/block/<diskname> try to find a disk named like :
    <diskname><x> as in sda1 for sda

But in the nvme context, the partition of nvme0n1 is named nvme0n1p1.
This add a possible 'p' between the diskname and the partname.

This patch simply add the option of having a 'p' between the diskname
and the partname.

The patch works on my host :
                "model": "INTEL SSDPEDMD400G4",
                "partitions": {
                    "nvme0n1p1": {
                         ...
                        "size": "93.13 GB",
                    }

Fixes ansible#38742
Signed-off-by: Erwan Velu <erwan@redhat.com>
tonal pushed a commit to tonal/ansible that referenced this pull request May 15, 2018
The pattern we're matching can have zero or one p.  Be more careful to
match exactly that.

Slight revision of ansible#39730
oolongbrothers pushed a commit to oolongbrothers/ansible that referenced this pull request May 15, 2018
In the current state of the code, the nvme partitions are returned as empty as in :
        "ansible_devices": {
            "nvme0n1": {
                "model": "SAMSUNG MZVLW256HEHP-000L7",
                "partitions": {},

The parsing of the /sys/block/<diskname> try to find a disk named like :
    <diskname><x> as in sda1 for sda

But in the nvme context, the partition of nvme0n1 is named nvme0n1p1.
This add a possible 'p' between the diskname and the partname.

This patch simply add the option of having a 'p' between the diskname
and the partname.

The patch works on my host :
                "model": "INTEL SSDPEDMD400G4",
                "partitions": {
                    "nvme0n1p1": {
                         ...
                        "size": "93.13 GB",
                    }

Fixes ansible#38742
Signed-off-by: Erwan Velu <erwan@redhat.com>
oolongbrothers pushed a commit to oolongbrothers/ansible that referenced this pull request May 15, 2018
The pattern we're matching can have zero or one p.  Be more careful to
match exactly that.

Slight revision of ansible#39730
oolongbrothers pushed a commit to oolongbrothers/ansible that referenced this pull request May 15, 2018
In the current state of the code, the nvme partitions are returned as empty as in :
        "ansible_devices": {
            "nvme0n1": {
                "model": "SAMSUNG MZVLW256HEHP-000L7",
                "partitions": {},

The parsing of the /sys/block/<diskname> try to find a disk named like :
    <diskname><x> as in sda1 for sda

But in the nvme context, the partition of nvme0n1 is named nvme0n1p1.
This add a possible 'p' between the diskname and the partname.

This patch simply add the option of having a 'p' between the diskname
and the partname.

The patch works on my host :
                "model": "INTEL SSDPEDMD400G4",
                "partitions": {
                    "nvme0n1p1": {
                         ...
                        "size": "93.13 GB",
                    }

Fixes ansible#38742
Signed-off-by: Erwan Velu <erwan@redhat.com>
oolongbrothers pushed a commit to oolongbrothers/ansible that referenced this pull request May 15, 2018
The pattern we're matching can have zero or one p.  Be more careful to
match exactly that.

Slight revision of ansible#39730
ilicmilan pushed a commit to ilicmilan/ansible that referenced this pull request Nov 7, 2018
In the current state of the code, the nvme partitions are returned as empty as in :
        "ansible_devices": {
            "nvme0n1": {
                "model": "SAMSUNG MZVLW256HEHP-000L7",
                "partitions": {},

The parsing of the /sys/block/<diskname> try to find a disk named like :
    <diskname><x> as in sda1 for sda

But in the nvme context, the partition of nvme0n1 is named nvme0n1p1.
This add a possible 'p' between the diskname and the partname.

This patch simply add the option of having a 'p' between the diskname
and the partname.

The patch works on my host :
                "model": "INTEL SSDPEDMD400G4",
                "partitions": {
                    "nvme0n1p1": {
                         ...
                        "size": "93.13 GB",
                    }

Fixes ansible#38742
Signed-off-by: Erwan Velu <erwan@redhat.com>
ilicmilan pushed a commit to ilicmilan/ansible that referenced this pull request Nov 7, 2018
The pattern we're matching can have zero or one p.  Be more careful to
match exactly that.

Slight revision of ansible#39730
@ansible ansible locked and limited conversation to collaborators May 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue/PR relates to a bug. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ansible_devices not populating partitions{} structure for NVMe devices
7 participants