Hi, Baoquan
On 05/06/16 at 11:02am, Baoquan He wrote:
On 05/05/16 at 05:20pm, Pratyush Anand wrote:
> raw devices are not mounted and also does not need to contain any
> filesystem. So they may have UUIDs(when formatted) and may not have UUIDs
> when raw. Therefore, do not look for persistent names by-uuid for raw
> devices.
>
> Signed-off-by: Pratyush Anand <panand(a)redhat.com>
> Suggested-by: Dave Young <dyoung(a)redhat.com>
> ---
> mkdumprd | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/mkdumprd b/mkdumprd
> index 6e3d9757f3d8..ad40d2872f98 100644
> --- a/mkdumprd
> +++ b/mkdumprd
> @@ -30,14 +30,20 @@ perror() {
> }
>
I don't object this patch strongly. But seems it makes
get_persistent_dev from dracut implementation further and further. I am
not blaming this patch, just it's always Vivek's wish that we remove
this from kdump and reuse the counterpart in dracut. Well, leave the
decision to Dave and Xunlei.
For raw device, finding uuid make no sense, this is the reason of introducing
this code. For future cleanup with using dracut functions we may need change
dracut functions to allow the function to accept arguments about *blacklist*
dirs so that we can call the funtion with like --skip-dir=uuid for raw devices.
Since we are working on this rebuild issue, so leave the cleanup to later
should be fine.
In dracut there is an option for persistent_policy so that get_persistent_dev
can choose prefered dir first, but it is not our case because it is global
what we need is an argument to the fuction instead of the dracut.sh
> get_persistent_dev() {
> - local i _tmp _dev
> + local i _tmp _dev _lookup_dirs
>
> _dev=$(udevadm info --query=name --name="$1" 2>/dev/null)
> [ -z "$_dev" ] && {
> perror_exit "Kernel dev name of $1 is not found."
> }
>
> - for i in /dev/mapper/* /dev/disk/by-uuid/* /dev/disk/by-id/*; do
> + if [[ $2 = "raw" ]];then
> + _lookup_dirs="/dev/mapper/* /dev/disk/by-id/*"
> + else
> + _lookup_dirs="/dev/mapper/* /dev/disk/by-uuid/* /dev/disk/by-id/*"
> + fi
> +
> + for i in $_lookup_dirs; do
> _tmp=$(udevadm info --query=name --name="$i" 2>/dev/null)
> if [ "$_tmp" = "$_dev" ]; then
> echo $i
> @@ -138,7 +144,7 @@ to_mount() {
> _mntopts="$_target $_fstype $_options"
> #for non-nfs _dev converting to use udev persistent name
> if [ -b "$_source" ]; then
> - _pdev="$(get_persistent_dev $_source)"
> + _pdev="$(get_persistent_dev $_source $_fstype)"
> if [ $? -ne 0 ]; then
> return 1
> fi
> @@ -565,7 +571,7 @@ do
> dd if=$config_val count=1 of=/dev/null > /dev/null 2>&1 || {
> perror_exit "Bad raw disk $config_val"
> }
> - _praw=$(get_persistent_dev $config_val)
> + _praw=$(get_persistent_dev $config_val "raw")
> if [ $? -ne 0 ]; then
> exit 1
> fi
> --
> 2.5.5
>
Thanks
Dave