Skip to contentSkip to conversation

allow ifup bring up network manually even without netroot

PATCH Superseded Dave Young 2 participants 7 messages Dec 30, 2011 – Jan 13, 2012 3 messages not in the archive

lore
Share & tools
lore

Dave Young

author
#0 lore raw

PATCH v2 1/1 allow ifup bring up network manually even without netroot

For kdump we need scp vmcore to remote machine, the nic to be used is not limited to netroot one. we need a feature for manually bringing up
network interface. Also it is useful for emergency shell with
ssh-client for recovery or test purpose

I implement this by adding one argument to ifup script, user can use /sbin/ifup eth0 -m to bring up eth0, note ifup will regard it a manual operation for the nic specified in 1st argument if there's the 2nd argument.

If same nic is used for netroot the 2nd argument will be ignored, in this case we will leave netroot bring up it automatically to avoid side effect. And in this case hooks such as kdump will need to execute after netroot mounted.

ifup eth0 -m will create /tmp/net.eth0.manualup stamp file, later dhclient-script can check this and pass $2 to netroot, then netroot script will bring eth0 up

Thanks for comments and suggestions from David Dillow.

---
 modules.d/40network/dhclient-script |    8 ++
 modules.d/40network/ifup            |   97 ++++++++++++++++++++----------------
 modules.d/40network/netroot         |   86 ++++++++++++++++++-------------
 3 files changed, 111 insertions(+), 80 deletions(-)
modules.d/40network/dhclient-script +7 -1
Index: dracut/modules.d/40network/dhclient-script
===================================================================
@@ -74,7 +74,13 @@ case $reason in
             echo "$line"
         done >/tmp/dhclient.$netif.dhcpopts
         echo online > /sys/class/net/$netif/uevent
-        initqueue --onetime --name netroot-$netif netroot $netif
+
+        if [ -e /tmp/net.$netif.manualup ]; then
+            /sbin/netroot $netif -m
+            rm -f /tmp/net.$netif.manualup
+        else
+            initqueue --onetime --name netroot-$netif netroot $netif
+        fi
         ;;
     *) echo "dhcp: $reason";;
 esac
modules.d/40network/ifup +55 -42

123 lines not on this page · raw message

modules.d/40network/netroot +49 -37

117 lines not on this page · raw message

#1 lore raw
Quoted 10 lines · Dave Young

For kdump we need scp vmcore to remote machine, the nic to be used is not limited to netroot one. we need a feature for manually bringing up
network interface. Also it is useful for emergency shell with
ssh-client for recovery or test purpose

I implement this by adding one argument to ifup script, user can use /sbin/ifup eth0 -m to bring up eth0, note ifup will regard it a manual operation for the nic specified in 1st argument if there's the 2nd argument.

Quoted 9 lines

If same nic is used for netroot the 2nd argument will be ignored, in this case we will leave netroot bring up it automatically to avoid side effect. And in this case hooks such as kdump will need to execute after netroot mounted.

ifup eth0 -m will create /tmp/net.eth0.manualup stamp file, later dhclient-script can check this and pass $2 to netroot, then netroot script will bring eth0 up

As we talked on IRC, we still need to discuss if this is really needed, from kdump perspective. If we need to invoke ifup by ourselves, then we also need to determine which NIC we should bring up, this will make kdump code larger.

So, I hope, we can have some kernel cmdline (like ip=...) to tell dracut which NIC we want to bring up in the second kernel, provided by either ssh-client module or nfs module.

Let's see what Harald thinks...

author
#2 lore raw

Hi, I have some additional comments

Quoted 16 lines · Cong Wang
Quoted 15 lines · Dave Young

For kdump we need scp vmcore to remote machine, the nic to be used is not limited to netroot one. we need a feature for manually bringing up
network interface. Also it is useful for emergency shell with
ssh-client for recovery or test purpose

I implement this by adding one argument to ifup script, user can use /sbin/ifup eth0 -m to bring up eth0, note ifup will regard it a manual operation for the nic specified in 1st argument if there's the 2nd argument.

If same nic is used for netroot the 2nd argument will be ignored, in this case we will leave netroot bring up it automatically to avoid side effect. And in this case hooks such as kdump will need to execute after netroot mounted.

Quoted 7 lines
Quoted 4 lines

ifup eth0 -m will create /tmp/net.eth0.manualup stamp file, later dhclient-script can check this and pass $2 to netroot, then netroot script will bring eth0 up

As we talked on IRC, we still need to discuss if this is really needed, from kdump perspective.

manually ifup nic also benefit to emergency shell use case. I want to use dracut initramfs as a minimal system without real root for kernel testing

Quoted 7 lines

If we need to invoke ifup by
ourselves, then we also need to determine which NIC we should bring up, this will make kdump code larger.

So, I hope, we can have some kernel cmdline (like ip=...) to tell dracut which NIC we want to bring up in the second kernel, provided by either ssh-client module or nfs module.

If we need to pass the nic name to cmdline then we still need to determine which one should be use.

If we just bring up all nics, then use the manual ifup is also easy.

current dracut udev rules is: if there's no nic specified it will ifup all possible nics, but all will be put in initqueue which finally be brought up by netroot script.

Quoted 8 lines

Let's see what Harald thinks...

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Thanks
Dave

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#4 lore raw
Quoted 42 lines · Dave Young

Hi, I have some additional comments

Quoted 16 lines · Cong Wang
Quoted 15 lines · Dave Young

For kdump we need scp vmcore to remote machine, the nic to be used is not limited to netroot one. we need a feature for manually bringing up
network interface. Also it is useful for emergency shell with
ssh-client for recovery or test purpose

I implement this by adding one argument to ifup script, user can use /sbin/ifup eth0 -m to bring up eth0, note ifup will regard it a manual operation for the nic specified in 1st argument if there's the 2nd argument.

If same nic is used for netroot the 2nd argument will be ignored, in this case we will leave netroot bring up it automatically to avoid side effect. And in this case hooks such as kdump will need to execute after netroot mounted.

Quoted 7 lines
Quoted 4 lines

ifup eth0 -m will create /tmp/net.eth0.manualup stamp file, later dhclient-script can check this and pass $2 to netroot, then netroot script will bring eth0 up

As we talked on IRC, we still need to discuss if this is really needed, from kdump perspective.

manually ifup nic also benefit to emergency shell use case. I want to use dracut initramfs as a minimal system without real root for kernel testing

Quoted 7 lines

If we need to invoke ifup by
ourselves, then we also need to determine which NIC we should bring up, this will make kdump code larger.

So, I hope, we can have some kernel cmdline (like ip=...) to tell dracut which NIC we want to bring up in the second kernel, provided by either ssh-client module or nfs module.

Quoted 8 lines

If we need to pass the nic name to cmdline then we still need to determine which one should be use.

If we just bring up all nics, then use the manual ifup is also easy.

current dracut udev rules is: if there's no nic specified it will ifup all possible nics, but all will be put in initqueue which finally be brought up by netroot script.

And if without netroot cmdline set netroot script will just fail and return, so in this case ifup will act as nop

Quoted 12 lines
Quoted 9 lines

Let's see what Harald thinks...

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Thanks
Dave
#5 lore raw
In reply to a message not in the archive
Quoted 25 lines · Dave Young

Hi, I have some additional comments

Quoted 21 lines · Cong Wang
Quoted 19 lines · Dave Young

For kdump we need scp vmcore to remote machine, the nic to be used is not limited to netroot one. we need a feature for manually bringing up
network interface. Also it is useful for emergency shell with
ssh-client for recovery or test purpose

I implement this by adding one argument to ifup script, user can use /sbin/ifup eth0 -m to bring up eth0, note ifup will regard it a manual operation for the nic specified in 1st argument if there's the 2nd argument.

If same nic is used for netroot the 2nd argument will be ignored, in this case we will leave netroot bring up it automatically to avoid side effect. And in this case hooks such as kdump will need to execute after netroot mounted.

ifup eth0 -m will create /tmp/net.eth0.manualup stamp file, later dhclient-script can check this and pass $2 to netroot, then netroot script will bring eth0 up

Quoted 7 lines
Quoted 2 lines

As we talked on IRC, we still need to discuss if this is really needed, from kdump perspective.

manually ifup nic also benefit to emergency shell use case. I want to use dracut initramfs as a minimal system without real root for kernel testing

For emergency shell, yeah, it make senses.

Quoted 5 lines
Quoted 5 lines

If we need to invoke ifup by
ourselves, then we also need to determine which NIC we should bring up, this will make kdump code larger.

Quoted 7 lines
Quoted 3 lines

So, I hope, we can have some kernel cmdline (like ip=...) to tell dracut which NIC we want to bring up in the second kernel, provided by either ssh-client module or nfs module.

If we need to pass the nic name to cmdline then we still need to determine which one should be use.

Sure, but this will go to ssh-client or nfs module, not kdump.

Quoted 3 lines

If we just bring up all nics, then use the manual ifup is also easy.

If there are lots of NIC, and we only use one (for remote kdump),
bringing all NIC up is a waste. Nor to say when we only use eth0, you also bring up bond0, br0 etc...

Quoted 3 lines

current dracut udev rules is: if there's no nic specified it will ifup all possible nics, but all will be put in initqueue which finally be brought up by netroot script.

We need to specify at least one, the one that reach the remote dump server.

Thanks.

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#7 lore raw
Quoted 47 lines · Cong Wang
Quoted 25 lines · Dave Young

Hi, I have some additional comments

Quoted 21 lines · Cong Wang
Quoted 19 lines · Dave Young

For kdump we need scp vmcore to remote machine, the nic to be used is not limited to netroot one. we need a feature for manually bringing up
network interface. Also it is useful for emergency shell with
ssh-client for recovery or test purpose

I implement this by adding one argument to ifup script, user can use /sbin/ifup eth0 -m to bring up eth0, note ifup will regard it a manual operation for the nic specified in 1st argument if there's the 2nd argument.

If same nic is used for netroot the 2nd argument will be ignored, in this case we will leave netroot bring up it automatically to avoid side effect. And in this case hooks such as kdump will need to execute after netroot mounted.

ifup eth0 -m will create /tmp/net.eth0.manualup stamp file, later dhclient-script can check this and pass $2 to netroot, then netroot script will bring eth0 up

Quoted 7 lines
Quoted 2 lines

As we talked on IRC, we still need to discuss if this is really needed, from kdump perspective.

manually ifup nic also benefit to emergency shell use case. I want to use dracut initramfs as a minimal system without real root for kernel testing

For emergency shell, yeah, it make senses.

Quoted 10 lines
Quoted 8 lines

If we need to invoke ifup by
ourselves, then we also need to determine which NIC we should bring up, this will make kdump code larger.

So, I hope, we can have some kernel cmdline (like ip=...) to tell dracut which NIC we want to bring up in the second kernel, provided by either ssh-client module or nfs module.

Quoted 5 lines
Quoted 2 lines

If we need to pass the nic name to cmdline then we still need to determine which one should be use.

Sure, but this will go to ssh-client or nfs module, not kdump.

ssh-client does not pass any cmdline, instead the scripts of call dracut to generate initrd do this. In case of kdump it's the kdump init scripts or simplified mkdumprd, so we could not skip this step.

Quoted 18 lines
Quoted 4 lines

If we just bring up all nics, then use the manual ifup is also easy.

If there are lots of NIC, and we only use one (for remote kdump), bringing all NIC up is a waste. Nor to say when we only use eth0, you also bring up bond0, br0 etc...

Quoted 3 lines

current dracut udev rules is: if there's no nic specified it will ifup all possible nics, but all will be put in initqueue which finally be brought up by netroot script.

We need to specify at least one, the one that reach the remote dump server.

Thanks.

Signature · 2 lines
Thanks
Dave

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw
Quoted 13 lines · Dave Young
Quoted 13 lines
Quoted 11 lines
Quoted 7 lines

If we need to invoke ifup by
ourselves, then we also need to determine which NIC we should bring up, this will make kdump code larger.

So, I hope, we can have some kernel cmdline (like ip=...) to tell dracut which NIC we want to bring up in the second kernel, provided by either ssh-client module or nfs module.

If we need to pass the nic name to cmdline then we still need to determine which one should be use.

Quoted 6 lines
Quoted 1 line

Sure, but this will go to ssh-client or nfs module, not kdump.

ssh-client does not pass any cmdline, instead the scripts of call dracut to generate initrd do this. In case of kdump it's the kdump init scripts or simplified mkdumprd, so we could not skip this step.

Well, I still think ssh-client or nfs module should handle the network, not kdump's mkdumprd, like lvm module for lvm.* cmdline.

But anyway, I will take this patch to my kdump tree.

Thanks.