1097 Commits

Author SHA1 Message Date
Wolfgang Bumiller
568ce10624 sys: add some helpful macros
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-02 13:47:53 +01:00
Wolfgang Bumiller
c52794b8ad api-macro: bump bytes to 0.5
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-02 12:45:07 +01:00
Wolfgang Bumiller
1a2aaad5a1 more versioning fixups
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-30 12:33:13 +01:00
Wolfgang Bumiller
929161f030 -dev bump for proxmox crate as well
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-30 12:05:57 +01:00
Wolfgang Bumiller
496afe891e add a 'Versioning' readme section
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-30 11:50:30 +01:00
Wolfgang Bumiller
09345ac8c5 bump proxmox-tools to 0.1.1-dev.1
We now use this between package releases.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-30 11:32:21 +01:00
Wolfgang Bumiller
f90cbb7edd tools: fs: default to 644 for mode in replace_file
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-30 10:06:40 +01:00
Fabian Grünbichler
c27369e136 proxmox: initial packaging
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-12-20 09:39:45 +01:00
Fabian Grünbichler
8840877c80 proxmox-api-macro: initial packaging
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-12-20 09:39:45 +01:00
Fabian Grünbichler
57565a5061 proxmox-sortable-macro: initial packaging
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-12-20 09:39:45 +01:00
Fabian Grünbichler
d6bf884814 proxmox-sys: initial packaging
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-12-20 09:39:45 +01:00
Fabian Grünbichler
f4d9e8157c proxmox-sys: update lazy-static to 1.4
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-12-20 09:39:45 +01:00
Fabian Grünbichler
08433fd330 proxmox-api: use proxmox-tools package in d/rules
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-12-20 09:39:45 +01:00
Fabian Grünbichler
92c645cee2 proxmox-api: initial packaging
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-12-20 09:39:45 +01:00
Fabian Grünbichler
36f03c0feb proxmox-api: update rustyline to 5.0.5
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-12-20 09:39:45 +01:00
Fabian Grünbichler
2ecd975608 proxmox-api: update lazy_static to 1.4
which is available in Debian unstable.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-12-20 09:39:45 +01:00
Fabian Grünbichler
fa4f892c19 proxmox-tools: initial packaging
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-12-20 09:39:45 +01:00
Fabian Grünbichler
a33d9a35db proxmox-tools: update regex and lazy_static
to those versions available in Debian unstable

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-12-20 09:15:24 +01:00
Wolfgang Bumiller
2abdbb5113 add a top level doc comment to fs submodule
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-19 12:01:36 +01:00
Wolfgang Bumiller
ef612103f2 bump nix to 0.16
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-19 09:27:41 +01:00
Thomas Lamprecht
cfae8ae3d2 linux/procfs: add read_proc_stat
For now we just parse the CPU "time-spent" counters and calculate the
CPU usage of the whole system. As we do not want a total average we
use a state-full implementation, which calculates the usage since the
last request (if older than 1 second).

Somewhat modeled after our Perl version of this. But for the "total"
we do not use the:
> ($ctime - $last_proc_stat->{ctime}) * $clock_ticks * $cpucount;
calculation, but just add _all_ fields together, as that is the total
of CPU time.

Use a Reader-Writer lock to sync updating. First check under the
reader lock if the data is recent enough, else update it under the
writer lock.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-18 17:00:51 +01:00
Wolfgang Bumiller
1e7467ee11 cleanup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 13:41:17 +01:00
Wolfgang Bumiller
85742a0d57 tools: create_path: return whether the dir was created
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 13:40:12 +01:00
Wolfgang Bumiller
867a530724 tools: create_dir: pass EEXIST to the caller
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 13:37:10 +01:00
Wolfgang Bumiller
3c284b131d tools: fix create_path: don't use O_PATH
open(2) says file descriptors opened with O_PATH cannot be
passed to fchmod(), fchown(), etc.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 13:20:58 +01:00
Wolfgang Bumiller
5e1468bff8 formatting fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 13:20:58 +01:00
Dietmar Maurer
d0349e9ba9 src/cli/format.rs - print_help: by default, use verbose output for simply commands 2019-12-18 13:08:18 +01:00
Thomas Lamprecht
13007df318 api/macro: add NumberSchema
Adapted from the integer schema, uses f64 type.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Cc: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 11:30:55 +01:00
Wolfgang Bumiller
81cac5fc29 replace create_dir_chown with create_dir using CreateOptions
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 11:09:23 +01:00
Wolfgang Bumiller
ffcbcc117a deprecate file_set_contents{,_full}
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 10:46:28 +01:00
Wolfgang Bumiller
4bce3d76a2 tools: replace_file, make options not an option...
CreateOptions::new() creates an all-None option set anyway

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 10:04:22 +01:00
Wolfgang Bumiller
2387f9ef2b tools: introduce replace_file
nicer api with CreateOptions
see doc-comments for more info

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 10:01:46 +01:00
Wolfgang Bumiller
1d65ff88dd drop derive-builder dependency
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 10:00:30 +01:00
Wolfgang Bumiller
778983c1b0 remove old router macro documentation
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 09:40:40 +01:00
Wolfgang Bumiller
79c9d6ab08 api-macro: remove now-unnecessary PropertySchema type
Schemas can now generally refer to an externally defined
schema.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-16 13:06:58 +01:00
Wolfgang Bumiller
3e5927a1b4 api-macro: generalized '{ schema: PATH }' schemas
allow 'schema: PATH' outside object property context

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-16 12:11:52 +01:00
Wolfgang Bumiller
808035f524 api-macro: support 'async fn' with new async api method
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-16 11:13:26 +01:00
Dietmar Maurer
7dadea06dd implement ApiHandler::Async 2019-12-16 09:53:25 +01:00
Wolfgang Bumiller
d9897316b8 api: update url crate to 2.1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-13 11:30:09 +01:00
Wolfgang Bumiller
5d5918ef8e update bytes to 0.5
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-12 15:35:36 +01:00
Wolfgang Bumiller
f1fcdff9a3 formatting fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-12 15:35:30 +01:00
Wolfgang Bumiller
6d152f8930 updates for hyper 0.13 release
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-12 13:13:53 +01:00
Dietmar Maurer
bf7b939bdf proxmox-api/src/cli.rs: simplify cli setup using generics. 2019-12-09 17:38:18 +01:00
Dietmar Maurer
c9cec98ece proxmox-api/src/cli/format.rs - generate_nested_usage: fix formating with empty prefix 2019-12-06 10:14:22 +01:00
Wolfgang Bumiller
d00a096851 api: add 'router' and 'cli' features
Move API types into the router module and make router and
cli optional.

This way the 'router' module is the only thing with a
dependency on 'hyper', allowing the use of the schema alone
without pulling in the entire hyper stack.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-05 13:40:09 +01:00
Wolfgang Bumiller
2d12f81235 api: use http::{Parts,Response,Method}
hyper just reexports them

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-05 13:18:21 +01:00
Wolfgang Bumiller
ee1a7cd68b more clippy fixups
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-05 12:33:29 +01:00
Wolfgang Bumiller
65a284784b clippy fixups
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-05 11:42:34 +01:00
Wolfgang Bumiller
92ffe4c240 formatting fixup
please run `make` to check formatting before committing

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-05 11:33:12 +01:00
Wolfgang Bumiller
7c48247c58 formatting fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-05 11:32:48 +01:00