From jbacik at fb.com Fri Oct 16 21:20:06 2015 From: jbacik at fb.com (Josef Bacik) Date: Fri, 16 Oct 2015 17:20:06 -0400 Subject: [PATCH] pykickstart: don't set bootProto if --noipv4 Message-ID: <1445030406-19215-1-git-send-email-jbacik@fb.com> If we specify a ipv6 only network configuration we still get bootproto=dhcp set, which during kickstart makes networkmanager try to do a ipv4 dhcp which takes a while to timeout. We don't want bootproto=dhcp set when we specify --noipv4, so make sure it gets zero'ed out when we see that command. Signed-off-by: Josef Bacik --- pykickstart/commands/network.py | 9 +++++++++ tests/commands/network.py | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/pykickstart/commands/network.py b/pykickstart/commands/network.py index 818be79..58992c3 100644 --- a/pykickstart/commands/network.py +++ b/pykickstart/commands/network.py @@ -399,6 +399,15 @@ class FC6_Network(FC4_Network): default=False) return op + def parse(self, args): + retval = FC4_Network.parse(self, args) + + # If we specify noipv4 then we need to make sure bootproto is zero'ed + # out + if retval.noipv4: + retval.bootProto = "" + return retval + class F8_Network(FC6_Network): removedKeywords = FC6_Network.removedKeywords removedAttrs = FC6_Network.removedAttrs diff --git a/tests/commands/network.py b/tests/commands/network.py index dbad1f9..0645555 100644 --- a/tests/commands/network.py +++ b/tests/commands/network.py @@ -35,6 +35,16 @@ class F20_TestCase(CommandTest): cmd = "network --device team0 --bootproto dhcp --teamslaves=p3p1,p3p2 --teamconfig=\"{\\\"runner\\\": {\\\"name\\\": \\\"roundrobin\\\"}}\" --activate" self.assert_parse(cmd) + cmd = "network --noipv4 --activate --hostname=blah.test.com --ipv6=1:2:3:4:5:6:7:8 --device eth0 --nameserver=1:1:1:1::,2:2:2:2::" + nd = self.assert_parse(cmd) + self.assertEquals(nd.bootProto, "") + self.assertEquals(nd.hostname, "blah.test.com") + self.assertTrue(nd.noipv4) + self.assertEquals(nd.ipv6, "1:2:3:4:5:6:7:8") + self.assertIn("1:1:1:1::", nd.nameserver) + self.assertIn("2:2:2:2::", nd.nameserver) + self.assertEquals(nd.device, "eth0") + # --teamslaves # --teamslaves="[''],[''],..." # CONFIGX is json with " escaped to \" -- 2.1.0 From clumens at redhat.com Mon Oct 19 18:02:19 2015 From: clumens at redhat.com (Chris Lumens) Date: Mon, 19 Oct 2015 14:02:19 -0400 Subject: [PATCH] pykickstart: don't set bootProto if --noipv4 In-Reply-To: <1445030406-19215-1-git-send-email-jbacik@fb.com> References: <1445030406-19215-1-git-send-email-jbacik@fb.com> Message-ID: <20151019180219.GN29734@exeter.usersys.redhat.com> > diff --git a/pykickstart/commands/network.py b/pykickstart/commands/network.py > index 818be79..58992c3 100644 > --- a/pykickstart/commands/network.py > +++ b/pykickstart/commands/network.py > @@ -399,6 +399,15 @@ class FC6_Network(FC4_Network): > default=False) > return op > > + def parse(self, args): > + retval = FC4_Network.parse(self, args) > + > + # If we specify noipv4 then we need to make sure bootproto is zero'ed > + # out > + if retval.noipv4: > + retval.bootProto = "" > + return retval > + > class F8_Network(FC6_Network): > removedKeywords = FC6_Network.removedKeywords > removedAttrs = FC6_Network.removedAttrs > diff --git a/tests/commands/network.py b/tests/commands/network.py > index dbad1f9..0645555 100644 > --- a/tests/commands/network.py > +++ b/tests/commands/network.py > @@ -35,6 +35,16 @@ class F20_TestCase(CommandTest): > cmd = "network --device team0 --bootproto dhcp --teamslaves=p3p1,p3p2 --teamconfig=\"{\\\"runner\\\": {\\\"name\\\": \\\"roundrobin\\\"}}\" --activate" > self.assert_parse(cmd) > > + cmd = "network --noipv4 --activate --hostname=blah.test.com --ipv6=1:2:3:4:5:6:7:8 --device eth0 --nameserver=1:1:1:1::,2:2:2:2::" > + nd = self.assert_parse(cmd) > + self.assertEquals(nd.bootProto, "") > + self.assertEquals(nd.hostname, "blah.test.com") > + self.assertTrue(nd.noipv4) > + self.assertEquals(nd.ipv6, "1:2:3:4:5:6:7:8") > + self.assertIn("1:1:1:1::", nd.nameserver) > + self.assertIn("2:2:2:2::", nd.nameserver) > + self.assertEquals(nd.device, "eth0") > + > # --teamslaves > # --teamslaves="[''],[''],..." > # CONFIGX is json with " escaped to \" Annoying as it is, I think this fix belongs in an F24 version of the network command. It's possible changing this all the way back to FC6 will break some user of pykickstart that's relying on it. - Chris From jbacik at fb.com Mon Oct 19 19:11:18 2015 From: jbacik at fb.com (Josef Bacik) Date: Mon, 19 Oct 2015 15:11:18 -0400 Subject: [PATCH] pykickstart: don't set bootProto if --noipv4 In-Reply-To: <20151019180219.GN29734@exeter.usersys.redhat.com> References: <1445030406-19215-1-git-send-email-jbacik@fb.com> <20151019180219.GN29734@exeter.usersys.redhat.com> Message-ID: <56254056.10706@fb.com> On 10/19/2015 02:02 PM, Chris Lumens wrote: >> diff --git a/pykickstart/commands/network.py b/pykickstart/commands/network.py >> index 818be79..58992c3 100644 >> --- a/pykickstart/commands/network.py >> +++ b/pykickstart/commands/network.py >> @@ -399,6 +399,15 @@ class FC6_Network(FC4_Network): >> default=False) >> return op >> >> + def parse(self, args): >> + retval = FC4_Network.parse(self, args) >> + >> + # If we specify noipv4 then we need to make sure bootproto is zero'ed >> + # out >> + if retval.noipv4: >> + retval.bootProto = "" >> + return retval >> + >> class F8_Network(FC6_Network): >> removedKeywords = FC6_Network.removedKeywords >> removedAttrs = FC6_Network.removedAttrs >> diff --git a/tests/commands/network.py b/tests/commands/network.py >> index dbad1f9..0645555 100644 >> --- a/tests/commands/network.py >> +++ b/tests/commands/network.py >> @@ -35,6 +35,16 @@ class F20_TestCase(CommandTest): >> cmd = "network --device team0 --bootproto dhcp --teamslaves=p3p1,p3p2 --teamconfig=\"{\\\"runner\\\": {\\\"name\\\": \\\"roundrobin\\\"}}\" --activate" >> self.assert_parse(cmd) >> >> + cmd = "network --noipv4 --activate --hostname=blah.test.com --ipv6=1:2:3:4:5:6:7:8 --device eth0 --nameserver=1:1:1:1::,2:2:2:2::" >> + nd = self.assert_parse(cmd) >> + self.assertEquals(nd.bootProto, "") >> + self.assertEquals(nd.hostname, "blah.test.com") >> + self.assertTrue(nd.noipv4) >> + self.assertEquals(nd.ipv6, "1:2:3:4:5:6:7:8") >> + self.assertIn("1:1:1:1::", nd.nameserver) >> + self.assertIn("2:2:2:2::", nd.nameserver) >> + self.assertEquals(nd.device, "eth0") >> + >> # --teamslaves >> # --teamslaves="[''],[''],..." >> # CONFIGX is json with " escaped to \" > > Annoying as it is, I think this fix belongs in an F24 version of the > network command. It's possible changing this all the way back to FC6 > will break some user of pykickstart that's relying on it. > Fair enough, I'll redo it. Thanks, Josef From jbacik at fb.com Mon Oct 19 19:46:50 2015 From: jbacik at fb.com (Josef Bacik) Date: Mon, 19 Oct 2015 15:46:50 -0400 Subject: [PATCH V2] pykickstart: don't set bootProto if --noipv4 Message-ID: <1445284010-18680-1-git-send-email-jbacik@fb.com> If we specify a ipv6 only network configuration we still get bootproto=dhcp set, which during kickstart makes networkmanager try to do a ipv4 dhcp which takes a while to timeout. We don't want bootproto=dhcp set when we specify --noipv4, so make sure it gets zero'ed out when we see that command. Signed-off-by: Josef Bacik --- V1-V2: only change --noipv4 behavior for F24 and onwards. pykickstart/commands/network.py | 13 +++++++++++++ pykickstart/handlers/f24.py | 2 +- tests/commands/network.py | 14 ++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/pykickstart/commands/network.py b/pykickstart/commands/network.py index 818be79..8510711 100644 --- a/pykickstart/commands/network.py +++ b/pykickstart/commands/network.py @@ -545,6 +545,19 @@ class F22_Network(F21_Network): return retval +class F24_Network(F22_Network): + removedKeywords = F22_Network.removedKeywords + removedAttrs = F22_Network.removedAttrs + + def parse(self, args): + retval = F22_Network.parse(self, args) + + # If we specify noipv4 then we need to make sure bootproto is zero'ed + # out + if retval.noipv4: + retval.bootProto = "" + return retval + class RHEL4_Network(FC3_Network): removedKeywords = FC3_Network.removedKeywords removedAttrs = FC3_Network.removedAttrs diff --git a/pykickstart/handlers/f24.py b/pykickstart/handlers/f24.py index af678a2..5e3b74e 100644 --- a/pykickstart/handlers/f24.py +++ b/pykickstart/handlers/f24.py @@ -60,7 +60,7 @@ class F24Handler(BaseHandler): "mediacheck": commands.mediacheck.FC4_MediaCheck, "method": commands.method.F19_Method, "multipath": commands.multipath.FC6_MultiPath, - "network": commands.network.F22_Network, + "network": commands.network.F24_Network, "nfs": commands.nfs.FC6_NFS, "ostreesetup": commands.ostreesetup.F21_OSTreeSetup, "part": commands.partition.F23_Partition, diff --git a/tests/commands/network.py b/tests/commands/network.py index dbad1f9..56a4d47 100644 --- a/tests/commands/network.py +++ b/tests/commands/network.py @@ -94,6 +94,20 @@ class F22_TestCase(F20_TestCase): "--bridgeopts=priority", KickstartValueError) +class F24_TestCase(F22_TestCase): + def runTest(self): + F22_TestCase.runTest(self) + + # Test ipv4 only settings + cmd = "network --noipv4 --activate --hostname=blah.test.com --ipv6=1:2:3:4:5:6:7:8 --device eth0 --nameserver=1:1:1:1::,2:2:2:2::" + nd = self.assert_parse(cmd) + self.assertEquals(nd.bootProto, "") + self.assertEquals(nd.hostname, "blah.test.com") + self.assertTrue(nd.noipv4) + self.assertEquals(nd.ipv6, "1:2:3:4:5:6:7:8") + self.assertIn("1:1:1:1::", nd.nameserver) + self.assertIn("2:2:2:2::", nd.nameserver) + self.assertEquals(nd.device, "eth0") class RHEL7_TestCase(F20_TestCase): def runTest(self): -- 2.1.0 From clumens at redhat.com Tue Oct 20 15:01:21 2015 From: clumens at redhat.com (Chris Lumens) Date: Tue, 20 Oct 2015 11:01:21 -0400 Subject: [PATCH V2] pykickstart: don't set bootProto if --noipv4 In-Reply-To: <1445284010-18680-1-git-send-email-jbacik@fb.com> References: <1445284010-18680-1-git-send-email-jbacik@fb.com> Message-ID: <20151020150120.GQ29734@exeter.usersys.redhat.com> > If we specify a ipv6 only network configuration we still get bootproto=dhcp set, > which during kickstart makes networkmanager try to do a ipv4 dhcp which takes a > while to timeout. We don't want bootproto=dhcp set when we specify --noipv4, so > make sure it gets zero'ed out when we see that command. > > Signed-off-by: Josef Bacik > --- > V1-V2: only change --noipv4 behavior for F24 and onwards. > > pykickstart/commands/network.py | 13 +++++++++++++ > pykickstart/handlers/f24.py | 2 +- > tests/commands/network.py | 14 ++++++++++++++ > 3 files changed, 28 insertions(+), 1 deletion(-) Looks good to me. Remember in anaconda you will have to update kickstart.py to use the F24_Network class. - Chris