Dietmar Maurer
1dc117bbba
src/api2/types.rs: define and use struct StorageStatus
2020-01-23 12:51:30 +01:00
Dietmar Maurer
09b1f7b202
src/api2/types.rs: define struct BackupContent, and use it with list_snapshot_files
2020-01-23 11:17:38 +01:00
Dietmar Maurer
51534c8de9
src/backup/manifest.rs: check if manifest contains files
2020-01-23 11:16:12 +01:00
Dietmar Maurer
68a6a0ee03
src/api2/admin/datastore.rs: use api macro for delete_snapshot
2020-01-23 10:16:45 +01:00
Dietmar Maurer
6abce6c2bb
src/backup/datastore.rs: remove_backup_(group/dir) - return Error instead of io::Error
2020-01-23 10:14:46 +01:00
Dietmar Maurer
c425bdc9b2
src/api2/pull.rs: delete fanished snapshots
2020-01-23 09:58:57 +01:00
Dietmar Maurer
8a1d68c8b9
src/backup/datastore.rs: improve error messages
2020-01-23 09:58:14 +01:00
Dietmar Maurer
18cc66ee85
src/api2/pull.rs: use new Datastore::last_successful_backup helper
...
Do not fail if local group does not exists.
2020-01-22 15:06:28 +01:00
Dietmar Maurer
41b373eced
src/backup/datastore.rs: new helpers
...
last_successful_backup: Returns the time of the last successful backup
group_path: Returns the absolute path for a backup_group
snapshot_path: Returns the absolute path for a backup_dir
2020-01-22 15:05:47 +01:00
Thomas Lamprecht
1ca037d81c
followup: commit all changes
...
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-01-22 14:14:52 +01:00
Thomas Lamprecht
44b65b4ec7
api/datastore: do not allow updating path for now
...
It's a bit dangerous as it points to all the saved backups, so they
would be seemingly lost after updating the path.
Follow our logic from other products, e.g. in PVE we do not allow to
update the backing path/location of a storage either for similar
reasons.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-01-22 13:55:37 +01:00
Christian Ebner
1685c2e341
tools: LRU cache to use for pxar FUSE implementation.
...
Implements a cache with least recently used cache replacement policy.
Internally the state is tracked by a HashMap (for fast access) and a doubly
linked list (for the access order).
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2020-01-22 13:11:42 +01:00
Dietmar Maurer
f1d99e3f6a
src/bin/proxmox-backup-client.rs: use a std channel to write the catalog
2020-01-22 12:49:08 +01:00
Dietmar Maurer
02141b4d9b
src/client/pxar_backup_stream.rs: use a channel instead of a pipe
2020-01-22 11:37:16 +01:00
Dietmar Maurer
dcd033a53c
src/tools/std_channel_writer.rs: new StdChannelWriter helper class
2020-01-22 11:33:57 +01:00
Wolfgang Bumiller
9ea4bce444
bump proxmox crate to 0.1.7
...
The -sys, -tools and -api crate have now been merged into
the proxmx crate directly. Only macro crates are separate
(but still reexported by the proxmox crate in their
designated locations).
When we need to depend on "parts" of the crate later on
we'll just have to use features.
The reason is mostly that these modules had
inter-dependencies which really make them not independent
enough to be their own crates.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-21 13:48:37 +01:00
Dietmar Maurer
3f06d6fbbd
use proxmox_backup::tools::runtime::main to run async run_cli_command
2020-01-21 11:34:45 +01:00
Wolfgang Bumiller
077ac6f8b3
runtime: actually park on Pending...
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-21 10:37:16 +01:00
Wolfgang Bumiller
2d51569396
runtime: custom block_on implementation
...
futures::executor::block_on does not allow nesting, but we
need that...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-21 10:24:52 +01:00
Wolfgang Bumiller
650e052299
runtime: drop now not required Send and static restrictions
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-20 14:09:24 +01:00
Wolfgang Bumiller
d973aa827c
introduce new runtime tokio helpers
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-20 13:12:40 +01:00
Christian Ebner
aac9dbf635
pxar::fuse: remove open, opendir and releasedir callbacks
...
They are not needed as there is no internal state which needs to be tracked.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2020-01-20 12:56:21 +01:00
Christian Ebner
a8aff3535d
pxar: Include symlink target in DirectoryEntry
...
This allows to read the target path of a symbolic link in the
Decoder::read_directory_entry() function and stores it in the DirectoryEntry.
By this the Decoder::read_link() function becomes obsolete and is therefore
removed.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2020-01-20 12:56:10 +01:00
Dietmar Maurer
138910bcd4
src/client/pxar_backup_stream.rs: use std: 🧵 :Builder to name the thread
...
To make debugging easier.
2020-01-18 12:21:22 +01:00
Dietmar Maurer
4b4eba0b9e
src/api2/pull.rs: implement delete flag for vanished groups
2020-01-17 11:24:55 +01:00
Dietmar Maurer
11d89239c3
src/backup/backup_info.rs: new list_groups helper
2020-01-17 10:42:03 +01:00
Dietmar Maurer
b31c8019d7
src/api2/types.rs: define and use GroupListItem
2020-01-17 10:17:18 +01:00
Christian Ebner
2bbbade367
pxar: Refactor fuse and remove unused code.
...
By ambiguously using the Decoder::read_directory_entry() the code is simplified
and reading of the DirectoryEntry is concentrated into Context::run_in_context().
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2020-01-17 09:40:39 +01:00
Christian Ebner
95c9460c4a
pxar::fuse: Always use start offset of entries as inode.
...
Previously it was disciminated based on the entry mode.
For directories, the inode was the offset of the corresponding
goodbye tail mark while for all others it was the offset of the filename.
By simply using the start offset as calculated from the corresponding
goodbye table entry (which yields the archive offset of the filename),
the code is simplified and the more ambiguous read_directory_entry()
function can be used.
The disatvantage of this approach is the need to keep track of the
start and end offsets for each entry, as the end offset is needed in
order to access the goodbye table of directory entries.
The root node still has to be treated special, as it's inode is 1 as per fuse
definition and it has no filename as per the pxar file format definition.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2020-01-17 09:40:39 +01:00
Christian Ebner
6744440714
pxar::decoder: refactor Decoder::lookup()
...
Use Decoder::read_directory_entry() instead of Decoder::attributes() as this
already returns the needed DirectoryEntry.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2020-01-17 09:40:39 +01:00
Dietmar Maurer
f357390c15
renamed: src/config/remotes.rs -> src/config/remote.rs
...
And use 'remote' instead of 'remotes' everywhere.
2020-01-16 14:32:06 +01:00
Dietmar Maurer
d2dd827877
src/backup/catalog.rs - SenderWriter: use tokio::task::block_in_place
...
Make sure we do not block the executor.
2020-01-16 14:24:15 +01:00
Dietmar Maurer
94609e2380
src/api2/pull.rs: use reference to remote configuration
2020-01-16 13:55:19 +01:00
Dietmar Maurer
625d19621f
src/client/remote_chunk_reader.rs: use tokio::task::block_in_place to avoid blocking
...
Else we block the current executor.
2020-01-16 13:55:19 +01:00
Wolfgang Bumiller
6a0dc4a5bc
bump proxmox crate version
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-16 11:40:23 +01:00
Wolfgang Bumiller
619495b25e
fix use of deprecated items
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-16 08:58:54 +01:00
Wolfgang Bumiller
18c0df4c92
import ordering cleanup
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-16 08:51:52 +01:00
Christian Ebner
ef2d7f2f96
pxar::fuse: remove readdir implementation
...
By not implementing readdir but only readdirplus, the FUSE_CAP_READDIRPLUS flag
is set while the FUSE_CAP_READDIRPLUS_AUTO flag is not set.
Thereby the kernel will issue only readdirplus calls.
Documentation at:
https://libfuse.github.io/doxygen/fuse-3_88_80_2include_2fuse__common_8h.html#a9b90333ad08d0e1c2ed0134d9305ee87
As the expensive part for accessing and reading the attributes is seeking and
decoding each directory entry, it is usefull to force readdirplus calls.
By this a struct `EntryParam` is returned for each entry, therebye avoiding a
subsequent lookup call.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2020-01-15 14:44:53 +01:00
Dietmar Maurer
3be839c61c
src/bin/proxmox-backup-manager.rs: add completion function for update commands
2020-01-15 12:42:13 +01:00
Dietmar Maurer
002a191abf
src/api2/config: check digest
2020-01-15 12:27:05 +01:00
Dietmar Maurer
347834df25
src/api2/config: correctly lock files
2020-01-15 11:57:12 +01:00
Oguz Bektas
1c79e1017f
services: fix indentation
...
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
2020-01-15 10:55:04 +01:00
Oguz Bektas
cbe01dc5c7
tools: add read_and_verify_password helper
...
add a helper to perform some basic checks on password prompts.
- verification (asks for a 2nd time)
- check length
also use the new helper where password input in tty is taken to reduce
duplicate code.
this helper should be used when creating keys, changing passphrases etc.
note: this helper can be extended later on to provide better checks for
password strength.
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
2020-01-15 10:52:57 +01:00
Christian Ebner
ea5061979b
pxar::fuse: Avoid macro to generate filler function, use closure instead.
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2020-01-15 10:25:16 +01:00
Dietmar Maurer
f3ec5dae7f
src/api2/config: improve api schema by adding return type
2020-01-14 14:55:58 +01:00
Dietmar Maurer
ddc526623f
src/bin/proxmox-backup-manager.rs: add datastore update cli
2020-01-14 14:47:26 +01:00
Dietmar Maurer
c5799e4043
src/api2/config/datastore.rs: improve api, implement update and read
2020-01-14 14:45:56 +01:00
Dietmar Maurer
08195ac823
src/api2/config/remotes.rs: improve api, implement update and read
2020-01-14 14:20:16 +01:00
Dietmar Maurer
16f04b9d79
src/section_config.rs: add lookup_json() helper
2020-01-14 14:19:22 +01:00
Dietmar Maurer
71805bb7ec
src/api2/config/remotes.rs: fix variable name -> s/remote/id/
2020-01-14 13:20:13 +01:00
Dietmar Maurer
d0187a51a9
src/section_config.rs - convert_to_array: optionally add digest
...
datastore::config() -> also return digest
remotes::config() -> also return digest
2020-01-14 12:57:03 +01:00
Dietmar Maurer
4566303b05
src/section_config.rs - write: improve error message
2020-01-14 12:02:46 +01:00
Dietmar Maurer
f51420ba1f
src/section_config.rs: do not allow control characters
2020-01-14 11:41:48 +01:00
Dietmar Maurer
7e7b781a18
src/api2/types.rs: also define PASSWORD_FORMAT and use it correctly
2020-01-14 11:32:02 +01:00
Dietmar Maurer
da4a15a351
src/api2/types.rs: define and use PASSWORD_REGEX
2020-01-14 11:22:42 +01:00
Dietmar Maurer
ff620a3d1a
src/api2/types.rs: add regression test for PROXMOX_USER_ID_SCHEMA
2020-01-13 17:26:43 +01:00
Dietmar Maurer
ae62c4fe59
src/api2/types.rs: fix regex patterns
2020-01-13 14:38:31 +01:00
Dietmar Maurer
163dc16c0b
src/api2/types.rs: define PROXMOX_AUTH_REALM_SCHEMA and PROXMOX_USER_ID_SCHEMA
...
And try to use nbew schemas with config api...
2020-01-13 14:18:19 +01:00
Dietmar Maurer
b25f313d66
src/api2/types.rs: define HOSTNAME_FORMAT, DNS_NAME_FORMAT and DNS_NAME_OR_IP_FORMAT
2020-01-13 13:10:52 +01:00
Dietmar Maurer
8aea35fcff
src/config/*: add #[serde(skip_serializing_if="Option::is_none")] to optinal comment
2020-01-13 12:14:14 +01:00
Dietmar Maurer
454c13edce
src/api2/types.rs: define SINGLE_LINE_COMMENT_SCHEMA
2020-01-13 12:02:13 +01:00
Dietmar Maurer
167971ed49
src/api2/types.rs: define REMOTE_ID_SCHEMA here
2020-01-13 11:47:07 +01:00
Christian Ebner
6de36b94b1
pxar::fuse: impl readdirplus callback
...
readdirplus returns the entries together with their `EntryParam`, so subsequent
lookups for each of the entries are avoided.
In order to reduce code duplication, the code for filling the reply buffer is
moved into a macro.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2020-01-13 11:17:34 +01:00
Christian Ebner
caa201d895
pxar::fuse: Get rid of broken cacheing
...
Remove the current caching of attrs and goodbye tables as it is broken anyway.
This will be replaced with a LRU cache.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2020-01-13 11:16:06 +01:00
Oguz Bektas
6d20a29d73
fix typo for function name load_and_decrypt_key
...
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
2020-01-13 11:14:47 +01:00
Dietmar Maurer
50af953e1b
src/section_config.rs: make set_data generic
2020-01-11 11:09:27 +01:00
Dietmar Maurer
688fbe07a1
cleanup config api, add remotes config cli interface
2020-01-11 10:42:09 +01:00
Dietmar Maurer
9e9bc6525e
src/config/datastore.rs: define DataStoreConfig using api macro
2020-01-11 09:18:42 +01:00
Dietmar Maurer
ca44172404
src/api2/config/remotes.rs: cleanup - avoid compiler warnings
2020-01-10 19:25:26 +01:00
Christian Ebner
c7257c5539
pxar::fuse: refactor HashMap to store child parent inode relation.
...
By moving the HashMap into `Context`, the use of lazy_static as well as the
additional Mutex can be avoided (`Context` is already guarded by a Mutex).
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2020-01-10 13:45:58 +01:00
Christian Ebner
90fc97af6a
pxar::decoder::Decoder: include xattrs and payload size in `DirectoryEntry`.
...
By reading and including xattrs and payload size in struct `DirectoryEntry`,
the tuple of return types is avoided and the code is simpler.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2020-01-10 13:45:40 +01:00
Christian Ebner
6fc053ed85
pxar: encoder: limit number of max entries held at once in memory during archive creation.
...
Limit the total number of entries and therefore the approximate memory
consumption instead of doing this on a per directory basis as it was previously.
This makes more sense as it limits not only the width but also the depth of the
directory tree.
Further, instead of hardcoding this value, allow to pass this information as
additional optional parameter 'entires-max'.
By this, creation of the archive with directories containing a large number of
entries is possible.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2020-01-10 13:45:08 +01:00
Dietmar Maurer
141304d64e
src/api2/config/remotes.rs: new API to configure remotes
2020-01-10 13:28:15 +01:00
Dietmar Maurer
331b869d96
src/bin/proxmox-backup-manager.rs: implement shell completion for remote datastore name
2020-01-10 11:58:31 +01:00
Dietmar Maurer
eb506c830c
rename src/api2/sync.rs -> src/api2/pull.rs
...
Use "pull" instead of "sync", because this also indicates a
direction (like "sync from").
2020-01-10 11:15:16 +01:00
Dietmar Maurer
a81af92f9d
src/section_config.rs: implement generic lookup
2020-01-09 17:35:44 +01:00
Dietmar Maurer
0eb0e02451
src/bin/proxmox-backup-manager.rs: implement cli sync command
2020-01-09 14:52:29 +01:00
Dietmar Maurer
a575320657
src/config/remotes.rs: implement SectionConfig for remote hosts
2020-01-09 14:51:02 +01:00
Christian Ebner
ecbc62261c
pxar: encoder: warn on lacking read permissions instead of fail.
...
If during creation of the archive, files/dirs with lacking read permissions are
encountered, the user is displayed a warning and the archive is created without
including the file/dir.
Previously this resulted in an error and the archive creation failed.
In order to implement this also for the .pxarexclude files, the Error type of
MatchPattern::from_file() and MatchPattern::from_line() was adopted accordingly.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2020-01-09 10:41:19 +01:00
Christian Ebner
88cee60bad
pxar: encoder: fix incorrect goodbye table entries and update displayed path.
...
If nodes are excluded by feature flags, they must not appear in the goodbye table.
This is fixed by continuing with the next entry in the for loop.
Further the relative path buffer is now poped in order to correctly display the path.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2020-01-09 10:39:41 +01:00
Christian Ebner
ec906dcf19
src/pxar/encoder.rs: avoid use of macro and initialize Vec with known capacity.
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2020-01-09 10:38:58 +01:00
Dietmar Maurer
71da3d6a1b
src/api2/types.rs: fix SnapshotListItem schema definition
2020-01-09 10:36:19 +01:00
Dietmar Maurer
de8ec04123
src/api2/sync.rs: implement remote sync
2020-01-08 14:03:52 +01:00
Dietmar Maurer
27c9affb23
src/bin/proxmox-backup-client.rs: cleanup - factor out api_datastore_latest_snapshot()
2020-01-07 15:18:36 +01:00
Dietmar Maurer
42af4b8f06
src/bin/proxmox-backup-client.rs: cleanup - factor out api_datastore_list_snapshots()
2020-01-07 15:07:57 +01:00
Dietmar Maurer
af9d4afc66
src/bin/proxmox-backup-client.rs: use SnapshotListItem
2020-01-07 13:25:25 +01:00
Dietmar Maurer
fc189b198c
src/api2/types.rs: define and use new api type SnapshotListItem
2020-01-07 12:52:52 +01:00
Dietmar Maurer
8f14e8fe4c
src/backup/backup_info.rs: implement last_successful_backup()
...
A backup is considered successful if there is a manifest file.
2020-01-06 11:35:22 +01:00
Dietmar Maurer
247a8ca5bb
src/backup/manifest.rs: impl TryFrom DataBlob
2020-01-05 16:28:18 +01:00
Dietmar Maurer
7759eef552
src/backup/datastore.rs: implement cleanup_backup_dir()
2020-01-05 15:15:12 +01:00
Dietmar Maurer
5e1d1bead1
src/client/backup_reader.rs: make compute_file_csum() public
2020-01-05 14:50:54 +01:00
Dietmar Maurer
3743dee6de
src/client/http_client.rs: allow access to AuthInfo fields
2020-01-05 10:31:19 +01:00
Dietmar Maurer
3758b398cd
src/backup/read_chunk.rs: add read_raw_chunk()
...
Allow to read chunk data without decoding.
2020-01-02 13:29:10 +01:00
Dietmar Maurer
2585a8a4e2
src/backup/chunk_store.rs: implement cond_touch_chunk()
...
This will be used by backup sync to test if a chunk already exists.
2020-01-02 13:26:28 +01:00
Dietmar Maurer
1cf5178ac5
src/backup/datastore.rs: new helper try_shared_chunk_store_lock()
2020-01-02 11:00:33 +01:00
Dietmar Maurer
1e8da0a789
src/backup/manifest.rs: new helper archive_type()
2019-12-31 15:23:41 +01:00
Dietmar Maurer
94f085fab5
src/bin/proxmox-backup-proxy.rs: remove unused use clause
2019-12-30 11:50:24 +01:00
Dietmar Maurer
22be470d90
src/bin/proxmox-backup-api.rs: create cert here
2019-12-27 13:44:21 +01:00
Dietmar Maurer
ca6119551d
src/client/http_client.rs - start_h2_connection: correctly return error during upgrade
2019-12-27 13:41:31 +01:00
Wolfgang Bumiller
a546a8a072
proxy/api: await running workers before shutdown
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-27 12:50:33 +01:00
Dietmar Maurer
f8fd5095d8
src/bin/proxmox-backup-proxy.rs: create self signed cert at startup.
2019-12-27 11:21:32 +01:00
Dietmar Maurer
afddffc7ec
proxmox-backup-manager.rs: remove wrong fixme
2019-12-27 10:17:06 +01:00
Dietmar Maurer
e739a8d8b4
src/bin/proxmox-backup-manager.rs: impl. cert info
2019-12-23 13:06:43 +01:00
Dietmar Maurer
550e0d8870
src/bin/proxmox-backup-manager.rs: add cli to generate proxy certificate
...
Without calling external openssl binary.
2019-12-22 17:35:06 +01:00
Wolfgang Bumiller
5e62d19cfb
fix create_datastore parameters:
...
comment was declared as optional but unwrap()ed, causing
panics when not using it
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-20 12:30:25 +01:00
Dietmar Maurer
645995634a
src/api2/config/datastore.rs - create: pass uid and gid instead of User
2019-12-20 09:23:58 +01:00
Dietmar Maurer
e67770d496
src/backup/chunk_store.rs - create: pass User instead of CreateOptions
2019-12-20 09:11:40 +01:00
Thomas Lamprecht
bca9093520
api/ui: datastore: allow to set simple comment
...
for now forbid all control characters[0] in the comment value, the
section config writer cannot cope with newlines in the value, it
writes them out literally, allowing "injection" or breaking the whole
config.
In the webinterface use also a textfield, not a textarea.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-19 17:58:01 +01:00
Wolfgang Bumiller
afdcfb5bc9
let ChunkStore::create take CreateOptions
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-19 13:14:49 +01:00
Dietmar Maurer
47d4712152
src/bin/proxmox-backup-manager.rs: add task management cli
2019-12-19 11:27:36 +01:00
Dietmar Maurer
d6c4a1198a
src/bin/proxmox-backup-client.rs: use async fn
2019-12-19 11:20:59 +01:00
Dietmar Maurer
f74a03da1f
remove tools::getpwnam_ugid, impl. crate::backup::backup_user()
...
And use new nix::unistd::User struct.
2019-12-19 10:20:13 +01:00
Dietmar Maurer
8bf4559b4e
update to nix 0.16
2019-12-19 09:29:44 +01:00
Dietmar Maurer
769f8c9998
src/bin/proxmox-backup-manager.rs: connect to daemon to execute GC
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2019-12-19 08:45:27 +01:00
Dietmar Maurer
25de1c8005
src/client/backup_repo.rs: impl. new()
2019-12-19 08:44:38 +01:00
Dietmar Maurer
94913f35ca
src/bin/proxmox-backup-client.rs - start_garbage_collection: add missing output-format parameter
2019-12-19 07:57:53 +01:00
Dietmar Maurer
868c585219
src/backup/datastore.rs: avoid divide by zero
2019-12-19 07:14:23 +01:00
Dietmar Maurer
217170e11e
src/server/worker_task.rs: set worker thread name
...
This gives better logs on thread panic...
2019-12-19 07:07:39 +01:00
Dietmar Maurer
7e210bd0b4
src/backup/chunk_store.rs: create lock file with correct owner
2019-12-19 06:55:53 +01:00
Thomas Lamprecht
2337df7b3d
api2: add very basic 'status/usage' endpoint for nodes
...
For returning the nodes basic "usage status", for now one gets memory
and CPU utilization.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-18 17:24:32 +01:00
Dietmar Maurer
bce023c57c
src/tools.rs: fix typo
2019-12-18 14:29:29 +01:00
Dietmar Maurer
0b97bc6158
src/backup/chunk_store.rs: use proxmox::tools::fs::create_path
2019-12-18 12:26:43 +01:00
Dietmar Maurer
f8ec1473be
src/config/datastore.rs: use backup gid instead of uid
2019-12-18 12:21:44 +01:00
Wolfgang Bumiller
feaa1ad35f
replace file_set_contents with replace_file
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 11:16:04 +01:00
Dietmar Maurer
a66e7920dc
src/api2/config/datastore.rs: set protected flags for create/delete API
2019-12-18 10:52:45 +01:00
Dietmar Maurer
f0db500808
src/api2/config/datastore.rs: fix api docu
2019-12-18 10:48:19 +01:00
Dietmar Maurer
424766bc3b
src/config/datastore.rs: change file owner/permissions
...
owner(root) => read and write
group(backup) => read only
2019-12-18 10:41:58 +01:00
Oguz Bektas
c07b458cac
datastore: set correct owner on datastore.cfg
...
since manager runs as root, we have to specify backup:root owner while
saving config.
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
2019-12-17 16:59:10 +01:00
Oguz Bektas
14f1e63067
chunk_store: create parent directories
...
'datastore create storename /path/to/dir/that/may/not/exist' should
work.
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
2019-12-17 15:39:42 +01:00
Christian Ebner
ebfb2df22b
binary_search_tree: add additional doctest for search_binary_tree_by()
...
Make sure a start indexes larger or equal to the array size results in a return
value of `None`.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-12-17 15:37:02 +01:00
Christian Ebner
48f6d67764
binary_search_tree: fix off by one error in search_binary_tree_by()
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-12-17 14:57:34 +01:00
Christian Ebner
38d9a69875
catalog: decoder and shell: fix incorrect logic in find matching
...
The find matching was incorrectly performed starting from the parent directroy
and not as intended from the entries of the parent directory.
Further, the match pattern passed from the catalog shell contains the absolute
path of the search entry point as prefix, so find() must always start from the
archive root. This is because the match pattern has to be stored in the selected
list for a subsequent restore-selected command in the shell.
All matching paths are shown as absolute paths with all contents in the subdir,
equal to what would be restored by the given pattern.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-12-17 14:57:34 +01:00
Dietmar Maurer
81cc71c0d7
use proxmox-mini-journalreader to display syslog
2019-12-17 14:06:48 +01:00
Dietmar Maurer
20197f7cf5
src/api2/node/syslog.rs: use api macro
2019-12-17 13:26:49 +01:00
Thomas Lamprecht
9c01e73c2f
ui: add "Documentation" button to main view
...
Similar to PVE and PMG, for quick access when one has the basic
webinterface open anyway. Should move to the "proxmoxHelpButton" once
we have an onlineHelp mapping to the docs.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-17 11:22:34 +01:00
Thomas Lamprecht
2d694f8f1f
add CSS file for PBS ExtJS6 basic ui
...
some fitting rules copied over from PVE's ext6-pve.css file.
simply place it in the css subfolder where the proxmox-backup-gui.js
file is hosted and add a "css/" alias for that directory, the
formatter gets use the right content type with that.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-17 11:20:32 +01:00
Christian Ebner
25cdd0e0a1
catalog_shell: impl find for catalog shell.
...
Implements the find command which allows to find and select files for subsequent
restore.
Files selected for restore are now stored in a Vec instead of a HashSet.
This is needed, since instead of the full paths for each file, selected files are
now identified by a list of match pattern, where ordering matters.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-12-17 11:12:34 +01:00
Christian Ebner
90dfd0a71d
catalog: impl find() for file search by match pattern.
...
find() iterates over the file tree and matches each node against a list of match
patterns provided at function call.
For each matching node, a callback function with the current directroy stack is
called.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-12-17 11:12:34 +01:00
Christian Ebner
a333b4ccea
pxar: match_pattern: impl invert() to switch the match type of a MatchPattern.
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-12-17 11:12:34 +01:00
Christian Ebner
48af80b3ab
pxar: match_pattern: impl traits needed for MatchPattern to be comparable.
...
In order to check if two MatchPattern are identical, which will be used to avoid
duplicates.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-12-17 11:12:34 +01:00
Christian Ebner
255bb86030
pxar: match_pattern: refactor MatchPattern and introduce MatchPatternSlice.
...
The MatchPattern impl heavily used copies and therefore was inefficient regarding
memory management.
This patch intoduces MatchPatternSlice as struct to avoid copies and perform the
same pattern matching functionality.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-12-17 11:12:34 +01:00
Wolfgang Bumiller
dc08934563
drop Cancellable future in favor of abortable
...
futures-0.3 has a futures::future::abortable() function
which does the exact same, returns an Abortable future with
an AbortHandle providing an abort() method.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-17 10:52:07 +01:00
Wolfgang Bumiller
8554ac5ec3
fix broadcast_future test case
...
We used to await all the futures via the runtime's shutdown
method, which doesn't exist anymore, so await all the join
handles instead.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-17 10:47:12 +01:00
Thomas Lamprecht
ba3eb88d95
generate authkey: public part needs to be readable by backup group
...
else the API proxy cannot use it and fails to run..
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-17 10:17:03 +01:00
Thomas Lamprecht
9c18e93522
handle_static_file_download: move from and_then to await
...
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-17 08:56:55 +01:00
Thomas Lamprecht
4e8cff1c9d
cipherbench: align/format output nicely
...
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-17 08:49:34 +01:00
Thomas Lamprecht
4832f53ab5
cipherbench: be conform with rfc7539, use 12 byte nonce
...
else we get an error from this call, using a 16 byte (128 bit) nonce
is currently only supported by the still in draft
XChaCha20-Poly1305, not the current default specified by RFC 7539[0],
which uses a 12 byte (96 bit) nonce.
Fixes the following error:
> thread 'main' panicked at 'called `Result::unwrap()` on an `Err`
> value: ErrorStack([])', src/libcore/result.rs:1165:5
[0]: https://tools.ietf.org/html/rfc7539
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-17 08:49:07 +01:00
Dietmar Maurer
a47a02ae62
src/bin/proxmox-backup-client.rs: use #[api] macro
2019-12-16 13:49:18 +01:00
Wolfgang Bumiller
78d5436040
client: use api macro for catalog_shell async fn
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-16 11:24:44 +01:00
Dietmar Maurer
87c423751a
src/bin/proxmox-backup-client.rs: use ApiHandler::Async for prune and status
2019-12-16 11:00:43 +01:00
Dietmar Maurer
8a8a470316
src/bin/proxmox-backup-client.rs: use new ApiHandler::Async
2019-12-16 10:06:26 +01:00
Dietmar Maurer
b9799012cf
src/pxar/decoder.rs: require Send
2019-12-16 10:01:51 +01:00
Dietmar Maurer
bb084b9c91
api2: update for latest proxmox-api changes
...
- rename ApiFuture into ApiResponseFuture
- impl. ApiHandler::Async
2019-12-16 10:01:51 +01:00
Dietmar Maurer
236a396aa1
src/api2/admin/datastore.rs - prune: log retention options
2019-12-14 16:32:16 +01:00
Dietmar Maurer
503995c767
src/api2/admin/datastore.rs: fix prune worker id
2019-12-14 16:05:21 +01:00
Wolfgang Bumiller
f374ba4c0b
update tests
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-13 12:42:02 +01:00
Wolfgang Bumiller
b5c9a706ce
fix cancellable future
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-13 12:10:04 +01:00
Wolfgang Bumiller
8a1028e0e7
update to url/percent-encoding to 2.1
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-13 11:57:01 +01:00
Wolfgang Bumiller
db0cb9ce0b
update a chunk of stuff to the hyper release
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-13 11:24:41 +01:00
Dietmar Maurer
3f1020b732
src/bin/proxmox-backup-client.rs: implement task stop
2019-12-13 09:43:08 +01:00
Dietmar Maurer
1ae5677de0
src/api2/types.rs: use PROXMOX_SAFE_ID_FORMAT instead of FILENAME_FORMAT
2019-12-12 14:15:40 +01:00
Dietmar Maurer
d0adf270fb
src/api2/types.rs: introduce PROXMOX_SAFE_ID_REGEX, use it for DATASTORE_SCHEMA
2019-12-12 12:37:11 +01:00
Dietmar Maurer
66c49c21c3
src/api2/types.rs: factor out DATASTORE_SCHEMA
2019-12-11 13:45:23 +01:00
Dietmar Maurer
567d3e00fb
src/api2/node/tasks.rs: new filter "store" to filter tasks for one store
2019-12-11 12:53:34 +01:00
Christian Ebner
d3dbe52f37
pxar: match_pattern: refactor match_filename
...
The match_filename() in sequentail_decoder and encoder are moved to be static
functions of MatchPattern.
This allows to reuse the code also in the catalog find implementation.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-12-11 10:55:01 +01:00
Christian Ebner
f084505ec5
src/backup/catalog_shell.rs: sort output of list-selected
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-12-11 10:54:20 +01:00
Dietmar Maurer
6d04612955
src/api2/node/tasks.rs: add "running" filter to list only running tasks
2019-12-11 10:52:27 +01:00
Dietmar Maurer
8560fe3e5f
src/api2/node/tasks.rs - extract_upid: avoid duplicate error message
2019-12-10 13:45:56 +01:00
Dietmar Maurer
5830c20560
src/bin/proxmox-backup-client.rs: add simple task management cli
2019-12-10 13:43:53 +01:00
Dietmar Maurer
73e57f244e
src/backup/datastore.rs - garbage-collection: fix average chunk size
2019-12-10 11:25:29 +01:00
Dietmar Maurer
d105176f45
src/bin/proxmox-backup-client.rs: cleanup - factor out view_task_result()
2019-12-09 18:00:22 +01:00
Dietmar Maurer
48ef3c3327
cli: avoid useless .into()
...
This needs latest proxmox-api updates.
2019-12-09 17:40:34 +01:00
Dietmar Maurer
eb7e2ee00b
src/bin/proxmox-backup-client.rs: remove unnecessary .to_owned()
2019-12-09 17:11:48 +01:00
Dietmar Maurer
e5f7def40e
src/bin/proxmox-backup-client.rs - garbage-collection: display task log
2019-12-09 13:29:23 +01:00
Dietmar Maurer
0ec9e1b010
src/bin/proxmox-backup-client.rs: impl. and use complete_pxar_archive_name
2019-12-09 13:14:32 +01:00
Dietmar Maurer
1c6ad6ef90
src/bin/proxmox-backup-client.rs: impl. catalog sub command
...
catalog dump
catalog shell
2019-12-09 13:07:25 +01:00
Dietmar Maurer
5a0b484bdd
src/client/task_log.rs: move display_task_log into extra file
2019-12-08 11:27:15 +01:00
Dietmar Maurer
3b03abfe14
src/api2/admin/datastore.rs: remove test_prune, add dry-run to normal prune
...
And use display_task_log on the client side.
2019-12-08 10:59:47 +01:00
Dietmar Maurer
ec137a99c6
src/bin/proxmox-backup-client.r - display_task_log: use string range instead of as_bytes
2019-12-08 10:25:26 +01:00
Dietmar Maurer
b73ff941f6
src/bin/proxmox-backup-client.r - display_task_log: add new strip_date parameter
2019-12-08 10:22:02 +01:00
Dietmar Maurer
163e9bbe91
src/bin/proxmox-backup-client.rs: new display task log helper
...
New helper to display worker task logs. Use it for prune (experimental).
2019-12-07 16:11:26 +01:00
Dietmar Maurer
6b508dd563
src/server/formatter.rs: impl. new result attribute "active"
2019-12-07 15:29:42 +01:00
Dietmar Maurer
102d8d4136
src/backup/prune.rs: implement --keep-hourly
2019-12-07 11:23:33 +01:00
Dietmar Maurer
052c4aa160
src/backup/prune.rs: prune - correctly use iso_week year
2019-12-06 19:41:38 +01:00
Christian Ebner
fa0b950070
pxar: fuse: add support for list- and getxattr
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-12-06 16:44:15 +01:00
Christian Ebner
25ad4cbf63
pxar: fuse: cache goodbye table for each directory on opendir and release it on releasedir
...
Cache not only the goodbye table for the last directory but for each opened
directory.
The opendir fuse callback will fill the cache with the goodbye table and
releasedir will remove it from the cache.
This should reduce the number of chuncks fetched from the server in some cases.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-12-06 16:43:59 +01:00
Christian Ebner
02491b8fc6
pxar: fuse: use binary search instead of linear search in goodbye table.
...
The goodbye table is layed out as binary search tree based on the hash, so use
this to be more efficient when looking up a hash in the table for directories
with a large number of entries.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-12-06 16:42:01 +01:00
Dietmar Maurer
7074a0b339
src/bin/proxmox-backup-client.rs: white space cleanup
2019-12-06 13:35:59 +01:00
Dietmar Maurer
74fa81b89c
src/bin/proxmox-backup-client.rs: implement prune --dry-run
2019-12-06 13:35:25 +01:00
Dietmar Maurer
1f604f1a5a
src/api2/admin/datastore.rs: add new api test_prune()
2019-12-06 13:06:56 +01:00
Dietmar Maurer
0ab08ac980
src/api2/admin/datastore.rs: cleanup - move schema defininition in front of rust method
2019-12-06 12:36:41 +01:00
Dietmar Maurer
1a0678b601
src/api2/admin/datastore.rs: remove prune parameters from status call
...
Not idea why they are added there.
2019-12-06 12:32:53 +01:00
Dietmar Maurer
9e3f008804
src/backup/prune.rs: add new helper keeps_something()
2019-12-06 12:28:31 +01:00
Dietmar Maurer
d75fbb0a21
src/bin/dump-catalog-shell-cli.rs: generate catalog shell docs
2019-12-06 09:54:13 +01:00
Dietmar Maurer
55c3cb69cd
rename catalog_shell_api() into catalog_shell_cli()
2019-12-06 09:42:05 +01:00
Dietmar Maurer
ecbaa38fa4
src/backup/catalog_shell.rs: factor out catalog_shell_api()
...
In order to extract documentation ...
2019-12-06 09:35:47 +01:00
Christian Ebner
cca67dc0c3
src/backup/readline.rs: removed in favor of new readline impl
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-12-06 09:03:04 +01:00
Christian Ebner
6934c6fe77
src/backup/catalog_shell.rs: adapt to use API Schema definition and rustyline
...
This major refactoring of the catalog based shell utilizes the new API macro and
the API Schema as well as rustyline instead of the old GNU readline C API.
The code now has these 3 main components:
* The `Shell` which handles the readline loop via rustyline.
* The shell functions defined via the API macro.
* The `Context` which holds catalog and decoder instances.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-12-06 09:02:44 +01:00
Dietmar Maurer
9b78352188
src/backup/prune.rs: define new struct PruneOptions
2019-12-06 08:56:27 +01:00
Dietmar Maurer
92acbd69f7
src/backup/backup_info.rs: remove old prune code
2019-12-06 08:29:27 +01:00
Dietmar Maurer
408434360b
src/backup/prune.rs: add PruneMark::KeepPartial
...
Use separate mark for partial backup - dont mess them up with regular ones.
2019-12-06 08:15:32 +01:00
Dietmar Maurer
a8c8366cfa
src/backup/prune.rs: factor out code into remove_incomplete_snapshots()
2019-12-06 08:12:08 +01:00
Dietmar Maurer
dc18849156
src/backup/prune.rs: moved prune related code into extra file
2019-12-06 08:06:21 +01:00
Dietmar Maurer
6f47dd8a0f
src/backup/backup_info.rs - prune: improve algorythm
2019-12-05 18:41:28 +01:00
Dietmar Maurer
8f0b4c1f90
src/api2/admin/datastore.rs - prune: log info about all snapshots
2019-12-05 15:35:11 +01:00
Dietmar Maurer
9ce42759ec
src/backup/backup_info.rs - compute_prune_list: remove unfinished backups
2019-12-05 11:18:10 +01:00
Dietmar Maurer
2c034f8d0a
src/backup/backup_info.rs: improve prune algorithm
2019-12-05 08:55:19 +01:00
Dietmar Maurer
aeeac29bb1
src/backup/backup_info.rs: new compute_prune_list helper
...
So that we can write regression tests for this.
2019-12-04 15:49:11 +01:00
Dietmar Maurer
3d229a4a01
Revert "test another api macro use"
...
This reverts commit a9aa52e6a8
.
Because we do not want to use macros for the backup protocol for now.
And because it crashes backup tasks for some unknown reason.
2019-12-04 14:18:11 +01:00
Dietmar Maurer
4f1e40a29e
src/api2/admin/datastore.rs - read_backup_index: add manifest with size
...
So that the client can display the size of the index file.
2019-12-04 10:03:52 +01:00
Wolfgang Bumiller
a9aa52e6a8
test another api macro use
...
The api macro now supports hyphens in parameter names and
referencing externally defined `Schema`s, so here's an
example.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-03 13:41:40 +01:00
Christian Ebner
de0aa53174
pxar: decoder: fix incorrect read for hardlinks.
...
Decoders read must check if the file is a hardlink and read data from the
corresponding offset if so.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-12-03 12:08:23 +01:00
Christian Ebner
b7e18004a2
pxar: decoder: return original name in attributes()
...
The returned filename should be the one of the file given at the offset, not of
the one the hardlink points to.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-12-03 12:08:07 +01:00
Dietmar Maurer
7eea56ca00
use cli from proxmox::api
2019-12-02 11:56:29 +01:00
Dietmar Maurer
524b22df35
src/cli/completion.rs - get_help_completion: fix for "help -" expansion
2019-12-02 11:11:31 +01:00
Dietmar Maurer
e8e9bae4d1
src/bin/completion.rs: add echo command
2019-12-02 11:04:40 +01:00
Dietmar Maurer
19d7a59236
src/bin/completion.rs: use api macros
2019-12-02 10:57:19 +01:00
Dietmar Maurer
f9a51322cb
src/cli/command.rs: use insert_help()
2019-12-02 08:52:08 +01:00
Dietmar Maurer
e3e72546dd
src/cli/command.rs: cleanup, remove unused top_def parameter
2019-12-02 08:47:03 +01:00
Dietmar Maurer
2348e77edf
src/cli/completion.rs - get_simple_completion: remove all_arg_param parameters
...
Seems useless.
2019-12-02 08:31:03 +01:00
Dietmar Maurer
28c855c0a2
src/cli: improve docs
2019-12-01 16:41:49 +01:00
Dietmar Maurer
3bf920527c
src/cli/command.rs: make set_help_context private - no need to expose
2019-12-01 12:54:41 +01:00
Dietmar Maurer
bca6d9120a
src/cli/command.rs: improve help command description
2019-12-01 12:40:37 +01:00
Dietmar Maurer
2f6ecc1ccd
src/cli/completion.rs: moved all completion related code here
2019-12-01 11:44:31 +01:00
Dietmar Maurer
a810e05288
src/cli/readline.rs: moved readline related code here
2019-12-01 11:31:35 +01:00
Dietmar Maurer
5d64a0d083
src/cli/shellword.rs: moved shellword related code into this file
2019-12-01 11:17:57 +01:00
Dietmar Maurer
fb8a00bc00
src/cli/command.rs - get_nested_completion: allow fuzzy match
2019-12-01 11:06:54 +01:00
Dietmar Maurer
9498fcf9c5
src/cli/command.rs - get_nested_completion: return nothing if first argument does not match
2019-12-01 10:24:07 +01:00
Dietmar Maurer
309e449db2
src/cli/command.rs: improve get_help_completion
2019-12-01 10:18:47 +01:00
Dietmar Maurer
b8a82922c7
src/cli/command.rs: handle multilevel sub commands in help
2019-12-01 09:42:51 +01:00
Dietmar Maurer
b7bf71dfa1
src/cli/command.rs: fix help completions
2019-11-30 15:43:44 +01:00
Dietmar Maurer
7afc1af7ab
src/bin/completion.rs: add history support
2019-11-30 15:08:37 +01:00
Dietmar Maurer
4b8573da65
src/cli/command.rs - handle_command: return Result instead of exit()
2019-11-30 15:08:00 +01:00
Dietmar Maurer
2b691daf6f
src/cli.rs: add insert_help() method
2019-11-30 14:56:31 +01:00
Dietmar Maurer
1201abcffa
src/cli/command.rs: implement help
2019-11-30 13:02:00 +01:00
Wolfgang Bumiller
8423c1fe64
cli/completion: use match statements and .contains()
...
`match` is a bit more readable than the if-else chains,
also replace
space_chars.iter().any(|s| c == *s)
with
space_chars.contains(&c)
which is also more readable.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-29 13:37:34 +01:00
Dietmar Maurer
e399398444
remove shellwords crate
2019-11-29 12:49:44 +01:00
Dietmar Maurer
ca60ac13d9
use rustyline to replace readline
2019-11-29 12:49:44 +01:00
Wolfgang Bumiller
41874331ed
whitespace fixup
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-29 09:52:15 +01:00
Wolfgang Bumiller
2905f2b5e6
update api macro example usage
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-29 09:51:27 +01:00
Dietmar Maurer
8b130e71da
src/cli/command.rs: cleanup, make handlers more generic
2019-11-27 14:44:21 +01:00
Wolfgang Bumiller
7b6c41078b
update api macro invocation to new style
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-27 14:19:46 +01:00
Christian Ebner
314bb35868
catalog_shell: fix several clippy warnings
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-11-27 10:13:50 +01:00
Wolfgang Bumiller
6486cb853f
first api macro usage test/example
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-27 10:05:37 +01:00
Christian Ebner
951cf17ee3
catalog_shell: major refactoring of cli command definition and parsing
...
By changing the way shell commands are defined and parsed, this makes it more
straight forward to extend the current functionality.
The readline input is parsed based on the provided command definition and the
given parameters and options are passed to a command specific callback function.
In addition, the provided command definition including its description is used
to generate a help string to display.
The help command shows a list of all supported commands or the help string for
the provided command.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-11-26 13:01:00 +01:00
Christian Ebner
59bc6ad676
catalog_shell: check and return on empty list in order to avoid division by zero
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-11-26 12:55:33 +01:00
Christian Ebner
4e56b2f792
catalog_shell: do not restore full archive if no entries are selected for restore-selected
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-11-26 12:55:18 +01:00
Dietmar Maurer
12b4098660
src/cli/format.rs: move doc generation code into extra file
2019-11-26 12:12:53 +01:00
Dietmar Maurer
2f2b87e659
src/pxar/fuse.rs: add impl Context
2019-11-26 11:16:46 +01:00
Dietmar Maurer
eedd1f95eb
src/pxar/fuse.rs: move init and destroy into Session
2019-11-26 11:08:55 +01:00
Dietmar Maurer
970687c982
src/pxar/fuse.rs: cleanup - remove setup_session (moved into new)
2019-11-26 11:04:46 +01:00
Dietmar Maurer
2a11191072
src/pxar/fuse.rs: rename from_decoder into new, new into from_path
2019-11-26 10:56:41 +01:00
Dietmar Maurer
99b5b6cba9
src/pxar/decoder.rs: use trait object as reader
...
So that the Decoder is no longer genertic.
2019-11-26 10:45:11 +01:00
Dietmar Maurer
f701d0335e
src/pxar/sequential_decoder.rs: remove callback from new()
...
And use an extra functzion set_callback() to configure that.
Also rewrite pxar/fuse.rs and implement a generic Session (will get
further cleanups with next patches).
2019-11-26 09:56:48 +01:00
Dietmar Maurer
49fddd985c
src/cli/command.rs: use static array for arg_param
2019-11-25 11:16:41 +01:00
Dietmar Maurer
329d40b50b
rename ApiHandler::Async into ApiHandler::AsyncHttp
2019-11-23 09:03:21 +01:00
Dietmar Maurer
70fbac84da
src/server/rest.rs: simplify code
2019-11-22 18:44:14 +01:00
Dietmar Maurer
2bbd835b9b
src/server/rest.rs: rename get_request_parameters_async to get_request_parameters
2019-11-22 17:24:16 +01:00
Dietmar Maurer
75a5a68944
src/server/rest.rs - only pass ObjectSchema to get_request_parameters_async()
2019-11-22 17:22:07 +01:00
Dietmar Maurer
ad51d02aa9
src/server/rest.rs: cleanup async code
2019-11-22 13:02:05 +01:00
Wolfgang Bumiller
be2bb37205
remove api_schema submodule
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-22 09:31:45 +01:00
Dietmar Maurer
e57e1cd82d
move src/api_schema/config.rs -> src/server/config.rs
2019-11-22 09:23:03 +01:00
Dietmar Maurer
8256b0e417
src/api_schema/registry.rs: remove dead code
2019-11-22 09:04:52 +01:00
Christian Ebner
3cf73c4e53
src/bin/proxmox-backup-client.rs: impl shell subcommand for client
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-11-22 08:22:50 +01:00
Christian Ebner
f14c96ea38
src/backup/catalog_shell.rs: impl shell to inspect and restore a snapshot via the catalog
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-11-22 07:54:04 +01:00
Christian Ebner
38446a9551
src/backup/readline.rs: impl wrapper for GNU readline
...
In order to provide the context needed for tab completion via the readline
callback, the needed mut ref is passed via a thread local storage key.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-11-22 07:46:24 +01:00
Christian Ebner
6dba015043
src/backup/catalog.rs: derive Clone for DirEntry and DirEntryAttribute
...
This is needed in order to explicitly clone the values when needed in the
catalog shell implementation.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-11-22 07:15:39 +01:00
Christian Ebner
c9f002213e
src/backup/catalog.rs: impl DirEntry::is_directory()
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-11-22 07:14:00 +01:00
Christian Ebner
d3bcc7f261
src/pxar/sequential_decoder.rs: create all directories in target path
...
Create the full target path and not fail if an intermediate directory does not
exist.
This is needed in order to restore multiple archives via the catalog, where the
target should further contain each archive name as subdir.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-11-22 07:11:49 +01:00
Christian Ebner
b6ca690095
src/pxar/decoder.rs: return also payload size in lookup
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-11-22 07:05:14 +01:00
Dietmar Maurer
45cc157f7c
docs: add backup reader protocol
2019-11-22 06:59:37 +01:00
Wolfgang Bumiller
cad540e969
api/compat: remove remaining api_schema references
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 14:53:15 +01:00
Wolfgang Bumiller
a2479cfa1a
api/compat: drop more compat imports from api_schema.rs
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 14:36:28 +01:00
Wolfgang Bumiller
cc4ecf80b0
api/compat: drop api_handler submodule
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 14:18:41 +01:00
Wolfgang Bumiller
4f1963d259
api/comapt: drop schema submodule
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 14:17:36 +01:00
Wolfgang Bumiller
2194824f77
api: BoxFut -> ApiFuture
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 14:16:37 +01:00
Wolfgang Bumiller
3d482025b3
move api schema into proxmox::api crate
...
And leave some compat imports in api_schema.rs to get it to
build with minimal changes.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 14:14:54 +01:00
Dietmar Maurer
552c225948
sort all property lookup tables
...
Required, because we use binary sreach to find items.
2019-11-21 13:32:09 +01:00
Dietmar Maurer
255f378a1b
use const api definitions
2019-11-21 13:32:09 +01:00
Wolfgang Bumiller
c5946faffd
drop md5 crate dependency
...
we already depend on openssl which also provides md5
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-14 11:19:43 +01:00
Wolfgang Bumiller
f569acc5e2
drop uuid crate dependency
...
proxmox::tools now has a Uuid module using the native
libuuid.
Adds build dependency: libuuid1 (which is a Pre-Depends of
util-linux, so always installed anyway).
Drops uuid + 16 more crate dependencies.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-14 10:22:29 +01:00
Christian Ebner
b423958d8e
catalog: fix issue with DirEntry start
...
start has to be the parent start - offset
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-11-12 17:18:13 +01:00
Dietmar Maurer
780dd2b0a1
src/backup/catalog.rs: add some docs
2019-11-12 13:23:40 +01:00
Dietmar Maurer
6aa906b547
src/backup/catalog.rs - CatalogReader: verify magic number
2019-11-12 12:54:06 +01:00
Dietmar Maurer
2ec208aef5
src/backup/catalog.rs - CatalogReader::dump(): use root()
2019-11-12 12:47:21 +01:00
Dietmar Maurer
8f24a9ea18
src/backup/catalog.rs - Direntry::parse: abort if callback return false
2019-11-12 11:41:44 +01:00
Dietmar Maurer
7d017123fd
src/backup/catalog.rs: impl read_dir() and lookup(), refactor common code
2019-11-12 11:41:44 +01:00
Dietmar Maurer
dc9596de45
src/backup/catalog.rs: move CatalogEntryType from src/pxar/catalog.rs
2019-11-12 11:41:44 +01:00
Dietmar Maurer
55c0b3cc7c
src/backup/catalog.rs - DirEntry: factor out name attribute
...
And avoid allocations inside parse().
2019-11-12 11:41:44 +01:00
Christian Ebner
3f1c5b5e65
catalog: impl std::fmt::Display trait for CatalogEntryType
...
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-11-12 07:00:08 +01:00
Dietmar Maurer
f89359c2f3
src/backup/catalog.rs: clenup - use single impl block
2019-11-10 11:38:31 +01:00
Dietmar Maurer
e8d8fdc61d
src/backup/catalog.rs: remove unused code
2019-11-10 11:37:06 +01:00
Dietmar Maurer
c74c074bfd
src/backup/catalog.rs: write MAGIC at start of file
2019-11-10 11:36:45 +01:00
Dietmar Maurer
265664517a
src/backup/catalog.rs: new parse() helper
2019-11-09 14:37:33 +01:00
Dietmar Maurer
5d92935e03
src/backup/catalog.rs - dump_dir: make sure we parsed the whole data block
2019-11-09 13:21:20 +01:00
Dietmar Maurer
12a1975af9
src/backup/catalog.rs: store u64 compressed
...
This way catalogs get about 1/3 smaller.
2019-11-09 13:07:47 +01:00
Dietmar Maurer
bb19af7302
src/client/backup_reader.rs: factor out download_blob() helper
2019-11-08 13:16:41 +01:00
Dietmar Maurer
7205050059
src/client/backup_reader.rs: factor out download_fixed_index() helper
2019-11-08 12:51:52 +01:00
Dietmar Maurer
c3d84a2281
src/client/backup_reader.rs: factor out download_dynamic_index() helper
2019-11-08 12:51:52 +01:00
Dietmar Maurer
89245fb530
renamed: src/backup/catalog_blob.rs -> src/backup/catalog.rs
2019-11-08 10:41:00 +01:00