Commit Graph

7101 Commits

Author SHA1 Message Date
Dominik Csapak
c3fcfbbda8 tape: fix wrongly unloading encryption key
For security, we want to automatically unload the encryption key from
the drive when we're done, so there was a Drop handler for SgTape that
handles that. Sadly, our tool we use to set it in the first place, also
invoked the Drop handler, thus unloading the keys again immediately

To fix that, move the Drop handler one logical level higher to the
LtoTapeHandle, which is not used by the 'sg-tape-cmd'.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
(cherry picked from commit 1dc0df339b)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2024-01-23 12:11:46 +01:00
Dominik Csapak
b63da904ff tape: don't call sg-tape-cmd for unloading encryption keys
since sg-tape-cmd is only necessary if we want to load the key, we don't
have to call it when we don't have one.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
(cherry picked from commit 8ee5a5d302)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2024-01-23 12:11:46 +01:00
Dominik Csapak
386f447a42 tape: use SgTape in sg-tape-cmd
instead of LtoTapeHandle. This way, we can simply always call the binary
from LtoTapeHandle, and don't have to concern ourselves with the sg_tape
calling.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
(cherry picked from commit f1467d23f3)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2024-01-23 12:11:46 +01:00
Dominik Csapak
462b01c3ac tape: move key deriving into SgTape
makes the boundary a bit clearer, introduce 'load_key' to load a single
key from the key config

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
(cherry picked from commit 4d17ed496a)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2024-01-23 12:11:46 +01:00
Dominik Csapak
d56b17479d tape: provide 'open_lto_drive' methods for LtoTapeHandle and SgTape
Prepares for the use in sg-tape-cmd, since we want to use the SgTape
directly instead of LtoTapeHandle.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
(cherry picked from commit b5f8626706)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2024-01-23 12:11:42 +01:00
Dominik Csapak
e2d129f9de tape: improve function naming
rename the inner 'set_encryption' in sg_tape to drive_set_encryption,
so that it's a bit clearer where it comes from.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
(cherry picked from commit 8cc8aa510f)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2024-01-23 12:05:16 +01:00
Stoiko Ivanov
dc051f2e30 pbs2to3: check for proper grub meta-package for bootmode
ported over from pve-manager:
'pve7to8: check for proper grub meta-package for bootmode'
`67c655b9333714f31d5115de80961a2abc4b6506`

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2023-11-29 15:26:07 +01:00
Stoiko Ivanov
ccf5519a03 pbs2to3: add check for dkms modules
ported over from pve-manager: 'pve7to8: Add check for dkms modules'
`0329876ccf1d78b848897718bb0c2337c6a55fbb`

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2023-11-29 15:26:07 +01:00
Thomas Lamprecht
892d781dbc bump version to 2.4.4-1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-10 16:05:43 +01:00
Thomas Lamprecht
fa506db92d docs: faq: move support table to CSV
as the current table format isn't really a recommended way to encode
tables for reStructuredText, and breaks various editor integrations
(and possibly parsing in the future).

From the two supported options, i.e., csv-table and list-table, the
first one seems to be easier to maintain in the long-run, so go for
that.

https://docutils.sourceforge.io/docs/ref/rst/directives.html#csv-table-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
(cherry picked from commit 31b121f4b3)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-10 16:05:15 +01:00
Thomas Lamprecht
d8320229f1 docs: faq: add reference to support table
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
(cherry picked from commit 4650abb46e)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-10 16:05:15 +01:00
Thomas Lamprecht
ff14832915 docs: faq: add entries for how to do minor and major upgrades
Adapted from Proxmox VE's FAQ

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
(cherry picked from commit 5d4f981308)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-10 16:05:15 +01:00
Thomas Lamprecht
bf0290a766 docs: update FAQ release support table, add PBS 2.x EOL date
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
(cherry picked from commit c2fa67b417)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-10 13:11:13 +01:00
Dominik Csapak
6cff4c6bf6 fix #4977: ui: tape: restore: rework snapshot selection logic
previously, the snapshot grid returned one of three possible types of
values:
* a list of snapshots
* a list of datastores (if only whole datastores were selected)
* the string 'all' (when all snapshots were selected)

this led to some confusing and wrong code, especially the part:
```
  if (source === 'all') {
      source = values.store;
  }
```

which basically set the selected *target* store as a source.  (meaning
it tried restoring a datastore with the selected target name,
regardless if it existed or not)

This fell through in testing, since we most often only restored to the
same datastore anyway were the target and source name were the same.

Rework the return value to return the empty array in case all
snapshots are selected, since selecting none is not a valid anyway.

This means we always get an array back, which makes the code a bit
cleaner overall.

At the same time, we now differentiate correctly the 'all selected'
case, by setting the selected target as a default target.

So instead of previously having `target=target` as datastore
parameter, we now have `target` which is the correct behavior when we
want to restore the whole media set anyway.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Mira Limbeck <m.limbeck@proxmox.com>
(cherry picked from commit 3429304733)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-10 13:09:13 +01:00
Dominik Csapak
7a7d973f6d ui: tape: restore: improve variable names
some of the variable names did not really tell the full story, so
extend them a bit. This makes the intention much clearer.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Mira Limbeck <m.limbeck@proxmox.com>
(cherry picked from commit 4206d6fadb)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-10 13:07:04 +01:00
Dominik Csapak
6a031a4ec8 ui: tape: mark incomplete media-sets as such
by counting the returned tapes and compare it to the sequence number.
If the tape count is lower than the highest sequence number plus one,
there must be a tape missing.

Mark it in the text and add the proxmox-warning-row class.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
(cherry picked from commit be79c2bb6e)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-10 13:07:04 +01:00
Gabriel Goller
24734478e1 fix #4895: scheduled jobs: ignore task-log not found error
Use the job start-time as end-time when it's stuck in the
`JobState::Starting` state, no active working is running and the task
log of the last run doesn't exists.

A user experienced a power loss, which left a GC job in the `Started`
state, but the task log did not exist. This breaks the schedule and no
following GC runs. Now, the error is simply ignored and a new gc job
is started on the next occurrence.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
(cherry picked from commit 48fbce07df)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-10 13:06:14 +01:00
Dominik Csapak
6cc67d99a6 ui: tape restore: fix default namespace mapping
the ui shows the default 'root' namespace as target, but this only
worked when no namespace was selected. as soon as one source datastore
had a target namespace selected, the others datastores would be
skipped as there was no namespace mapping for them. To fix that, we
simply send a default namespace mapping for each source datastore
without a target (no target means 'root')

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Mira Limbeck <m.limbeck@proxmox.com>
(cherry picked from commit 344db2d6f6)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-10 13:05:04 +01:00
Maximiliano Sandoval
b7a43abb50 fix #4638: proxmox-backup-client: status: guard against div by zero
We throw an error if the value for total is zero.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
(cherry picked from commit dae0b67f1f)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-10 12:24:59 +01:00
Philipp Hufnagl
520566200a fix #4971: client: Improve output on successful snapshot deletion
When a snapshot gets deleted (forgotten), the proxmox backup client
currently returns returns
"Result: {
  "data": null
}"

This feedback may confuse users therefore this patch removes the output.

Signed-off-by: Philipp Hufnagl <p.hufnagl@proxmox.com>
2023-11-10 12:21:40 +01:00
Max Carrara
0590aee637 fix #4779: client: add missing "Connection" header for HTTP2 upgrade
This commit adds the missing "Connection: upgrade" HTTP header [1]
when requesting an upgrade to HTTP 2.
Doing so is mandated in the HTTP Semantics RFC [2], and without this,
(reverse) proxies that strictly follow the standard could potentially
break.

[1]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Upgrade
[2]: RFC 9110, 7.8. Upgrade: “[...] sender of Upgrade MUST also send
     an "Upgrade" connection option in the Connection header [...]”

Reported-By: McTwist <rajb89@hotmail.com>
Signed-off-by: Max Carrara <m.carrara@proxmox.com>
 [ TL: added RFC reference and use case to commit message ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-10 12:21:32 +01:00
Gabriel Goller
1ebab6a43f fix #4380: stat() is run when file is executed
When executing `proxmox-backup-client backup ...
--exclude "test/test.txt"` it still executed stat() on "test.txt",
which won't work when the current user doesn't have access to the
file or the parent folder. Now we check if the file is excluded,
and if it is not, then we execute stat().

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
2023-11-10 12:21:13 +01:00
Gabriel Goller
7b7ceb0c68 fix #4823: datastore: ignore vanished files when walking directory
When walking through a datastore on a GC run, it can
happen that the snapshot is deleted, and then walked over.
For example:
- read dir entry for group
- walk entries (snapshots)
- snapshot X is removed/pruned
- walking reaches snapshot X, but ENOENT
Previously we bailed here, now we just ignore it.
Backups that are just created (and a atomic rename from
tmpdir happens, which might triggers a ENOENT error) are
not a problem here, the GC handles them separately.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
(cherry picked from commit 9d1ba51de7)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-10 12:19:46 +01:00
Fabian Grünbichler
6a9a5db597 gc: improve lost+found comment
this sounded like we need to skip lost+found to avoid pruning too many chunks,
while the opposite is true - it's safe to skip lost+found on EPERM without
pruning too many chunks, but this is not the case for all EPERM situations..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
(cherry picked from commit 8fcd709cf2)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-10 12:19:46 +01:00
Hannes Laimer
ef8b0c2528 gc: fix ignoring if lost+found can't be accessed
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>

Fixes: e2516f61a860eae59395a3a990d9abe4c445ce8c
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
(cherry picked from commit 0d69dcb497)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-10 12:19:46 +01:00
Thomas Lamprecht
6c47db412f datastore: list images: reduce indentation depth on error checking
Simply pull out the inner IO error and the affected path first.

Clean up style-wise a bit while touching this anyway, but no semantic
change intended.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
(cherry picked from commit 5b16dffcf2)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-10 12:19:46 +01:00
Stoiko Ivanov
af63d6f9b5 pbs2to3: fix boot-mode detection
/sys/firmware/efi is a directory and std::path::Path seems to detect
only regular files with is_file [0].

Reported in our Enterprise support portal.

Quickly tested the fix on a VM.

https://doc.rust-lang.org/stable/std/path/struct.Path.html#method.is_file

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2023-08-11 09:22:23 +02:00
Thomas Lamprecht
682bb42edd bump version to 2.4.3-1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-29 15:43:46 +02:00
Thomas Lamprecht
5f7852f5a1 pbs2to3: do not log warnings in bold
for consistency with both, the summary but also PVE and PMG checker
scripts

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-29 15:43:46 +02:00
Thomas Lamprecht
2997cff520 pbs2to3: add manual page
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-29 14:09:39 +02:00
Thomas Lamprecht
690d061d76 pbs2to3: install manually to avoid empty shell-completion script
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-29 14:09:39 +02:00
Christian Ebner
7feefff6c5 pbs2to3: set failure messages to bold
... and reset instead of setting color to clear settings

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2023-06-29 14:09:39 +02:00
Christian Ebner
ab1f559f1e pbs2to3: fix whitespaces
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2023-06-29 14:09:39 +02:00
Christian Ebner
e2cdac6e70 pbs2to3: fix typo s/neighter/neither/
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2023-06-29 14:09:39 +02:00
Thomas Lamprecht
6733f1283b cargo: bump proxmox-apt to 0.9.4
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-28 17:34:35 +02:00
Christian Ebner
9eaded8572 pbs2to3: add upgrade checker binary
Adds the pbs2to3 upgrade checker with some basic checks.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Fiona Ebner <f.ebner@proxmox.com>
2023-06-28 15:44:51 +02:00
Thomas Lamprecht
891f6a6fe4 bump version to 2.4.2-2
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-06 13:16:44 +02:00
Stefan Sterz
93088816c7 buildsys: switch from '\s' as a whitespace matcher to [[:space:]]
previously the build process was broken for some versions of `awk`
(most notably `mawk`) as they did not understand the shorthand `\s`
notation for matching a whitspace. use the more universal and more
explicit `[[:space:]]` instead.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
(cherry picked from commit 7075496424)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-06 13:16:07 +02:00
Dominik Csapak
f4c54e9917 ui: tape: fix restore datastore mapping parameter construction
We recently took into account the selected datastore when restoring
from tape, but the snapshot grids value may not only be a single
datastore, it can also be a list of snapshots, datastores or 'all'.

Handle these cases and extract the source datastore correctly.

This fixes tape restoration when not a whole datastore is selected.

Reported in the forum:
https://forum.proxmox.com/threads/restore-from-lto-parameter-verification-errors-store.128445

Fixes: df881ed0 ("ui: tape: fix restoring a single datastore")
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
(cherry picked from commit 73bd988c42)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-06 13:15:01 +02:00
Thomas Lamprecht
8ccdeb217d buildsys: derive upload dist automatically
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-21 15:31:45 +02:00
Thomas Lamprecht
db9f68939e debian/lintian-overrides: refresh and add some ok-to-ignore ones
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-21 15:31:45 +02:00
Thomas Lamprecht
26cbc819a4 d/rules: expand make variable directly for version mismatch check
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-21 14:55:06 +02:00
Thomas Lamprecht
b3be7929b4 makefile: convert to use simple parenthesis
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-21 14:55:06 +02:00
Thomas Lamprecht
2152086092 buildsys: cleanup and expand clean target
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-21 14:55:06 +02:00
Fabian Grünbichler
6213ca1e21 build: inject repoid into build environment
to support building outside of the git tree, e.g. via sbuild.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2023-05-21 14:55:06 +02:00
Thomas Lamprecht
7521ec6492 d/source: override some false-positive lintian tags
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-21 14:55:06 +02:00
Thomas Lamprecht
9a8b9cbe45 d/file-restore.postinst: add DEBHELPER stanza
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-21 13:49:59 +02:00
Thomas Lamprecht
c7adb4c2ec d/control: avoid versioned build-dependcies with a -1 revision
no use, just makes backporting harder

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-21 13:49:01 +02:00
Thomas Lamprecht
3769706081 buildsys: always pre-clean for den and dsc target
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-21 13:42:19 +02:00
Thomas Lamprecht
8f8faa4541 buildsys: make deb target always build doc package, add deb-nodoc
deb should be our common "build all" target, so rather make the
exception a specific target than vice versa.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-21 13:41:23 +02:00