Commit Graph

4710 Commits

Author SHA1 Message Date
Christian Ebner 4d142ea79e pxar: cleanup: refactor and rename exclude pattern
The original name PxarExcludePattern makes no sense anymore as the patterns are
also used to match filenames during restore of the archive.

Therefore, exclude_pattern.rs is moved to match_pattern.rs and PxarExcludePattern
rename to MatchPattern.
Further, since it makes more sense the MatchTypes are now declared as None,
Positive, Negative, PartialPositive or PartialNegative, as this makes more sense
and seems more readable.
Positive matches are those without '!' prefix, Negatives with '!' prefix.

This makes also the filename matching in the encoder/decoder more intuitive and
the logic was adapted accordingly.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-08-03 08:52:32 +02:00
Christian Ebner fe076c8259 pxar: cleanup: s/PxarDirBuf/PxarDirStack/g and move dir_buffer.rs to dir_stack.rs
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-08-03 08:52:10 +02:00
Christian Ebner ead7546a96 pxar: change uid and gid to u32 instead of u64
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-08-03 08:51:51 +02:00
Christian Ebner 5e50c606b0 pxar: cleanup: s/CA_FORMAT/PXAR/g and s/CaFormat/Pxar/g
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-08-03 08:51:33 +02:00
Christian Ebner 47651f9530 pxar: cleanup: move feature flags to src/pxar/flags.rs and omit CA_FORMAT prefix on all of them
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-08-03 08:51:06 +02:00
Christian Ebner 91451c4355 pxar: cleanup: move filesystem related magic numbers to tools/fs/magic.rs
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-08-03 08:48:12 +02:00
Dietmar Maurer b335f5b713 src/bin/proxmox-backup-client.rs: sign index.json 2019-08-02 10:00:15 +02:00
Dietmar Maurer 69ecd8d5b0 src/backup/data_blob.rs: implement signed blobs 2019-08-02 09:56:01 +02:00
Dietmar Maurer 93205f942a src/backup/crypt_config.rs: new compute_auth_tag helper 2019-08-02 08:55:37 +02:00
Dietmar Maurer c68d2170d5 src/backup/crypt_config.rs: fix typo 2019-08-02 08:29:40 +02:00
Christian Ebner 81a9905e0a pxar: implement feature flag support for device nodes, fifos and sockets
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-08-02 07:55:17 +02:00
Christian Ebner 8abc95a145 pxar: remove some unused feature flags from format definition
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-08-02 07:54:46 +02:00
Christian Ebner 3a905cac2b src/pxar/sequential_decoder.rs: remove of obsolete function dir_mkdirat
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-08-02 07:52:49 +02:00
Christian Ebner beffac999f src/pxar/sequentail_decoder.rs: fix issue when restoring with glob pattern.
Partial extraction of an archive with a glob pattern, e.g. '**/*.conf' lead to
the unexpected behaviour of restoring all partially matched directories (in this
example all of them).

This patch fixes this unexpected behaviour by only restoring those directories
were the directory or one of its sub-items fully matched the pattern and should
therefore be restored.

To achive this behavoiur, directory metadata is pushed onto a stack and restored
on demand.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-08-02 07:49:47 +02:00
Christian Ebner 51ac99c314 src/pxar/exclude_pattern.rs: add Clone and Copy trait to MatchType
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-08-02 07:49:47 +02:00
Christian Ebner 6a584cfd76 pxar: add PxarDir and PxarDirBuf to buffer directory metadata
In order to restore only directories when some of their content fully matched
a match pattern on partial restores, these directories and their metadata are
pushed onto this buffer and only restored successivley on demand.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-08-02 07:45:12 +02:00
Dietmar Maurer 27e6e180b6 src/pxar/format_definition.rs - PxarAttributes: derive Default
And remove unnecessary impl new().
2019-08-02 07:16:10 +02:00
Christian Ebner a92e6c9011 src/pxar/sequential_decoder.rs: split read and restore of attributes into separate functions
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-08-02 07:11:38 +02:00
Christian Ebner e60cfbcdd0 src/pxar/format_definition.rs: add struct PxarAttributes
This structure contains all the attributes allowing to easily store those within
a e.g. dir buffer.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-08-02 07:10:22 +02:00
Christian Ebner 2be3eff5c3 pxar: avoid taking ownership of xattrs, fcaps and quota_projid on corresponding restore functions.
By borrowing these objects we preserve the functionality but make sure
that ownership doesn't change, avoiding problems when contained within other
structs such as e.g. a buffer storing these attributes.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-08-02 06:44:00 +02:00
Dietmar Maurer 2c3891d1c3 src/bin/proxmox-backup-client.rs: upload backup index.json
The plan is to use this file to verify the backup content.
2019-08-01 12:39:02 +02:00
Dietmar Maurer 953d5e1531 src/tools.rs - file_set_contents_full: only call fchmod when we pass permissions
So that we can use it to write into /etc/pve/ (which does not support chmod).
2019-07-31 12:44:27 +02:00
Dietmar Maurer cec17a3ec7 src/bin/proxmox-backup-client.rs - files: allow --repository parameter 2019-07-31 11:45:55 +02:00
Dietmar Maurer 52c171e49d src/bin/proxmox-backup-client.rs: implement files command 2019-07-31 11:23:53 +02:00
Dietmar Maurer 43a406fd3f src/bin/proxmox-backup-client.rs: supress useless output from prune command 2019-07-31 10:15:16 +02:00
Christian Ebner 9731c8b862 pxar: add support for storing/restoring the quota project id on ZFS
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-07-30 09:40:48 +02:00
Christian Ebner 6a87910949 pxar: implement allow_existing_dirs for pxar decoder
By default, restoring an archive will fail if files with the same filename
already exist in the target directory.

By setting the allow_existing_dirs flag, the restore will not fail if an
existing directory is encountered.
The metadata (permissions, acls, ...) of the existing directory will be set
to the ones from the archive.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-07-30 09:40:30 +02:00
Dietmar Maurer 46d5aa0a09 src/bin/proxmox-backup-client.rs: add restore flag --allow-existing-dirs
Not jet implemented ...
2019-07-29 12:49:15 +02:00
Dietmar Maurer ea7a7ef299 src/bin/proxmox-backup-client.rs: fixup - correctly pass prune parameters 2019-07-27 09:24:23 +02:00
Dietmar Maurer 9fdc3ef46f src/api2/admin/datastore.rs: pass backup type/id (group) to prune
IMHO, prune over all backup groups is a bit dangerous, considering
that more than one user might use a datastore.
2019-07-27 08:49:14 +02:00
Dietmar Maurer 7a6cfbd98d src/bin/proxmox-backup-client.rs: correctly compute duration
And format time with SecondsFormat::Secs
2019-07-26 11:13:49 +02:00
Dietmar Maurer bbf9e7e951 src/api2/backup.rs: cleanup schema definitions 2019-07-26 09:07:29 +02:00
Dietmar Maurer ca5d0b61ca src/api2/backup.rs: new required backup-time parameter
The client should pass the time as parameter.
2019-07-25 13:44:01 +02:00
Dietmar Maurer e128d4e84f src/api2/admin/datastore.rs: backup logs may not be written twice 2019-07-25 12:29:04 +02:00
Dietmar Maurer ef3254c086 src/api2/admin/datastore.rs: use correct .blob extension for log 2019-07-25 12:22:50 +02:00
Dietmar Maurer ec34f7eba0 src/bin/proxmox-backup-client.rs: implement upload-log 2019-07-25 12:18:15 +02:00
Dietmar Maurer 04512d3068 src/client/http_client.rs: allow upload with parameters 2019-07-25 12:17:35 +02:00
Dietmar Maurer 07ee223590 src/api2/admin/datastore.rs: add api to upload backup client log file 2019-07-25 12:15:30 +02:00
Dietmar Maurer 79679c2d6e src/bin/proxmox-backup-client.rs: allow to uploag .log files (as binary blobs) 2019-07-24 13:07:02 +02:00
Dietmar Maurer 5b72c9b4f7 src/pxar/encoder.rs: add new skip_lost_and_found parameter 2019-07-24 12:21:25 +02:00
Dietmar Maurer 6c3c9bceb5 pxar_backup_stream.rs: limit lock scope to avoid blocking forever 2019-07-24 11:30:43 +02:00
Dietmar Maurer 684233aa3b remove debug output 2019-07-24 09:33:52 +02:00
Dietmar Maurer 5be106eeae src/client/pxar_backup_stream.rs: correctly pass errors to stream 2019-07-24 09:24:35 +02:00
Dietmar Maurer 2eeaacb974 src/pxar/encoder.rs: allow to pass list of devices
For better mount point include control...
2019-07-24 08:11:59 +02:00
Dietmar Maurer fa5d6977dd Revert previous, commit, use UTC RFC3339 without timezone (Z)
We now have human readable data/time, and names are still sortable.
2019-07-22 11:49:30 +02:00
Dietmar Maurer 10c2a21cfe src/backup/backup_info.rs: use unix epoch timestamps instead of RFC3339
RFC3339 contains additional timezone information, but IMHO this just adds
more confusion. The API also uses timestamps.
2019-07-22 07:57:03 +02:00
Christian Ebner 1fdef50f52 src/pxar/sequential_decoder.rs: Call callback only on restored paths.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-07-19 11:58:51 +02:00
Dietmar Maurer 40a13369a3 src/bin/pxar.rs - extract: print archive name with --verbose flag 2019-07-19 07:01:57 +02:00
Dietmar Maurer bbd4365c61 src/bin/pxar.rs: remove wrong debug message 2019-07-19 07:00:17 +02:00
Christian Ebner a0ec687cd7 src/bin/pxar.rs: allow to pass paths and match patterns as args to pxar extract
To improve usability it is now possible to directly pass paths or match patterns
as arguments to pxar extract to partially restore an archive.
The patterns provided via CLI are appended to the ones read from file by the
--files-from option in order to have priority over those.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-07-19 06:50:39 +02:00