diff --git a/board/common/rootfs/usr/sbin/container b/board/common/rootfs/usr/sbin/container index 37c7984c..3fa09f51 100755 --- a/board/common/rootfs/usr/sbin/container +++ b/board/common/rootfs/usr/sbin/container @@ -36,7 +36,7 @@ create() args="$args --restart=no --systemd=false --tz=local --privileged --replace --quiet" # args="$args --log-opt tag=$name" - pidfn=/run/pod:${name}.pid + pidfn=/run/container:${name}.pid for net in "$@"; do network="$network --net $net" @@ -61,7 +61,7 @@ create() log "Calling \"podman create --name $name --conmon-pidfile=$pidfn $network $args $image\"" if podman create --name "$name" --conmon-pidfile="$pidfn" $network $args "$image"; then log "Successfully created container $name from $image" - initctl -nbq cond set pod:system + initctl -nbq cond set container:$name exit 0 fi log "Error: failed creating container $name, please check the configuration." @@ -207,11 +207,11 @@ case $cmd in ;; start) verify "$1" || exit 1 - initctl -bq start "pod:$1" + initctl -bq start "container:$1" ;; stop) verify "$1" || exit 1 - initctl -bq stop "pod:$1" || podman kill "$1" + initctl -bq stop "container:$1" || podman kill "$1" ;; *) usage diff --git a/src/confd/src/infix-containers.c b/src/confd/src/infix-containers.c index d6d970e7..54639af8 100644 --- a/src/confd/src/infix-containers.c +++ b/src/confd/src/infix-containers.c @@ -26,7 +26,7 @@ static const struct srx_module_requirement reqs[] = { { NULL } }; -static int job(const char *name, struct lyd_node *cif) +static int add(const char *name, struct lyd_node *cif) { const char *image = lydx_get_cattr(cif, "image"); struct lyd_node *net; @@ -35,7 +35,7 @@ static int job(const char *name, struct lyd_node *cif) fp = fopenf("w", "%s/%s.sh", INBOX_QUEUE, name); if (!fp) { ERROR("Failed adding job %s.sh to job queue" INBOX_QUEUE, name); - return 1; + return SR_ERR_SYS; } /* Stop any running container gracefully so it releases its IP addresses. */ @@ -68,29 +68,20 @@ static int job(const char *name, struct lyd_node *cif) fprintf(fp, "\n"); fchmod(fileno(fp), 0700); + fclose(fp); - return fclose(fp); -} - -static int add(const char *name, struct lyd_node *cif) -{ - FILE *fp; - - if (job(name, cif)) - return SR_ERR_SYS; - - fp = fopenf("w", "/etc/finit.d/available/pod:%s.conf", name); + fp = fopenf("w", "/etc/finit.d/available/container:%s.conf", name); if (!fp) { ERROR("Failed creating container %s monitor", name); return SR_ERR_SYS; } - fprintf(fp, "service name:pod log:prio:local1.err,tag:container :%s pid:!/run/pod:%s.pid \\\n" - " [2345] podman start -a %s -- Container %s\n", - name, name, name, name, name); + fprintf(fp, "service name:container :%s log:prio:local1.err,tag:%s %s pid:!/run/container:%s.pid \\\n" + " [2345] podman start -a %s -- Container %s\n", + name, name, lydx_is_enabled(cif, "manual") ? "manual:yes" : "", name, name, name, name); fclose(fp); - if (systemf("initctl -nbq enable pod:%s", name)) { + if (systemf("initctl -nbq enable container:%s", name)) { ERROR("Failed enabling container %s monitor", name); return SR_ERR_SYS; }