diff options
author | Dirk Brenken <dev@brenken.org> | 2018-06-04 09:07:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-04 09:07:45 +0200 |
commit | 1ce88dced63d028f93fdf304b6ff0a48c4453655 (patch) | |
tree | df9288ed6a20254ba7662561fd11f264d1190b7a /applications | |
parent | 2d352a9251f99628162ac6bccf13c0fd5d9a71f8 (diff) | |
parent | 2b43ebe92fc73ce4c208d42e6ee958988e1b18bc (diff) |
Merge pull request #1851 from dibdot/lxc_fix
luci-app-lxc: made container creation more reliable
Diffstat (limited to 'applications')
-rw-r--r-- | applications/luci-app-lxc/luasrc/controller/lxc.lua | 14 | ||||
-rw-r--r-- | applications/luci-app-lxc/luasrc/view/lxc.htm | 10 |
2 files changed, 14 insertions, 10 deletions
diff --git a/applications/luci-app-lxc/luasrc/controller/lxc.lua b/applications/luci-app-lxc/luasrc/controller/lxc.lua index c7fe63f87..8557f2b82 100644 --- a/applications/luci-app-lxc/luasrc/controller/lxc.lua +++ b/applications/luci-app-lxc/luasrc/controller/lxc.lua @@ -18,7 +18,7 @@ module("luci.controller.lxc", package.seeall) local uci = require "luci.model.uci".cursor() local util = require "luci.util" -local fs = require "nixio" +local nx = require "nixio" function index() if not nixio.fs.access("/etc/config/lxc") then @@ -60,8 +60,8 @@ end function lxc_create(lxc_name, lxc_template) luci.http.prepare_content("text/plain") - local check = lxc_get_config_path() - if not check then + local path = lxc_get_config_path() + if not path then return end @@ -80,6 +80,10 @@ function lxc_create(lxc_name, lxc_template) ssl_status } }), src_err) + + while (nx.fs.access(path .. lxc_name .. "/partial")) do + nx.nanosleep(1) + end end function lxc_action(lxc_action, lxc_name) @@ -96,7 +100,7 @@ function lxc_get_config_path() local ret = content:match('^%s*lxc.lxcpath%s*=%s*([^%s]*)') if ret then - if nixio.fs.access(ret) then + if nx.fs.access(ret) then local min_space = tonumber(uci:get("lxc", "lxc", "min_space")) or 100000 local free_space = tonumber(util.exec("df " ..ret.. " | awk '{if(NR==2)print $4}'")) if free_space and free_space >= min_space then @@ -150,7 +154,7 @@ function lxc_configuration_set(lxc_name) end function lxc_get_arch_target() - local target = fs.uname().machine + local target = nx.uname().machine local target_map = { armv5 = "armel", armv6 = "armel", diff --git a/applications/luci-app-lxc/luasrc/view/lxc.htm b/applications/luci-app-lxc/luasrc/view/lxc.htm index e703d6c88..b45e27f51 100644 --- a/applications/luci-app-lxc/luasrc/view/lxc.htm +++ b/applications/luci-app-lxc/luasrc/view/lxc.htm @@ -15,8 +15,8 @@ Author: Petar Koretic <petar.koretic@sartura.hr> -%> <%- -local fs = require "nixio" -local target = fs.uname().machine +local nx = require "nixio" +local target = nx.uname().machine -%> <fieldset class="cbi-section"> @@ -159,7 +159,7 @@ local target = fs.uname().machine var div3 = document.createElement("div"); div3.className = "td"; div3.style.width = "50%"; - div3.innerHTML = actions + div3.innerHTML = actions; document.getElementById("t_lxc_list").appendChild(div0); div0.appendChild(div1); @@ -213,8 +213,8 @@ local target = fs.uname().machine } else if (action == "destroy") { - var div = self.parentNode.parentNode - var img = div.querySelector('img') + var div = self.parentNode.parentNode; + var img = div.querySelector('img'); if (img.getAttribute('src') != window.img["red"]) { |