That is in fact a LVM limitation of the default config that is targetted at low multi-scanning and general compatibility with older setups.
You'll find in /etc/lvm/lvm.conf a disabled line like:
# filter = [ "a|.*/|" ]
That means that it will consider /dev/* but not more - in particular not /dev/disk/by-...
If you configure lvm to consider the paths you want (it will pick up the first it finds with metadata, so I made it ONLY by path)
filter =[ "a|/dev/disk/by-path/.*|" ]
I wasn't sure what to reload, so I restarted all (might be too much)
$ sudo systemctl restart lvm2-lvmetad.service lvm2-monitor.service lvm2-lvmpolld.service
Now things work as you expected:
$ sudo /sbin/pvcreate /dev/disk/by-path/virtio-pci-0000:00:07.0
Physical volume "/dev/disk/by-path/virtio-pci-0000:00:07.0" successfully created.
ubuntu@cosmic-storage-pools:~$ sudo pvdisplay
"/dev/disk/by-path/pci-0000:00:07.0" is a new physical volume of "30.00 MiB"
--- NEW Physical volume ---
PV Name /dev/disk/by-path/pci-0000:00:07.0
VG Name
PV Size 30.00 MiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID mwk7tq-fZ1C-zElW-u0Qy-KlqJ-PUK0-BVHOpz
That would fix things on the LVM side to be as libvirt expects.
Interestingly libvirt still can't start the pool now.
Haven't looked yet further, need to check what and how it parses in libvirt to get to the conclusion that it is not existing.
As now pvs looks like:
$ sudo /sbin/pvs --noheadings -o pv_name,vg_name
/dev/disk/by-path/pci-0000:00:07.0 testpool1
That is in fact a LVM limitation of the default config that is targetted at low multi-scanning and general compatibility with older setups.
You'll find in /etc/lvm/lvm.conf a disabled line like:
# filter = [ "a|.*/|" ]
That means that it will consider /dev/* but not more - in particular not /dev/disk/by-...
If you configure lvm to consider the paths you want (it will pick up the first it finds with metadata, so I made it ONLY by path) disk/by- path/.* |" ]
filter =[ "a|/dev/
I wasn't sure what to reload, so I restarted all (might be too much) service lvm2-monitor. service lvm2-lvmpolld. service
$ sudo systemctl restart lvm2-lvmetad.
Now things work as you expected: by-path/ virtio- pci-0000: 00:07.0 by-path/ virtio- pci-0000: 00:07.0" successfully created. cosmic- storage- pools:~ $ sudo pvdisplay disk/by- path/pci- 0000:00: 07.0" is a new physical volume of "30.00 MiB" by-path/ pci-0000: 00:07.0 fZ1C-zElW- u0Qy-KlqJ- PUK0-BVHOpz
$ sudo /sbin/pvcreate /dev/disk/
Physical volume "/dev/disk/
ubuntu@
"/dev/
--- NEW Physical volume ---
PV Name /dev/disk/
VG Name
PV Size 30.00 MiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID mwk7tq-
That would fix things on the LVM side to be as libvirt expects.
Interestingly libvirt still can't start the pool now.
Haven't looked yet further, need to check what and how it parses in libvirt to get to the conclusion that it is not existing. disk/by- path/pci- 0000:00: 07.0 testpool1
As now pvs looks like:
$ sudo /sbin/pvs --noheadings -o pv_name,vg_name
/dev/