From 2f6a9251cdc18e5f9ac850a603e48926cb6c0ba2 Mon Sep 17 00:00:00 2001 From: Gregory Kurtzer Date: Thu, 30 Dec 2021 03:35:54 +0000 Subject: [PATCH 1/7] Optimized FilterByName() to weed out redundant queries --- internal/pkg/node/methods.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/pkg/node/methods.go b/internal/pkg/node/methods.go index bc5de819..50160b29 100644 --- a/internal/pkg/node/methods.go +++ b/internal/pkg/node/methods.go @@ -10,16 +10,20 @@ import "regexp" func FilterByName(set []NodeInfo, searchList []string) []NodeInfo { var ret []NodeInfo + unique := make(map[string]NodeInfo) if len(searchList) > 0 { for _, search := range searchList { for _, entry := range set { b, _ := regexp.MatchString("^"+search+"$", entry.Id.Get()) if b { - ret = append(ret, entry) + unique[entry.Id.Get()] = entry } } } + for _, n := range unique { + ret = append(ret, n) + } } else { ret = set } From 82b276f8586622e9f2ef06a3323636b8c8e7d863 Mon Sep 17 00:00:00 2001 From: Gregory Kurtzer Date: Thu, 30 Dec 2021 03:44:48 +0000 Subject: [PATCH 2/7] Implement fix for #222 (thanks Griznog!) --- etc/ipxe/default.ipxe | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/etc/ipxe/default.ipxe b/etc/ipxe/default.ipxe index 543797f8..7b419cb3 100644 --- a/etc/ipxe/default.ipxe +++ b/etc/ipxe/default.ipxe @@ -12,9 +12,9 @@ echo set base http://{{.Ipaddr}}:{{.Port}} kernel --name kernel ${base}/kernel/{{.Hwaddr}} || goto reboot -initrd --name container ${base}/container/{{.Hwaddr}} || goto reboot -initrd --name kmods ${base}/kmods/{{.Hwaddr}} || goto reboot -initrd --name system ${base}/overlay-system/{{.Hwaddr}} || goto reboot +imgextract --name container ${base}/container/{{.Hwaddr}} || goto reboot +imgextract --name kmods ${base}/kmods/{{.Hwaddr}} || goto reboot +imgextract --name system ${base}/overlay-system/{{.Hwaddr}} || goto reboot boot kernel initrd=container initrd=kmods initrd=system {{.KernelArgs}} || goto reboot From a0ffc12c9a496e2c300a3583ed399479c7290d01 Mon Sep 17 00:00:00 2001 From: Gregory Kurtzer Date: Thu, 30 Dec 2021 17:22:56 +0000 Subject: [PATCH 3/7] Put `imgextract` into a different PXE file until it is tested on ARM To use this iPXE template do the following: ``` wwctl profile set --ipxe big_image default ``` --- etc/ipxe/big_image.ipxe | 26 ++++++++++++++++++++++++++ etc/ipxe/default.ipxe | 6 +++--- 2 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 etc/ipxe/big_image.ipxe diff --git a/etc/ipxe/big_image.ipxe b/etc/ipxe/big_image.ipxe new file mode 100644 index 00000000..a3f9bda0 --- /dev/null +++ b/etc/ipxe/big_image.ipxe @@ -0,0 +1,26 @@ +#!ipxe + +echo +echo ================================================================================ +echo Warewulf v4 now booting: {{.Fqdn}} +echo +echo Container: {{.ContainerName}} +echo Kernel: {{.KernelVersion}} +echo KernelArgs: {{.KernelArgs}} +echo + +set base http://{{.Ipaddr}}:{{.Port}} + +kernel --name kernel ${base}/kernel/{{.Hwaddr}} || goto reboot +imgextract --name container ${base}/container/{{.Hwaddr}} || goto reboot +imgextract --name kmods ${base}/kmods/{{.Hwaddr}} || goto reboot +imgextract --name system ${base}/overlay-system/{{.Hwaddr}} || goto reboot + +boot kernel initrd=container initrd=kmods initrd=system {{.KernelArgs}} || goto reboot + +:reboot +echo +echo There was an error, rebooting in 15s... +echo +sleep 15 +reboot diff --git a/etc/ipxe/default.ipxe b/etc/ipxe/default.ipxe index 7b419cb3..543797f8 100644 --- a/etc/ipxe/default.ipxe +++ b/etc/ipxe/default.ipxe @@ -12,9 +12,9 @@ echo set base http://{{.Ipaddr}}:{{.Port}} kernel --name kernel ${base}/kernel/{{.Hwaddr}} || goto reboot -imgextract --name container ${base}/container/{{.Hwaddr}} || goto reboot -imgextract --name kmods ${base}/kmods/{{.Hwaddr}} || goto reboot -imgextract --name system ${base}/overlay-system/{{.Hwaddr}} || goto reboot +initrd --name container ${base}/container/{{.Hwaddr}} || goto reboot +initrd --name kmods ${base}/kmods/{{.Hwaddr}} || goto reboot +initrd --name system ${base}/overlay-system/{{.Hwaddr}} || goto reboot boot kernel initrd=container initrd=kmods initrd=system {{.KernelArgs}} || goto reboot From e5edd87b43cdfa8065162e15109b27aa06601bbf Mon Sep 17 00:00:00 2001 From: Gregory Kurtzer Date: Fri, 31 Dec 2021 01:09:37 +0000 Subject: [PATCH 4/7] Fix default permission of config file so users can use it. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6afe24fd..2e87364b 100644 --- a/Makefile +++ b/Makefile @@ -93,7 +93,7 @@ files: all install -d -m 0755 $(DESTDIR)/usr/share/man/man1 test -f $(DESTDIR)/etc/warewulf/warewulf.conf || install -m 644 etc/warewulf.conf $(DESTDIR)/etc/warewulf/ test -f $(DESTDIR)/etc/warewulf/hosts.tmpl || install -m 644 etc/hosts.tmpl $(DESTDIR)/etc/warewulf/ - test -f $(DESTDIR)/etc/warewulf/nodes.conf || install -m 640 etc/nodes.conf $(DESTDIR)/etc/warewulf/ + test -f $(DESTDIR)/etc/warewulf/nodes.conf || install -m 644 etc/nodes.conf $(DESTDIR)/etc/warewulf/ cp -r etc/dhcp $(DESTDIR)/etc/warewulf/ cp -r etc/ipxe $(DESTDIR)/etc/warewulf/ cp -r overlays $(DESTDIR)/var/warewulf/ From d406231c10e46de5faa32c08a9c7003d76227a43 Mon Sep 17 00:00:00 2001 From: Gregory Kurtzer Date: Fri, 31 Dec 2021 01:18:35 +0000 Subject: [PATCH 5/7] Clean vendor directory on `make clean` --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 2e87364b..fbda9cdd 100644 --- a/Makefile +++ b/Makefile @@ -166,6 +166,7 @@ clean: rm -rf bash_completion.d rm -f man_page rm -rf man_pages + rm -rf vendor install: files install_wwclient From b971ff263653bc7c2a03ca46997a298a33b7c94e Mon Sep 17 00:00:00 2001 From: Gregory Kurtzer Date: Tue, 4 Jan 2022 02:15:21 +0000 Subject: [PATCH 6/7] Backwards compatibility fix for network config --- internal/pkg/node/constructors.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/pkg/node/constructors.go b/internal/pkg/node/constructors.go index 8f2d6e7b..e2c12bd5 100644 --- a/internal/pkg/node/constructors.go +++ b/internal/pkg/node/constructors.go @@ -88,7 +88,11 @@ func (config *nodeYaml) FindAllNodes() ([]NodeInfo, error) { } n.NetDevs[devname].Name.Set(devname) - n.NetDevs[devname].Device.Set(netdev.Device) + if netdev.Device != "" { + n.NetDevs[devname].Device.Set(netdev.Device) + } else { + n.NetDevs[devname].Device.Set(devname) + } n.NetDevs[devname].Ipaddr.Set(netdev.Ipaddr) n.NetDevs[devname].Netmask.Set(netdev.Netmask) n.NetDevs[devname].Hwaddr.Set(netdev.Hwaddr) From 5602fb0177a52f6bc51dd3a947b53fb4d0052bc9 Mon Sep 17 00:00:00 2001 From: Gregory Kurtzer Date: Tue, 4 Jan 2022 02:20:06 +0000 Subject: [PATCH 7/7] Minor fixup for not setting onboot to be true via Cobra This is already done more robustly within the code --- internal/app/wwctl/node/set/root.go | 2 +- internal/app/wwctl/profile/set/root.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/app/wwctl/node/set/root.go b/internal/app/wwctl/node/set/root.go index f8885462..c763b84f 100644 --- a/internal/app/wwctl/node/set/root.go +++ b/internal/app/wwctl/node/set/root.go @@ -136,7 +136,7 @@ func init() { baseCmd.PersistentFlags().StringVarP(&SetGateway, "gateway", "G", "", "Set the node's network device gateway") baseCmd.PersistentFlags().StringVarP(&SetHwaddr, "hwaddr", "H", "", "Set the node's network device HW address") baseCmd.PersistentFlags().StringVarP(&SetType, "type", "T", "", "Set the node's network device type") - baseCmd.PersistentFlags().StringVar(&SetNetOnBoot, "onboot", "yes", "Enable/disable device (yes/no)") + baseCmd.PersistentFlags().StringVar(&SetNetOnBoot, "onboot", "", "Enable/disable device (yes/no)") baseCmd.PersistentFlags().BoolVar(&SetNetDevDel, "netdel", false, "Delete the node's network device") diff --git a/internal/app/wwctl/profile/set/root.go b/internal/app/wwctl/profile/set/root.go index 270f01a1..88ae5293 100644 --- a/internal/app/wwctl/profile/set/root.go +++ b/internal/app/wwctl/profile/set/root.go @@ -119,7 +119,7 @@ func init() { baseCmd.PersistentFlags().StringVarP(&SetGateway, "gateway", "G", "", "Set the node's network device gateway") baseCmd.PersistentFlags().StringVarP(&SetHwaddr, "hwaddr", "H", "", "Set the node's network device HW address") baseCmd.PersistentFlags().StringVarP(&SetType, "type", "T", "", "Set the node's network device type") - baseCmd.PersistentFlags().StringVar(&SetNetOnBoot, "onboot", "yes", "Enable/disable device (yes/no)") + baseCmd.PersistentFlags().StringVar(&SetNetOnBoot, "onboot", "", "Enable/disable device (yes/no)") baseCmd.PersistentFlags().BoolVar(&SetNetDevDel, "netdel", false, "Delete the node's network device")