From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 4EF5074EAB for ; Fri, 4 Jun 2021 09:40:43 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 44E6C1A038 for ; Fri, 4 Jun 2021 09:40:43 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 7FC481A028 for ; Fri, 4 Jun 2021 09:40:39 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 5101C466FC for ; Fri, 4 Jun 2021 09:40:39 +0200 (CEST) To: Proxmox Backup Server development discussion , Dominik Csapak References: <20210602112704.893-1-d.csapak@proxmox.com> <20210602112704.893-4-d.csapak@proxmox.com> From: Dietmar Maurer Message-ID: Date: Fri, 4 Jun 2021 09:40:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <20210602112704.893-4-d.csapak@proxmox.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-SPAM-LEVEL: Spam detection results: 0 AWL 0.201 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [directory.rs, datastore.rs, zfs.rs] Subject: [pbs-devel] applied: [PATCH proxmox-backup v2 3/4] backup/chunk_store: optionally log progress on creation X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2021 07:40:43 -0000 applied On 6/2/21 1:27 PM, Dominik Csapak wrote: > and enable it for the worker variants > > Signed-off-by: Dominik Csapak > --- > src/api2/config/datastore.rs | 5 +++-- > src/api2/node/disks/directory.rs | 2 +- > src/api2/node/disks/zfs.rs | 2 +- > src/backup/chunk_store.rs | 11 +++++++---- > 4 files changed, 12 insertions(+), 8 deletions(-) > > diff --git a/src/api2/config/datastore.rs b/src/api2/config/datastore.rs > index 4fa76b40..4e079cd5 100644 > --- a/src/api2/config/datastore.rs > +++ b/src/api2/config/datastore.rs > @@ -55,11 +55,12 @@ pub(crate) fn create_datastore_impl( > _lock: std::fs::File, > mut config: SectionConfigData, > datastore: DataStoreConfig, > + worker: Option<&dyn crate::task::TaskState>, > ) -> Result<(), Error> { > let path: PathBuf = datastore.path.clone().into(); > > let backup_user = crate::backup::backup_user()?; > - let _store = ChunkStore::create(&datastore.name, path, backup_user.uid, backup_user.gid)?; > + let _store = ChunkStore::create(&datastore.name, path, backup_user.uid, backup_user.gid, worker)?; > > config.set_data(&datastore.name, "datastore", &datastore)?; > > @@ -158,7 +159,7 @@ pub fn create_datastore( > Some(datastore.name.to_string()), > auth_id, > false, > - move |_worker| create_datastore_impl(lock, config, datastore), > + move |worker| create_datastore_impl(lock, config, datastore, Some(&worker)), > ) > } > > diff --git a/src/api2/node/disks/directory.rs b/src/api2/node/disks/directory.rs > index 006e9522..4eadf867 100644 > --- a/src/api2/node/disks/directory.rs > +++ b/src/api2/node/disks/directory.rs > @@ -190,7 +190,7 @@ pub fn create_datastore_disk( > bail!("datastore '{}' already exists.", datastore.name); > } > > - crate::api2::config::datastore::create_datastore_impl(lock, config, datastore)?; > + crate::api2::config::datastore::create_datastore_impl(lock, config, datastore, Some(&worker))?; > } > > Ok(()) > diff --git a/src/api2/node/disks/zfs.rs b/src/api2/node/disks/zfs.rs > index ee8037e2..ebdc3688 100644 > --- a/src/api2/node/disks/zfs.rs > +++ b/src/api2/node/disks/zfs.rs > @@ -384,7 +384,7 @@ pub fn create_zpool( > bail!("datastore '{}' already exists.", datastore.name); > } > > - crate::api2::config::datastore::create_datastore_impl(lock, config, datastore)?; > + crate::api2::config::datastore::create_datastore_impl(lock, config, datastore, Some(&worker))?; > } > > Ok(()) > diff --git a/src/backup/chunk_store.rs b/src/backup/chunk_store.rs > index 31e8307c..e9cc3897 100644 > --- a/src/backup/chunk_store.rs > +++ b/src/backup/chunk_store.rs > @@ -7,6 +7,7 @@ use std::os::unix::io::AsRawFd; > > use proxmox::tools::fs::{CreateOptions, create_path, create_dir}; > > +use crate::task_log; > use crate::tools; > use crate::api2::types::GarbageCollectionStatus; > > @@ -61,7 +62,7 @@ impl ChunkStore { > chunk_dir > } > > - pub fn create

(name: &str, path: P, uid: nix::unistd::Uid, gid: nix::unistd::Gid) -> Result > + pub fn create

(name: &str, path: P, uid: nix::unistd::Uid, gid: nix::unistd::Gid, worker: Option<&dyn TaskState>) -> Result > where > P: Into, > { > @@ -104,7 +105,9 @@ impl ChunkStore { > } > let percentage = (i*100)/(64*1024); > if percentage != last_percentage { > - // eprintln!("ChunkStore::create {}%", percentage); > + if let Some(worker) = worker { > + task_log!(worker, "Chunkstore create: {}%", percentage) > + } > last_percentage = percentage; > } > } > @@ -461,7 +464,7 @@ fn test_chunk_store1() { > assert!(chunk_store.is_err()); > > let user = nix::unistd::User::from_uid(nix::unistd::Uid::current()).unwrap().unwrap(); > - let chunk_store = ChunkStore::create("test", &path, user.uid, user.gid).unwrap(); > + let chunk_store = ChunkStore::create("test", &path, user.uid, user.gid, None).unwrap(); > > let (chunk, digest) = super::DataChunkBuilder::new(&[0u8, 1u8]).build().unwrap(); > > @@ -472,7 +475,7 @@ fn test_chunk_store1() { > assert!(exists); > > > - let chunk_store = ChunkStore::create("test", &path, user.uid, user.gid); > + let chunk_store = ChunkStore::create("test", &path, user.uid, user.gid, None); > assert!(chunk_store.is_err()); > > if let Err(_e) = std::fs::remove_dir_all(".testdir") { /* ignore */ }