Pino Toscano
2018-Dec-05 11:57 UTC
[Libguestfs] [PATCH] v2v: linux: improve regex for resume= entries (RHBZ#1651987)
Add few more characters for the devices of resume= entries in the command line of grub: this way it is possible to match also /dev/mapper devices. This should require no further processing, since the names of the /dev/mapper devices do not change after the conversion. --- v2v/convert_linux.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml index be4905473..945c3aa32 100644 --- a/v2v/convert_linux.ml +++ b/v2v/convert_linux.ml @@ -1004,7 +1004,7 @@ let convert (g : G.guestfs) inspect source output rcaps List.flatten (List.map Array.to_list (List.map g#aug_match paths)) in (* Map device names for each entry. *) - let rex_resume = PCRE.compile "^resume=(/dev/[a-z\\d]+)(.*)$" + let rex_resume = PCRE.compile "^resume=(/dev/[-a-z\\d/_]+)(.*)$" and rex_device_cciss = PCRE.compile "^/dev/(cciss/c\\d+d\\d+)(?:p(\\d+))?$" and rex_device = PCRE.compile "^/dev/([a-z]+)(\\d*)?$" in -- 2.17.2
Richard W.M. Jones
2018-Dec-05 12:01 UTC
Re: [Libguestfs] [PATCH] v2v: linux: improve regex for resume= entries (RHBZ#1651987)
On Wed, Dec 05, 2018 at 12:57:19PM +0100, Pino Toscano wrote:> Add few more characters for the devices of resume= entries in the > command line of grub: this way it is possible to match also /dev/mapper > devices. > > This should require no further processing, since the names of the > /dev/mapper devices do not change after the conversion.Yes this is what worried me, but I think you're right. Therefore, ACK. Rich.> v2v/convert_linux.ml | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml > index be4905473..945c3aa32 100644 > --- a/v2v/convert_linux.ml > +++ b/v2v/convert_linux.ml > @@ -1004,7 +1004,7 @@ let convert (g : G.guestfs) inspect source output rcaps > List.flatten (List.map Array.to_list (List.map g#aug_match paths)) in > > (* Map device names for each entry. *) > - let rex_resume = PCRE.compile "^resume=(/dev/[a-z\\d]+)(.*)$" > + let rex_resume = PCRE.compile "^resume=(/dev/[-a-z\\d/_]+)(.*)$" > and rex_device_cciss = PCRE.compile "^/dev/(cciss/c\\d+d\\d+)(?:p(\\d+))?$" > and rex_device = PCRE.compile "^/dev/([a-z]+)(\\d*)?$" in > > -- > 2.17.2 > > _______________________________________________ > Libguestfs mailing list > Libguestfs@redhat.com > https://www.redhat.com/mailman/listinfo/libguestfs-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
Pino Toscano
2018-Dec-05 12:18 UTC
Re: [Libguestfs] [PATCH] v2v: linux: improve regex for resume= entries (RHBZ#1651987)
On Wednesday, 5 December 2018 13:01:40 CET Richard W.M. Jones wrote:> On Wed, Dec 05, 2018 at 12:57:19PM +0100, Pino Toscano wrote: > > Add few more characters for the devices of resume= entries in the > > command line of grub: this way it is possible to match also /dev/mapper > > devices. > > > > This should require no further processing, since the names of the > > /dev/mapper devices do not change after the conversion. > > Yes this is what worried me, but I think you're right.I wanted to add an explanation out of the commit message, but apparently I overwrote it when re-exporting the patch... At least in my experience, guests may use /dev/mapper entries also in other places -- for example, a freshly installed Fedora 29 in VMware ESXi has in /etc/fstab: /dev/mapper/fedora_unused-root / xfs defaults 0 0 UUID=<some_uuid> /boot ext4 defaults 1 2 /dev/mapper/fedora_unused-swap swap swap defaults 0 0 Since the guest works fine (root & swap) after the conversion, and that so far we had no reports of problems due to /dev/mapper entries not changed, I thought that doing the same for resume= entries will cause any trouble. -- Pino Toscano
Apparently Analagous Threads
- Re: [PATCH] v2v: linux: improve regex for resume= entries (RHBZ#1651987)
- [PATCH] v2v: linux: correctly update resume=/dev/device entries (RHBZ#1532224)
- [PATCH v2 00/18] Replace many more uses of the Str module with PCRE.
- [PATCH v3 00/22] Replace almost all uses of the Str module with PCRE.
- [V2V PATCH v2 3/5] convert: introduce "block_driver" convert option