Minor fixups for OCI implementation

This commit is contained in:
Gregory Kurtzer
2020-11-09 10:32:30 -08:00
parent 4e0a5bea48
commit 76a8b2c135
4 changed files with 39 additions and 18 deletions

View File

@@ -46,12 +46,13 @@ files: all
install -d -m 0755 /var/warewulf/
install -d -m 0755 /etc/warewulf/
install -d -m 0755 /etc/warewulf/ipxe
install -d -m 0755 /var/lib/tftpboot/warewulf/pxe/
install -d -m 0755 /var/lib/tftpboot/warewulf/ipxe/
install -m 0640 etc/dhcpd.conf /etc/dhcp/dhcpd.conf
install -m 0644 etc/nodes.conf /etc/warewulf/nodes.conf
install -m 0644 etc/warewulf.conf /etc/warewulf/warewulf.conf
install -m 0644 etc/ipxe/default.ipxe /etc/warewulf/ipxe/default.ipxe
cp -r tftpboot/* /var/lib/tftpboot/warewulf/ipxe/
restorecon -r /var/lib/tftpboot/warewulf
cp -r overlays /var/warewulf/
chmod +x /var/warewulf/overlays/system/default/init
mkdir -p /var/warewulf/overlays/system/default/warewulf/bin/

View File

@@ -26,7 +26,7 @@ func vnfsOciBuild(OciPath string, wg *sync.WaitGroup) {
os.Exit(1)
}
ociDestination := fmt.Sprintf("%s/oci/vnfs/%s", LocalStateDir, path.Base(sourcePath))
ociDestination := fmt.Sprintf("%s/oci/vnfs/hash/%s", LocalStateDir, path.Base(sourcePath))
name, err := os.Readlink(vnfsDestination)
if err == nil {
@@ -46,6 +46,11 @@ func vnfsOciBuild(OciPath string, wg *sync.WaitGroup) {
fmt.Printf("ERROR: %s\n", err)
return
}
err = os.MkdirAll(LocalStateDir+"/oci/vnfs/name", 0755)
if err != nil {
fmt.Printf("ERROR: %s\n", err)
return
}
err = buildVnfs(sourcePath, ociDestination)
if err != nil {
@@ -58,6 +63,13 @@ func vnfsOciBuild(OciPath string, wg *sync.WaitGroup) {
fmt.Printf("ERROR: %s\n", err)
os.Exit(1)
}
err = os.Symlink(sourcePath, LocalStateDir+"/oci/vnfs/name/"+path.Base(OciPath))
if err != nil {
fmt.Printf("ERROR: %s\n", err)
os.Exit(1)
}
err = os.Rename(vnfsDestination+"-link", vnfsDestination)
log.Printf("Completed building VNFS: %s\n", path.Base(OciPath))

View File

@@ -29,7 +29,7 @@ nodegroups:
ipmi ipaddr: x.x.x.x
netdevs:
eth0:
hwaddr: 00:0c:29:c3:bf:42
hwaddr: 00:0c:29:23:8b:48
ipaddr: 192.168.1.100
netmask: 255.255.255.0
gateway: 192.168.1.1

View File

@@ -4,6 +4,9 @@ import (
"fmt"
"gopkg.in/yaml.v2"
"io/ioutil"
"path"
"strings"
// "os"
// "os"
@@ -13,6 +16,7 @@ import (
)
const ConfigFile = "/etc/warewulf/nodes.conf"
const LocalStateDir = "/var/warewulf"
func init() {
//TODO: Check to make sure nodes.conf is found
@@ -26,23 +30,23 @@ type nodeYaml struct {
type nodeGroup struct {
Comment string
Vnfs string
Ipxe string `yaml:"ipxe template"`
SystemOverlay string `yaml:"system overlay""`
RuntimeOverlay string `yaml:"runtime overlay""`
DomainSuffix string `yaml:"domain suffix"`
KernelVersion string `yaml:"kernel version"`
Ipxe string `yaml:"ipxe template"`
SystemOverlay string `yaml:"system overlay""`
RuntimeOverlay string `yaml:"runtime overlay""`
DomainSuffix string `yaml:"domain suffix"`
KernelVersion string `yaml:"kernel version"`
Nodes map[string]nodeEntry
}
type nodeEntry struct {
Hostname string
Vnfs string
Ipxe string `yaml:"ipxe template"`
SystemOverlay string `yaml:"system overlay"`
RuntimeOverlay string `yaml:"runtime overlay"`
DomainSuffix string `yaml:"domain suffix"`
KernelVersion string `yaml:"kernel version"`
IpmiIpaddr string `yaml:"ipmi ipaddr"`
Ipxe string `yaml:"ipxe template"`
SystemOverlay string `yaml:"system overlay"`
RuntimeOverlay string `yaml:"runtime overlay"`
DomainSuffix string `yaml:"domain suffix"`
KernelVersion string `yaml:"kernel version"`
IpmiIpaddr string `yaml:"ipmi ipaddr"`
NetDevs map[string]netDevs
}
@@ -60,7 +64,7 @@ type NodeInfo struct {
DomainName string
Fqdn string
Vnfs string
Ipxe string
Ipxe string
SystemOverlay string
RuntimeOverlay string
KernelVersion string
@@ -97,7 +101,6 @@ func FindAllNodes() ([]NodeInfo, error) {
n.Ipxe = group.Ipxe
n.NetDevs = node.NetDevs
if node.KernelVersion != "" {
n.KernelVersion = node.KernelVersion
}
@@ -117,7 +120,6 @@ func FindAllNodes() ([]NodeInfo, error) {
n.Ipxe = node.Ipxe
}
if n.RuntimeOverlay == "" {
n.RuntimeOverlay = "default"
}
@@ -134,6 +136,12 @@ func FindAllNodes() ([]NodeInfo, error) {
n.Fqdn = node.Hostname
}
if strings.HasPrefix(n.Vnfs, "docker://") {
//TODO: This is a kludge and shouldn't be done here. We need to go back
// and do this from a "vnfs" interface or package
n.Vnfs = LocalStateDir + "/oci/vnfs/name/" + path.Base(n.Vnfs)
}
ret = append(ret, n)
}
}
@@ -286,4 +294,4 @@ func ListRuntimeOverlays() ([]string, error) {
return ret, nil
}
*/
*/