diff options
author | Richard Yao <[email protected]> | 2015-07-06 11:20:11 -0400 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2015-07-10 12:21:14 -0700 |
commit | 541da9935d07ad40fb5e000114d9c904c2dde632 (patch) | |
tree | 53b4f8fb4a181b01b319cc51b2666eb89481372f /lib/libzfs | |
parent | 98cb3a76559cb1187f77af1d6a08d4f9b7b14aa0 (diff) |
Fix Xen Virtual Block Device detection
We fail to make partitions on xvd (Xen Virtual Block) devices. This also
causes debug builds of zpool create to return an error when given xen
virtual block devices. These devices should be given the same treatment
as vd (KVM Virtual Block) devices, so we adjust the relevant code paths.
Signed-off-by: Richard Yao <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #3576
Diffstat (limited to 'lib/libzfs')
-rw-r--r-- | lib/libzfs/libzfs_pool.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c index fe26abeb7..a730a94e0 100644 --- a/lib/libzfs/libzfs_pool.c +++ b/lib/libzfs/libzfs_pool.c @@ -3378,7 +3378,7 @@ set_path(zpool_handle_t *zhp, nvlist_t *nv, const char *path) * forms: "-partX", "pX", or "X", where X is a string of digits. The second * case only occurs when the suffix is preceded by a digit, i.e. "md0p0" The * third case only occurs when preceded by a string matching the regular - * expression "^[hs]d[a-z]+", i.e. a scsi or ide disk. + * expression "^([hsv]|xv)d[a-z]+", i.e. a scsi, ide, virtio or xen disk. */ static char * strip_partition(libzfs_handle_t *hdl, char *path) @@ -3391,8 +3391,11 @@ strip_partition(libzfs_handle_t *hdl, char *path) } else if ((part = strrchr(tmp, 'p')) && part > tmp + 1 && isdigit(*(part-1))) { d = part + 1; - } else if ((tmp[0] == 'h' || tmp[0] == 's') && tmp[1] == 'd') { + } else if ((tmp[0] == 'h' || tmp[0] == 's' || tmp[0] == 'v') && + tmp[1] == 'd') { for (d = &tmp[2]; isalpha(*d); part = ++d); + } else if (strncmp("xvd", tmp, 3) == 0) { + for (d = &tmp[3]; isalpha(*d); part = ++d); } if (part && d && *d != '\0') { for (; isdigit(*d); d++); |