Skip to content

Commit

Permalink
Check /proc/uptime while waiting for systemd services to restart
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed Feb 24, 2016
1 parent e32ca03 commit 1fe1eb9
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 3 deletions.
1 change: 1 addition & 0 deletions package/autoyast2.spec
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ rmdir $RPM_BUILD_ROOT/%{_prefix}/share/doc/packages/autoyast2/html/autoyast
%dir %{yast_scrconfdir}
%{yast_scrconfdir}/autoinstall.scr
%{yast_scrconfdir}/cfg_autoinstall.scr
%{yast_scrconfdir}/proc_uptime.scr
# DTD files
%dir /usr/share/autoinstall
#%dir /usr/share/autoinstall/dtd
Expand Down
3 changes: 2 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ ylib_DATA = \
scrconf_DATA = \
scrconf/cfg_autoinstall.scr \
scrconf/autoinstall.scr \
scrconf/ksimport.scr
scrconf/ksimport.scr \
scrconf/proc_uptime.scr

agent_SCRIPTS = \
servers_non_y2/ag_ksimport
Expand Down
4 changes: 2 additions & 2 deletions src/clients/inst_autoconfigure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ def wait_systemd_finished(max_wait, ser_ignore)
max_wait,
ser_ignore
)
st_time = Builtins.time
st_time = SCR.Read(path(".proc.uptime"))["uptime"]
cur_time = st_time
last_busy = st_time
cmd = "systemctl --full list-jobs"
Expand All @@ -484,7 +484,7 @@ def wait_systemd_finished(max_wait, ser_ignore)
Builtins.y2milestone("size ll=%1 ll:%2", cnt, ll)
last_busy = cur_time if Ops.greater_than(cnt, 0)
Builtins.sleep(500)
cur_time = Builtins.time
cur_time = SCR.Read(path(".proc.uptime"))["uptime"]
Builtins.y2milestone(
"wait_systemd_finished time:%1 idle:%2",
Ops.subtract(cur_time, st_time),
Expand Down
35 changes: 35 additions & 0 deletions src/scrconf/proc_uptime.scr
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* File:
* proc_uptime.scr
* Summary:
* SCR Agent for reading /proc/uptime
* Access:
* read
* Authors:
* Imobach Gonzalez Sosa <igonzalezsosa@suse.com>
*
* Example: /proc/uptime
* 684141.86 683056.34
*
* ...
**
* Read(.proc.uptime)
* ([ $["uptime": 684141.86, "idle": 683056.34] ])
*/

.proc.uptime

`ag_anyagent(
`Description(
(`File("/proc/uptime")), // filename
"#\n", // Comment
true, // Read-only
(
`Tuple(
`uptime(`Float()), // Wall clock since boot
`Whitespace(),
`idle(`Float()) // Combined idle time of all cpus
)
)
)
)

0 comments on commit 1fe1eb9

Please sign in to comment.