Skip to content
This repository was archived by the owner on Nov 30, 2021. It is now read-only.

Commit 5d07409

Browse files
committed
Merge branch 'stable-1' of https://git.proxmox.com/git/proxmox-backup
2 parents b9eef62 + 238e5b5 commit 5d07409

File tree

23 files changed

+484
-188
lines changed

23 files changed

+484
-188
lines changed

Cargo.toml

+17-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "proxmox-backup"
3-
version = "1.1.10"
3+
version = "1.1.13"
44
authors = [
55
"Dietmar Maurer <[email protected]>",
66
"Dominik Csapak <[email protected]>",
@@ -52,17 +52,6 @@ pam-sys = "0.5"
5252
percent-encoding = "2.1"
5353
pin-utils = "0.1.0"
5454
pin-project = "1.0"
55-
#pathpatterns = "0.1.2"
56-
pathpatterns = { path = "../pathpatterns" }
57-
#proxmox = { version = "0.11.5", features = [ "sortable-macro", "api-macro" ] }
58-
#proxmox = { git = "git://git.proxmox.com/git/proxmox", version = "0.1.2", features = [ "sortable-macro", "api-macro" ] }
59-
proxmox = { path = "../proxmox/proxmox", features = [ "sortable-macro", "api-macro" ] }
60-
#proxmox-fuse = "0.1.1"
61-
proxmox-fuse = { path = "../proxmox-fuse" }
62-
#proxmox-http = { version = "0.2.1", features = [ "client", "http-helpers", "websocket" ] }
63-
proxmox-http = { version = "0.2.1", path = "../proxmox/proxmox-http", features = [ "client", "http-helpers", "websocket" ] }
64-
#pxar = { version = "0.10.1", features = [ "tokio-io" ] }
65-
pxar = { path = "../pxar", features = [ "tokio-io" ] }
6655
regex = "1.2"
6756
rustyline = "7"
6857
serde = { version = "1.0", features = ["derive"] }
@@ -84,8 +73,23 @@ zstd = { version = "0.4", features = [ "bindgen" ] }
8473
nom = "5.1"
8574
crossbeam-channel = "0.5"
8675

87-
#proxmox-acme-rs = "0.2.1"
76+
pathpatterns = "0.1.2"
77+
pxar = { version = "0.10.1", features = [ "tokio-io" ] }
78+
79+
proxmox = { version = "0.11.6", features = [ "sortable-macro", "api-macro", "cli", "router", "tfa" ] }
80+
proxmox-acme-rs = "0.2.1"
81+
proxmox-fuse = "0.1.1"
82+
proxmox-http = { version = "0.2.1", features = [ "client", "http-helpers", "websocket" ] }
83+
84+
# Local path overrides
85+
# NOTE: You must run `cargo update` after changing this for it to take effect!
86+
[patch.crates-io]
87+
proxmox = { path = "../proxmox/proxmox", features = [ "sortable-macro", "api-macro", "cli", "router", "tfa" ] }
88+
proxmox-http = { path = "../proxmox/proxmox-http", features = [ "client", "http-helpers", "websocket" ] }
89+
proxmox-fuse = { path = "../proxmox-fuse" }
8890
proxmox-acme-rs = { path = "../proxmox-acme-rs" }
91+
pxar = { path = "../pxar", features = [ "tokio-io" ] }
92+
pathpatterns = { path = "../pathpatterns" }
8993

9094
[features]
9195
default = []

Makefile

+3-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ deb: build
113113
lintian $(DEBS)
114114

115115
.PHONY: deb-all
116-
deb-all: $(DOC_DEB) $(DEBS)
116+
deb-all: build
117+
cd build; dpkg-buildpackage -b -us -uc --no-pre-clean
118+
lintian $(DEBS) $(DOC_DEB)
117119

118120
.PHONY: dsc
119121
dsc: $(DSC)

build.rs

+12-13
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,22 @@
22
use std::env;
33
use std::process::Command;
44

5+
fn git_command(args: &[&str]) -> String {
6+
match Command::new("git").args(args).output() {
7+
Ok(output) => String::from_utf8(output.stdout).unwrap().trim_end().to_string(),
8+
Err(err) => {
9+
panic!("git {:?} failed: {}", args, err);
10+
}
11+
}
12+
}
13+
514
fn main() {
15+
let repo_path = git_command(&["rev-parse", "--show-toplevel"]);
616
let repoid = match env::var("REPOID") {
717
Ok(repoid) => repoid,
8-
Err(_) => {
9-
match Command::new("git")
10-
.args(&["rev-parse", "HEAD"])
11-
.output()
12-
{
13-
Ok(output) => {
14-
String::from_utf8(output.stdout).unwrap()
15-
}
16-
Err(err) => {
17-
panic!("git rev-parse failed: {}", err);
18-
}
19-
}
20-
}
18+
Err(_) => git_command(&["rev-parse", "HEAD"]),
2119
};
2220

2321
println!("cargo:rustc-env=REPOID={}", repoid);
22+
println!("cargo:rerun-if-changed={}/.git/HEAD", repo_path);
2423
}

debian/changelog

+51
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,54 @@
1+
rust-proxmox-backup (1.1.13-2) buster; urgency=medium
2+
3+
* revert "auth: improve thread safety of 'crypt' C-library", not safe for
4+
Debian buster based releases.
5+
6+
-- Proxmox Support Team <[email protected]> Mon, 26 Jul 2021 16:40:07 +0200
7+
8+
rust-proxmox-backup (1.1.13-1) buster; urgency=medium
9+
10+
* auth: improve thread safety of 'crypt' C-library
11+
12+
* file-restore: increase lock timeout on QEMU map
13+
14+
* file restore daemon: log basic startup steps
15+
16+
* REST-API: set error message extension for bad-request response log to
17+
ensure the actual error is logged in any (access) log, making debugging
18+
such issues easier.
19+
20+
* restore daemon: use millisecond log resolution
21+
22+
* fix #3496: acme: plugin: actually sleep after setting the TXT record,
23+
ensuring DNS propagation of that record. This makes it catch up with the
24+
docs/web-interface, where the option was already available.
25+
26+
-- Proxmox Support Team <[email protected]> Fri, 23 Jul 2021 12:34:29 +0200
27+
28+
rust-proxmox-backup (1.1.12-1) buster; urgency=medium
29+
30+
* subscription: set higher-level error to message instead of bailing out, to
31+
ensure a force-check gets through
32+
33+
* ui: dashboard: datastore stats: fix closing <i> tag
34+
35+
* ui: datastore: option view: only navigate up when we actually removed the
36+
datastore
37+
38+
-- Proxmox Support Team <[email protected]> Fri, 09 Jul 2021 12:56:35 +0200
39+
40+
rust-proxmox-backup (1.1.11-1) buster; urgency=medium
41+
42+
* tape/drive: fix logging when requesting media
43+
44+
* tape: fix LTO locate_file for HP drives
45+
46+
* fix #3393 (again): pxar/create: try to read xattrs/fcaps/acls by default
47+
48+
* proxmox-backup-manager: show task log on datastore create
49+
50+
-- Proxmox Support Team <[email protected]> Wed, 30 Jun 2021 11:24:20 +0200
51+
152
rust-proxmox-backup (1.1.10-1) buster; urgency=medium
253

354
* ui: datastore list summary: catch and show errors per datastore

docs/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ epub3: ${GENERATED_SYNOPSIS}
228228

229229
clean:
230230
rm -r -f *~ *.1 ${BUILDDIR} ${GENERATED_SYNOPSIS} api-viewer/apidata.js
231+
rm -f api-viewer/apidoc.js lto-barcode/lto-barcode-generator.js
231232

232233

233234
install_manual_pages: ${MAN1_PAGES} ${MAN5_PAGES}

src/acme/plugin.rs

+17-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use std::future::Future;
22
use std::pin::Pin;
33
use std::process::Stdio;
44
use std::sync::Arc;
5+
use std::time::Duration;
56

67
use anyhow::{bail, format_err, Error};
78
use hyper::{Body, Request, Response};
@@ -68,7 +69,7 @@ fn extract_challenge<'a>(
6869
.challenges
6970
.iter()
7071
.find(|ch| ch.ty == ty)
71-
.ok_or_else(|| format_err!("no supported challenge type (dns-01) found"))
72+
.ok_or_else(|| format_err!("no supported challenge type ({}) found", ty))
7273
}
7374

7475
async fn pipe_to_tasklog<T: AsyncRead + Unpin>(
@@ -180,7 +181,21 @@ impl AcmePlugin for DnsPlugin {
180181
domain: &'d AcmeDomain,
181182
task: Arc<WorkerTask>,
182183
) -> Pin<Box<dyn Future<Output = Result<&'c str, Error>> + Send + 'fut>> {
183-
Box::pin(self.action(client, authorization, domain, task, "setup"))
184+
Box::pin(async move {
185+
let result = self
186+
.action(client, authorization, domain, task.clone(), "setup")
187+
.await;
188+
let validation_delay = self.core.validation_delay.unwrap_or(30) as u64;
189+
190+
if validation_delay > 0 {
191+
task.log(format!(
192+
"Sleeping {} seconds to wait for TXT record propagation",
193+
validation_delay
194+
));
195+
tokio::time::sleep(Duration::from_secs(validation_delay)).await;
196+
}
197+
result
198+
})
184199
}
185200

186201
fn teardown<'fut, 'a: 'fut, 'b: 'fut, 'c: 'fut, 'd: 'fut>(

src/api2/node/disks.rs

+2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ pub fn list_disks(
6666
}
6767
}
6868

69+
list.sort_by(|a, b| a.name.cmp(&b.name));
70+
6971
Ok(list)
7072
}
7173

src/bin/proxmox-restore-daemon.rs

+12-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
///! Daemon binary to run inside a micro-VM for secure single file restore of disk images
22
use anyhow::{bail, format_err, Error};
3-
use log::error;
43
use lazy_static::lazy_static;
4+
use log::{info, error};
55

66
use std::os::unix::{
77
io::{FromRawFd, RawFd},
@@ -37,24 +37,31 @@ lazy_static! {
3737
/// This is expected to be run by 'proxmox-file-restore' within a mini-VM
3838
fn main() -> Result<(), Error> {
3939
if !Path::new(VM_DETECT_FILE).exists() {
40-
bail!(concat!(
41-
"This binary is not supposed to be run manually. ",
42-
"Please use 'proxmox-file-restore' instead."
43-
));
40+
bail!(
41+
"This binary is not supposed to be run manually, use 'proxmox-file-restore' instead."
42+
);
4443
}
4544

4645
// don't have a real syslog (and no persistance), so use env_logger to print to a log file (via
4746
// stdout to a serial terminal attached by QEMU)
4847
env_logger::from_env(env_logger::Env::default().default_filter_or("info"))
4948
.write_style(env_logger::WriteStyle::Never)
49+
.format_timestamp_millis()
5050
.init();
5151

52+
// the API may save some stuff there, e.g., the memcon tracking file
53+
// we do not care much, but it's way less headache to just create it
54+
std::fs::create_dir_all("/run/proxmox-backup")?;
55+
5256
// scan all attached disks now, before starting the API
5357
// this will panic and stop the VM if anything goes wrong
58+
info!("scanning all disks...");
5459
{
5560
let _disk_state = DISK_STATE.lock().unwrap();
5661
}
5762

63+
info!("disk scan complete, starting main runtime...");
64+
5865
proxmox_backup::tools::runtime::main(run())
5966
}
6067

src/bin/proxmox_backup_manager/datastore.rs

+81-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ use proxmox::api::{api, cli::*, RpcEnvironment, ApiHandler};
55

66
use proxmox_backup::config;
77
use proxmox_backup::api2::{self, types::* };
8+
use proxmox_backup::client::{
9+
connect_to_localhost,
10+
view_task_result,
11+
};
12+
use proxmox_backup::config::datastore::DIR_NAME_SCHEMA;
813

914
#[api(
1015
input: {
@@ -67,6 +72,81 @@ fn show_datastore(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value
6772
Ok(Value::Null)
6873
}
6974

75+
#[api(
76+
protected: true,
77+
input: {
78+
properties: {
79+
name: {
80+
schema: DATASTORE_SCHEMA,
81+
},
82+
path: {
83+
schema: DIR_NAME_SCHEMA,
84+
},
85+
comment: {
86+
optional: true,
87+
schema: SINGLE_LINE_COMMENT_SCHEMA,
88+
},
89+
"notify-user": {
90+
optional: true,
91+
type: Userid,
92+
},
93+
"notify": {
94+
optional: true,
95+
schema: DATASTORE_NOTIFY_STRING_SCHEMA,
96+
},
97+
"gc-schedule": {
98+
optional: true,
99+
schema: GC_SCHEDULE_SCHEMA,
100+
},
101+
"prune-schedule": {
102+
optional: true,
103+
schema: PRUNE_SCHEDULE_SCHEMA,
104+
},
105+
"keep-last": {
106+
optional: true,
107+
schema: PRUNE_SCHEMA_KEEP_LAST,
108+
},
109+
"keep-hourly": {
110+
optional: true,
111+
schema: PRUNE_SCHEMA_KEEP_HOURLY,
112+
},
113+
"keep-daily": {
114+
optional: true,
115+
schema: PRUNE_SCHEMA_KEEP_DAILY,
116+
},
117+
"keep-weekly": {
118+
optional: true,
119+
schema: PRUNE_SCHEMA_KEEP_WEEKLY,
120+
},
121+
"keep-monthly": {
122+
optional: true,
123+
schema: PRUNE_SCHEMA_KEEP_MONTHLY,
124+
},
125+
"keep-yearly": {
126+
optional: true,
127+
schema: PRUNE_SCHEMA_KEEP_YEARLY,
128+
},
129+
"output-format": {
130+
schema: OUTPUT_FORMAT,
131+
optional: true,
132+
},
133+
},
134+
},
135+
)]
136+
/// Create new datastore config.
137+
async fn create_datastore(mut param: Value) -> Result<Value, Error> {
138+
139+
let output_format = extract_output_format(&mut param);
140+
141+
let mut client = connect_to_localhost()?;
142+
143+
let result = client.post(&"api2/json/config/datastore", Some(param)).await?;
144+
145+
view_task_result(&mut client, result, &output_format).await?;
146+
147+
Ok(Value::Null)
148+
}
149+
70150
pub fn datastore_commands() -> CommandLineInterface {
71151

72152
let cmd_def = CliCommandMap::new()
@@ -77,7 +157,7 @@ pub fn datastore_commands() -> CommandLineInterface {
77157
.completion_cb("name", config::datastore::complete_datastore_name)
78158
)
79159
.insert("create",
80-
CliCommand::new(&api2::config::datastore::API_METHOD_CREATE_DATASTORE)
160+
CliCommand::new(&API_METHOD_CREATE_DATASTORE)
81161
.arg_param(&["name", "path"])
82162
)
83163
.insert("update",

src/bin/proxmox_file_restore/block_driver_qemu.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl VMStateMap {
5050
/// Acquire a lock on the state map and retrieve a deserialized version
5151
fn load() -> Result<Self, Error> {
5252
let mut file = Self::open_file_raw(true)?;
53-
lock_file(&mut file, true, Some(std::time::Duration::from_secs(5)))?;
53+
lock_file(&mut file, true, Some(std::time::Duration::from_secs(120)))?;
5454
let map = serde_json::from_reader(&file).unwrap_or_default();
5555
Ok(Self { map, file })
5656
}

0 commit comments

Comments
 (0)