qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3 0/2] Add virtio-blk support to persistent-storage rules
@ 2010-06-25 13:59 Ryan Harper
  2010-06-25 13:59 ` [Qemu-devel] [PATCH 1/2] Add virtio-blk support to path_id Ryan Harper
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ryan Harper @ 2010-06-25 13:59 UTC (permalink / raw)
  To: linux-hotplug; +Cc: john cooper, Rusty Russell, qemu-devel, Ryan Harper

This patch series provides updates to udev to allow the creation symlinks for
virtio-blk devices, specifically disk/by-id and disk/by-path.  This is most
useful for virtio-blk devices that do not yet have any filesystem for which a
UUID can be extracted (disk/by-uuid).  These patches (save the path_id fix)
require an updated[1] qemu (on the host) and virtio-blk (in the guest)[2]  to
generate the by-id path; however if the guest or host qemu isn't capable
then no action is taken.

Changes since v2:
- Added 'serial' sysfs attribute to virtio-blk code upstream [2]
- Dropped VBID ioctl upstream [3]
- Switched rules to extract serial attributes directly

Changes since v1:
- Switch ID_VIRTIO_SERIAL to ID_SERIAL
- Switched IOCTL_CMD to use numeric value
- Add ID_SERIAL_SHORT
- Update persistent-storage rules to use ID_SERIAL for virtioblk_id


1. http://lists.gnu.org/archive/html/qemu-devel/2010-03/msg01869.html
2. https://lists.linux-foundation.org/pipermail/virtualization/2010-June/015326.html
3. https://lists.linux-foundation.org/pipermail/virtualization/2010-June/015325.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PATCH 1/2] Add virtio-blk support to path_id
  2010-06-25 13:59 [Qemu-devel] [PATCH v3 0/2] Add virtio-blk support to persistent-storage rules Ryan Harper
@ 2010-06-25 13:59 ` Ryan Harper
  2010-06-25 13:59 ` [Qemu-devel] [PATCH 2/2] Add virtio-blk by-id rules based on 'serial' attribute Ryan Harper
  2010-06-29 15:29 ` [Qemu-devel] Re: [PATCH v3 0/2] Add virtio-blk support to persistent-storage rules Kay Sievers
  2 siblings, 0 replies; 4+ messages in thread
From: Ryan Harper @ 2010-06-25 13:59 UTC (permalink / raw)
  To: linux-hotplug; +Cc: john cooper, Rusty Russell, qemu-devel, Ryan Harper

This patch adds a case handling path_id invoked on a virtio-blk device.
Currently path_id walks the parent path to virtio-pci but doesn't know
that it's the end of the path and exits without building the path (providing no
output resulting in no disk/by-path symlinks to virtio-blk devices).
This patch handles the virtio-pci path and updates the path accordingly.

/lib/udev/path_id --debug /block/vda
udev_device_new_from_syspath: device 0x2300120 has devpath '/devices/virtio-pci/virtio1/block/vda'
udev_device_new_from_syspath: device 0x2300380 has devpath '/devices/virtio-pci/virtio1'
udev_device_new_from_syspath: device 0x2300670 has devpath '/devices/virtio-pci'
ID_PATH=virtio-pci-virtio1

And with the current persistent-storage rules generates:

% ls -al /dev/disk/by-path | grep vda
lrwxrwxrwx. 1 root root   9 Jun  1 22:09 virtio-pci-virtio1 -> ../../vda

Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
---
 extras/path_id/path_id.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/extras/path_id/path_id.c b/extras/path_id/path_id.c
index dcee378..c19bfd0 100644
--- a/extras/path_id/path_id.c
+++ b/extras/path_id/path_id.c
@@ -448,6 +448,9 @@ int main(int argc, char **argv)
 		} else if (strcmp(subsys, "xen") == 0) {
 			path_prepend(&path, "xen-%s", udev_device_get_sysname(parent));
 			parent = skip_subsystem(parent, "xen");
+		} else if (strcmp(subsys, "virtio") == 0) {
+			path_prepend(&path, "virtio-pci-%s", udev_device_get_sysname(parent));
+			parent = skip_subsystem(parent, "virtio");
 		}
 
 		parent = udev_device_get_parent(parent);
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PATCH 2/2] Add virtio-blk by-id rules based on 'serial' attribute
  2010-06-25 13:59 [Qemu-devel] [PATCH v3 0/2] Add virtio-blk support to persistent-storage rules Ryan Harper
  2010-06-25 13:59 ` [Qemu-devel] [PATCH 1/2] Add virtio-blk support to path_id Ryan Harper
@ 2010-06-25 13:59 ` Ryan Harper
  2010-06-29 15:29 ` [Qemu-devel] Re: [PATCH v3 0/2] Add virtio-blk support to persistent-storage rules Kay Sievers
  2 siblings, 0 replies; 4+ messages in thread
From: Ryan Harper @ 2010-06-25 13:59 UTC (permalink / raw)
  To: linux-hotplug; +Cc: john cooper, Rusty Russell, qemu-devel, Ryan Harper

Using virtio-blk serial attributes add rules to extract drive serial numbers and
generate by-id links for the block device and partitions.

With these rules added, we now see the following symlinks in disk/by-id

% ls -al /dev/disk/by-id | grep vdb
lrwxrwxrwx. 1 root root   9 Jun  1 22:09 virtio-QM00001 -> ../../vda
lrwxrwxrwx. 1 root root  10 Jun  1 22:09 virtio-QM00001-part1 -> ../../vda1

Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
---
 rules/rules.d/60-persistent-storage.rules |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules
index 1f46041..6449e07 100644
--- a/rules/rules.d/60-persistent-storage.rules
+++ b/rules/rules.d/60-persistent-storage.rules
@@ -18,6 +18,10 @@ TEST=="whole_disk", GOTO="persistent_storage_end"
 # for partitions import parent information
 ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*"
 
+# virtio-blk
+KERNEL=="vd*[!0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}"
+KERNEL=="vd*[0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}-part%n"
+
 # USB devices use their own serial number
 KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p"
 # ATA devices with their own "ata" kernel subsystem
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Qemu-devel] Re: [PATCH v3 0/2] Add virtio-blk support to persistent-storage rules
  2010-06-25 13:59 [Qemu-devel] [PATCH v3 0/2] Add virtio-blk support to persistent-storage rules Ryan Harper
  2010-06-25 13:59 ` [Qemu-devel] [PATCH 1/2] Add virtio-blk support to path_id Ryan Harper
  2010-06-25 13:59 ` [Qemu-devel] [PATCH 2/2] Add virtio-blk by-id rules based on 'serial' attribute Ryan Harper
@ 2010-06-29 15:29 ` Kay Sievers
  2 siblings, 0 replies; 4+ messages in thread
From: Kay Sievers @ 2010-06-29 15:29 UTC (permalink / raw)
  To: Ryan Harper; +Cc: john cooper, Rusty Russell, linux-hotplug, qemu-devel

On Fri, Jun 25, 2010 at 15:59, Ryan Harper <ryanh@us.ibm.com> wrote:
> This patch series provides updates to udev to allow the creation symlinks for
> virtio-blk devices, specifically disk/by-id and disk/by-path.  This is most
> useful for virtio-blk devices that do not yet have any filesystem for which a
> UUID can be extracted (disk/by-uuid).  These patches (save the path_id fix)
> require an updated[1] qemu (on the host) and virtio-blk (in the guest)[2]  to
> generate the by-id path; however if the guest or host qemu isn't capable
> then no action is taken.

Thanks for solving it in this much simpler way. Both patches applied.

Kay

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-06-29 15:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-25 13:59 [Qemu-devel] [PATCH v3 0/2] Add virtio-blk support to persistent-storage rules Ryan Harper
2010-06-25 13:59 ` [Qemu-devel] [PATCH 1/2] Add virtio-blk support to path_id Ryan Harper
2010-06-25 13:59 ` [Qemu-devel] [PATCH 2/2] Add virtio-blk by-id rules based on 'serial' attribute Ryan Harper
2010-06-29 15:29 ` [Qemu-devel] Re: [PATCH v3 0/2] Add virtio-blk support to persistent-storage rules Kay Sievers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).