Wolfgang Bumiller
032cd1b862
pxar: restore file attributes, improve errors
...
and use the correct integer types for these operations
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-07-14 10:25:45 +02:00
Dominik Csapak
ec01eeadc6
refactor CertInfo to tools
...
we want to reuse some of the functionality elsewhere
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-07-10 11:08:53 +02:00
Dominik Csapak
3ec99affc8
get_disks: don't fail on zfs_devices
...
zfs does not have to be installed, so simply log an error and
continue, users still get an error when clicking directly on
ZFS
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-07-09 13:47:31 +02:00
Dominik Csapak
a9649ddc44
disks/zpool_status: add test for pool with special character
...
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-07-09 13:37:31 +02:00
Dominik Csapak
4f9096a211
disks/zpool_list: allow some more characters for pool list
...
not exhaustive of what zfs allows (space is missing), but this
can be done easily without problems
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-07-09 13:37:31 +02:00
Dominik Csapak
c3a4b5e2e1
zpool_list: add tests for special pool names
...
those names are allowed for zpools
these will fail for now, but it will be fixed in the next commit
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-07-09 13:37:31 +02:00
Dietmar Maurer
f91d58e157
src/tools/runtime.rs: implement get_runtime_with_builder
2020-07-07 10:11:04 +02:00
Dominik Csapak
4eb4e94918
fix test output
...
field separator for pools is always a tab when using -H
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-06-26 10:31:11 +02:00
Dominik Csapak
402c8861d8
fix typo
...
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-06-26 09:12:29 +02:00
Dominik Csapak
cbef49bf4f
remove absolute paths when executing binaries
...
we set the paths manually, so this is ok
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-06-23 07:09:06 +02:00
Dominik Csapak
f386f512d0
add AsyncReaderStream
...
and replace AsyncIndexReader's stream implementation with that
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-06-23 06:33:31 +02:00
Dietmar Maurer
3ddb14889a
src/tools/daemon.rs: reopen STDOUT/STDERR journald streams to get correct PID in logs
2020-06-22 13:06:53 +02:00
Wolfgang Bumiller
c08fac4d69
tools::daemon: sync with child after MainPid message
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-22 10:58:04 +02:00
Wolfgang Bumiller
dc2ef2b54f
tools::daemon: fetch exe name in the beginning
...
We get the path to our executable via a readlink() on
"/proc/self/exe", which appends a " (deleted)" during
package reloads.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-22 10:31:54 +02:00
Dietmar Maurer
f28cfb322a
avoid compiler warnings
2020-06-20 07:24:02 +02:00
Dietmar Maurer
3bbe291c51
zpool_status.rs - indented_list_to_tree: do not set name property
...
This is no necessary. We only touch/set 'children' and 'leaf' properties.
2020-06-20 07:19:25 +02:00
Dietmar Maurer
215968e033
src/tools/disks/zpool_status.rs: add 'leaf' attribute to root node, rename 'prev' into 'parent'
2020-06-20 06:49:06 +02:00
Dietmar Maurer
eddd1a1b9c
src/tools/disks/zpool_status.rs: move use clause top of file
2020-06-20 06:17:22 +02:00
Dietmar Maurer
d2ce211899
fixup for previous commit
2020-06-20 06:15:26 +02:00
Dietmar Maurer
1cb46c6f65
src/tools/disks/zpool_status.rs - cleanup: use struct StackItem instead of tuple
2020-06-19 18:58:57 +02:00
Dietmar Maurer
5d88c3a1c8
src/tools/disks/zpool_status.rs: remove unnecessary checks
...
Thos things can never happen, so simply use unwrap().
2020-06-19 18:27:39 +02:00
Dietmar Maurer
07fb504943
src/tools/disks/zpool_status.rs: simplify code by using serde_json::to_value
2020-06-19 17:51:13 +02:00
Dietmar Maurer
f675c5e978
src/tools/disks/zpool_status.rs - add all attributes to the tree
2020-06-19 16:55:28 +02:00
Wolfgang Bumiller
4e37d9ce67
add general indented_list_to_tree implementation
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-19 14:37:40 +02:00
Wolfgang Bumiller
e303077132
lru_cache: restrict and annotate Send impl
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-19 09:37:34 +02:00
Dietmar Maurer
3352ee5656
parse_zpool_status_field: handle tabs without copying input
2020-06-18 19:40:01 +02:00
Dietmar Maurer
b29cbc414d
parse_zpool_status_vdev: consider tabs as 8 spaces
2020-06-18 18:38:56 +02:00
Dietmar Maurer
9438aca6c9
src/tools/disks/zpool_status.rs: improve parser
2020-06-18 14:55:22 +02:00
Dietmar Maurer
547f0c97e4
src/tools/nom.rs: new helper parse_complete_line() for single line parsers
...
Like parse_complete(), but generates simpler error messages.
2020-06-18 12:57:55 +02:00
Dietmar Maurer
177a2de992
src/tools/nom.rs: move nom helpers into separate file
2020-06-18 12:41:13 +02:00
Dietmar Maurer
0686b1f4db
src/tools/disks/zpool_list.rs: split code into separate file
2020-06-18 10:31:07 +02:00
Dietmar Maurer
0727e56a06
src/tools/disks/zpool_status.rs: parse zpool status output
2020-06-18 10:23:15 +02:00
Dietmar Maurer
2fd3d57490
src/tools/disks/zfs.rs: rename ZFSPoolStatus into ZFSPoolInfo, fix error message
2020-06-17 09:08:26 +02:00
Dietmar Maurer
d0eccae37d
avoid compiler warning
2020-06-17 08:07:42 +02:00
Dietmar Maurer
a34154d900
src/tools/disks/zfs.rs: cleanup parse_pool_header
2020-06-17 07:47:11 +02:00
Dietmar Maurer
c2cc32b4dd
src/tools/disks/zfs.rs: add more parser tests
2020-06-17 07:38:19 +02:00
Dietmar Maurer
46405fa35d
src/tools/disks/zfs.rs: add comment
2020-06-17 07:14:26 +02:00
Dietmar Maurer
66af7f51bc
src/tools/disks/zfs.rs: make zfs list parser private
2020-06-17 07:00:54 +02:00
Dietmar Maurer
c72ccd4e33
src/tools/disks/zfs.rs: add regression tests for parse_zfs_list
2020-06-16 18:14:35 +02:00
Dietmar Maurer
902b2cc278
src/tools/disks/zfs.rs: simplify code
2020-06-16 17:51:17 +02:00
Dietmar Maurer
36c65ee0b0
src/tools/disks/zfs.rs: cleanup (rename usage properties)
...
And allow to parse zpool list output without -v flag.
2020-06-16 13:25:53 +02:00
Dietmar Maurer
3378fd9fe5
src/tools/disks/zfs.rs: parse more infos (dedup, fragmentation, health)
2020-06-16 13:25:53 +02:00
Dietmar Maurer
58c51cf3d9
avoid compiler warnings
2020-06-16 13:25:53 +02:00
Dietmar Maurer
5509b199fb
use new run_command helper
2020-06-16 13:25:53 +02:00
Wolfgang Bumiller
4482f3fe11
pxar, acl: cleanup acl helper usage
...
use NixPath for Acl::set_file to avoid memduping the c
string
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-12 10:52:18 +02:00
Dominik Csapak
e693818afc
refactor time functions to tools
...
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-10 13:31:10 +02:00
Dietmar Maurer
d4f2397d4c
add api to format disks and create datastores
2020-06-10 11:03:36 +02:00
Dietmar Maurer
669c137fec
src/tools/systemd.rs: implement daemon_reload, start_unit, stop_unit and enable_unit
2020-06-10 08:56:04 +02:00
Dietmar Maurer
144006fade
src/tools.rs: add new run_command helper
2020-06-10 07:16:47 +02:00
Dietmar Maurer
b9cf6ee797
src/tools/systemd/types.rs: add Mount config
2020-06-09 18:47:10 +02:00
Wolfgang Bumiller
cdde66d277
statistics: covariance(): avoid allocation
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-09 13:57:27 +02:00
Dominik Csapak
ba97479848
add statistics module
...
provides some basic statistics functions (sum, mean, etc.)
and a function to return the parameters of the linear regression of
two variables
implemented using num_traits to be more flexible for the types
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-06-09 12:19:51 +02:00
Dominik Csapak
33070956af
let disk_usage return StorageStatus and use it for datastores/nodes
...
disk_usage returned the same values as defined in StorageStatus,
so simply use that
with that we can replace the logic of the datastore status with that
function and also use it for root disk usage of the nodes
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-06-09 12:05:39 +02:00
Dietmar Maurer
da84cc52f4
src/tools/systemd.rs: implement escape_unit and unescape_unit
2020-06-09 11:52:06 +02:00
Dietmar Maurer
9bb161c881
src/tools/disks.rs: add create_single_linux_partition and create_file_system
2020-06-08 17:43:01 +02:00
Dietmar Maurer
297e600730
cleanup comment
2020-06-08 17:43:01 +02:00
Dietmar Maurer
ed7b3a7de2
src/tools/disks.rs: add get_fs_uuid helper
2020-06-08 17:43:01 +02:00
Dietmar Maurer
0f358204bd
src/tools/disks.rs: add helper to list partitions
2020-06-08 17:43:01 +02:00
Dietmar Maurer
ca6124d5fa
src/tools/disks.rs: make helpers pub
...
So that I can use them with my test code.
2020-06-08 17:43:01 +02:00
Wolfgang Bumiller
c443f58b09
switch to external pxar and fuse crates
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-08 13:56:58 +02:00
Wolfgang Bumiller
1e3d9b103d
xattr: make xattr_name_fcaps public
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-08 13:56:58 +02:00
Dietmar Maurer
bc853b028f
src/tools/disks.rs: cleanup, remove unused DiskUse bitflag type
2020-06-08 09:43:07 +02:00
Dietmar Maurer
d406de299b
src/tools/disks.rs: use dev_t to index zfs/lvm device sets
2020-06-08 09:01:34 +02:00
Dietmar Maurer
7c3aa258f8
src/tools/disks/zfs.rs: allow empty zpool list output
2020-06-08 07:23:04 +02:00
Dietmar Maurer
044055062c
src/tools/disks.rs: new helper to reread partition table
2020-06-08 07:22:06 +02:00
Dietmar Maurer
707974fdb3
src/api2/node/disks.rs: implement initgpt API
2020-06-07 10:30:34 +02:00
Dietmar Maurer
9069debcd8
src/api2/types.rs: define BLOCKDEVICE_NAME_SCHEMA
2020-06-07 07:20:25 +02:00
Dietmar Maurer
d2522b2db6
src/tools/disks.rs: fix disk size, add completion helper
2020-06-06 15:39:25 +02:00
Dietmar Maurer
042afd6e52
src/tools/disks.rs: new helper disk_by_name()
2020-06-06 12:22:38 +02:00
Dietmar Maurer
de1e1a9d95
src/tools/disks.rs: use api macro so that we can use those types with the api
2020-06-06 11:37:24 +02:00
Dietmar Maurer
91960d6162
src/tools/disks.rs - get_disks: query smart status
2020-06-06 09:18:20 +02:00
Dietmar Maurer
4c24a48eb3
src/tools/disks/smart.rs: use model.to_string_lossy() to simplify code
2020-06-06 09:05:22 +02:00
Dietmar Maurer
484e761dab
src/tools/disks/smart.rs: try to get correct wearout for ATA devices
2020-06-06 09:01:15 +02:00
Dietmar Maurer
059b7a252e
src/tools/disks/smart.rs - get_smart_data: use &Disk instead of &str
...
So that we can query other device infos easily (model, vendor, ..)
2020-06-06 08:24:58 +02:00
Dietmar Maurer
eb80aac288
src/tools/disks/smart.rs: parse output from smartctl
2020-06-05 18:30:06 +02:00
Dietmar Maurer
c26aad405f
src/tools/disks.rs: implement get_disks (similar to the one in PVE::Diskmanage)
...
But no ceph support for now. Also no support for old cciss block devices.
2020-06-05 10:33:53 +02:00
Dietmar Maurer
f03a0e509e
src/tools/disks.rs; use correct subdir to check holders
2020-06-05 10:33:53 +02:00
Dietmar Maurer
4c1e8855cc
src/tools/disks.rs: fix disk type detection, remove newline from vendor string
2020-06-05 08:09:52 +02:00
Dietmar Maurer
620911b426
src/tools/disks/lvm.rs: implement get_lvm_devices()
2020-06-04 09:12:19 +02:00
Dietmar Maurer
5c264c8d80
src/tools/disks.rs: add/use get_partition_type_info
2020-06-04 07:48:22 +02:00
Dominik Csapak
eed8a5ad79
tools/systemd/time: fix compute_next_event for weekdays
...
two things were wrong here:
* the range (x..y) does not include y, so the range
(day_num+1..6) goes from (day_num+1) to 5 (but sunday is 6)
* WeekDays.bits() does not return the 'day_num' of that day, but
the bit value (e.g. 64 for SUNDAY) but was treated as the index of
the day of the week
to fix this, we drop the map to WeekDays and use the 'indices'
directly
this patch makes the test work again
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-06-04 07:02:33 +02:00
Dominik Csapak
538b9c1c27
systemd/time: add tests for all weekdays
...
this fails for now
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-06-04 07:02:23 +02:00
Dietmar Maurer
456ad0c478
src/tools/disks/zfs.rs: add parser for zpool list output
2020-06-03 12:16:08 +02:00
Thomas Lamprecht
add5861e8d
typo fixes all over the place
...
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-05-30 16:39:08 +02:00
Dietmar Maurer
934f5bb8ac
src/bin/proxmox-backup-proxy.rs: cleanup, move code to src/tools/disks.rs
...
And simplify find_mounted_device by using stat.st_dev
2020-05-29 11:13:36 +02:00
Dietmar Maurer
750252ba2f
src/tools/systemd/time.rs: add test for "daily" schedule
2020-05-29 07:52:09 +02:00
Dietmar Maurer
c94e1f655e
rrd stats: improve io delay stats
2020-05-28 19:12:13 +02:00
Dietmar Maurer
547e3c2f6c
src/tools/disks/zfs.rs: use wtime + rtime (wait + run time)
2020-05-28 11:45:34 +02:00
Dietmar Maurer
0146133b4b
src/tools/disks/zfs.rs: helper to read zfs pool io stats
2020-05-28 10:07:52 +02:00
Dietmar Maurer
3fcc4b4e5c
src/tools/disks.rs: add helper to read block device stats
2020-05-26 11:20:22 +02:00
Dietmar Maurer
3ed07ed2cd
src/tools/disks.rs: export read_sys
2020-05-26 09:49:13 +02:00
Dietmar Maurer
ee8b464466
src/tools/systemd.rs: avoid compiler warnings
2020-05-20 16:47:08 +02:00
Dietmar Maurer
479e4932b5
src/tools/systemd/parse_time.rs: improve error message
2020-05-20 09:43:16 +02:00
Dietmar Maurer
d6c28ddf84
src/tools/systemd/time.rs: export parse/verify
2020-05-20 08:38:39 +02:00
Dominik Csapak
16c75c580b
adapt to changes of SectionConfigPlugin
...
it requires not an Option<String> for the optional id_property
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-05-19 09:28:45 +02:00
Dietmar Maurer
7a314d18f7
src/tools/systemd/parse_time.rs: check max values
2020-05-16 13:13:50 +02:00
Dietmar Maurer
2d08c97ae2
CalendarEvent - compute_next_value: use change tracking to avoid repeated testing
2020-05-16 10:32:27 +02:00
Dietmar Maurer
50ce1f987d
CalendarEvent - compute_next_value: support seconds
2020-05-16 10:21:24 +02:00
Dietmar Maurer
d1a5ffdf78
src/tools/systemd/tm_editor.rs: new helper class
2020-05-16 10:09:41 +02:00
Dietmar Maurer
99baf7afcc
CalendarEvent: test and fix repeated values
2020-05-16 07:43:51 +02:00