|
From: | Dryden Personalis |
Subject: | Re: [PATCH] Install to LVM PVs |
Date: | Sun, 08 May 2016 19:16:29 +0200 |
User-agent: | Roundcube Webmail/1.1.5 |
Andrei Borzenkov schreef op 08-05-2016 10:47:
08.05.2016 09:05, Andrei Borzenkov пишет:+#ifdef GRUB_UTIL +int +grub_util_is_lvm(grub_disk_t disk) +{ + struct grub_diskfilter_pv_id id; + struct grub_diskfilter_vg *vg; + grub_disk_addr_t start_sector; + vg = grub_lvm_detect(disk, &id, &start_sector); + if (! vg) + return 0; + /* don't free the vg, it's held by grub_diskfilter_vg_register */ + grub_free(id.uuid); + return 1; +} +This has side effect of adding duplicate VG definitions; this may later confuse grub. What about just checking array->driver for LVM? Go throughregistered arrays, find disk match and check array driver. See scan_disk_partition_iter () for example.Which is basically call grub_diskfilter_get_pv_from_disk() and check vg_out->driver.
This method also has the downside that is_lvm will fail without any indication as to why, when no volume group has been created. lvm_detect will return null because it can only return a VG. And, you cannot error out on that if a non-existing LVM should be okay.
So this call to lvm_detect is pretty annoying. If it had more info, I could at least give an error in setup.c.I am not sure whether installation is *possible* without a VG but it would be odd if it couldn't?
Anyway I would like a better error message on this because I just wasted 2 hours trying to get GRUB_UTIL to work and failing. That means as per your method I can probably distinguish between PV present and VG present (or not present).
Then the only way I know how to report back is to give more values to is_lvm, but do we need a VG? Why error out on no VG? I will test.
[Prev in Thread] | Current Thread | [Next in Thread] |