Compare commits
No commits in common. "989264681426a5fd472a5c39f8d740c9ddaeae94" and "de7a678640394042ae0dfea4499cac777720ad79" have entirely different histories.
9892646814
...
de7a678640
3 changed files with 18 additions and 6 deletions
|
|
@ -7,7 +7,6 @@ import (
|
||||||
configuration "git.g3e.fr/syonad/two/internal/config/agent"
|
configuration "git.g3e.fr/syonad/two/internal/config/agent"
|
||||||
"git.g3e.fr/syonad/two/internal/load_db/nocloud"
|
"git.g3e.fr/syonad/two/internal/load_db/nocloud"
|
||||||
"git.g3e.fr/syonad/two/pkg/db/kv"
|
"git.g3e.fr/syonad/two/pkg/db/kv"
|
||||||
"git.g3e.fr/syonad/two/pkg/systemd"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
@ -23,8 +22,6 @@ func main() {
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
service, _ := systemd.New()
|
|
||||||
|
|
||||||
conf, err := configuration.LoadConfig(*conf_file)
|
conf, err := configuration.LoadConfig(*conf_file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
|
@ -46,9 +43,7 @@ func main() {
|
||||||
Password: *password,
|
Password: *password,
|
||||||
SSHKEY: *ssh_key,
|
SSHKEY: *ssh_key,
|
||||||
}, db)
|
}, db)
|
||||||
service.Start("metadata@" + *vm_name)
|
|
||||||
} else if *stop {
|
} else if *stop {
|
||||||
nocloud.UnLoadNoCloudInDB(*vm_name, db)
|
nocloud.UnLoadNoCloudInDB(*vm_name, db)
|
||||||
service.Stop("metadata@" + *vm_name)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
ExecStart=/opt/two/bin/metadata --vm %i
|
ExecStart=/usr/local/bin/run-metadata-in-netns.sh %i
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
17
systemd/metadata_start/run-metadata-in-netns.sh
Normal file
17
systemd/metadata_start/run-metadata-in-netns.sh
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Expects one argument: netns_bridge (e.g. vpc-00003_br-00002 or vpc1_br0)
|
||||||
|
arg="$1"
|
||||||
|
NETNS="${arg%%_*}"
|
||||||
|
ip_port="${arg#*_}"
|
||||||
|
IP="${ip_port%%-*}"
|
||||||
|
PORT="${ip_port#*-}"
|
||||||
|
|
||||||
|
echo "start metadata ${NETNS} "
|
||||||
|
|
||||||
|
exec ip netns exec "${NETNS}" \
|
||||||
|
/usr/bin/metadata \
|
||||||
|
-file "/opt/metadata/${arg}.conf" \
|
||||||
|
-interface "${IP}" \
|
||||||
|
-port "${PORT}"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue