All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 19/18] Modify nbd hostonly checking to use check_block_and_slaves.
@ 2009-08-16 23:24 Victor Lowther
       [not found] ` <1a4c4015bc85feeb9fbf95a9d1e9adfb2de8e897.1250465033.git.victor.lowther-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Victor Lowther @ 2009-08-16 23:24 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA

This allows hostonly nbd checking to work in more exotic situations,
such as mdraid/dmraid/lvm/crypt on top of nbd.

---
 modules.d/95nbd/check |   31 ++++++++++++++++++++-----------
 1 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/modules.d/95nbd/check b/modules.d/95nbd/check
dissimilarity index 63%
index f94d63b..1443129 100755
--- a/modules.d/95nbd/check
+++ b/modules.d/95nbd/check
@@ -1,11 +1,20 @@
-#!/bin/sh
-# We depend on network modules being loaded
-[ "$1" = "-d" ] && echo network
-
-# If hostonly was requested, fail the check if we are not actually
-# booting from root.
-[ "$1" = "-h" ] && ! egrep -q '/ /dev/nbd[0-9]*' /proc/mounts && exit 1
-
-# If our prerequisites are not met, fail anyways.
-which nbd-client >/dev/null 2>&1 || exit 1
-exit 0
+#!/bin/bash
+# We depend on network modules being loaded
+[ "$1" = "-d" ] && echo network
+
+# If our prerequisites are not met, fail.
+which nbd-client >/dev/null 2>&1 || exit 1
+
+is_nbd() { [[ -b /dev/block/$1 && $1 == 43:* ]] }
+
+. $dracutfunctions
+
+# if an nbd device is not somewhere in the chain of devices root is mounted on,
+# fail the hostonly check.
+[ "$1" = "-h" ] && {
+    rootdev=$(find_root_block_device)
+    [[ -b /dev/block/$rootdev ]] || exit 1
+    check_block_and_slaves is_nbd "$rootdev" || exit 1
+}
+
+exit 0
-- 
1.6.0.4

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 19/18] Modify nbd hostonly checking to use check_block_and_slaves.
       [not found] ` <1a4c4015bc85feeb9fbf95a9d1e9adfb2de8e897.1250465033.git.victor.lowther-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2009-08-25 15:00   ` Warren Togami
       [not found]     ` <4A93FC92.1010305-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Warren Togami @ 2009-08-25 15:00 UTC (permalink / raw)
  To: Victor Lowther, initramfs

On 08/16/2009 07:24 PM, Victor Lowther wrote:
> +# if an nbd device is not somewhere in the chain of devices root is mounted on,
> +# fail the hostonly check.
> +[ "$1" = "-h" ]&&  {
> +    rootdev=$(find_root_block_device)
> +    [[ -b /dev/block/$rootdev ]] || exit 1
> +    check_block_and_slaves is_nbd "$rootdev" || exit 1
> +}

When will this ever work?  More often than not you would be generating a 
netboot in a chroot of the image.  You almost never generate the initrd 
on the running netbooted system.

Warren Togami
wtogami-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 19/18] Modify nbd hostonly checking to use check_block_and_slaves.
       [not found]     ` <4A93FC92.1010305-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-08-25 16:52       ` Victor Lowther
  0 siblings, 0 replies; 3+ messages in thread
From: Victor Lowther @ 2009-08-25 16:52 UTC (permalink / raw)
  To: Warren Togami; +Cc: initramfs

On Aug 25, 2009, at 10:00 AM, Warren Togami <wtogami-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:

> On 08/16/2009 07:24 PM, Victor Lowther wrote:
>> +# if an nbd device is not somewhere in the chain of devices root  
>> is mounted on,
>> +# fail the hostonly check.
>> +[ "$1" = "-h" ]&&  {
>> +    rootdev=$(find_root_block_device)
>> +    [[ -b /dev/block/$rootdev ]] || exit 1
>> +    check_block_and_slaves is_nbd "$rootdev" || exit 1
>> +}
>
> When will this ever work?  More often than not you would be  
> generating a netboot in a chroot of the image.

Hmmm... I will have to think about that. Dracut needs to grow a -- 
root= option anyways, and mixing that functionality in with the -- 
hostonly functionality I have been working on seems like an obvious win.

>  You almost never generate the initrd on the running netbooted system.

This is not an area I work in too often, but is there a particular  
reason why not?

> Warren Togami
> wtogami-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2009-08-25 16:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-16 23:24 [PATCH 19/18] Modify nbd hostonly checking to use check_block_and_slaves Victor Lowther
     [not found] ` <1a4c4015bc85feeb9fbf95a9d1e9adfb2de8e897.1250465033.git.victor.lowther-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-08-25 15:00   ` Warren Togami
     [not found]     ` <4A93FC92.1010305-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-08-25 16:52       ` Victor Lowther

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.