all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pve-devel@lists.proxmox.com, pbs-devel@lists.proxmox.com
Subject: [pve-devel] [RFC proxmox-backup 1/1] api2/node/disks/zfs: instantiate import service
Date: Wed, 16 Sep 2020 14:14:18 +0200	[thread overview]
Message-ID: <20200916121419.3997-3-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20200916121419.3997-1-s.ivanov@proxmox.com>

When creating a new zpool for a datastore, also instantiate an
import-unit for it. This helps in cases where '/etc/zfs/zool.cache'
get corrupted and thus the pool is not imported upon boot.

This patch needs the corresponding addition of 'zfs-import@.service' in
the zfsonlinux repository.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
 src/api2/node/disks/zfs.rs | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/api2/node/disks/zfs.rs b/src/api2/node/disks/zfs.rs
index c5d6f6a6..0f0e4220 100644
--- a/src/api2/node/disks/zfs.rs
+++ b/src/api2/node/disks/zfs.rs
@@ -25,6 +25,8 @@ use crate::server::WorkerTask;
 
 use crate::api2::types::*;
 
+use crate::tools::systemd;
+
 pub const DISK_ARRAY_SCHEMA: Schema = ArraySchema::new(
     "Disk name list.", &BLOCKDEVICE_NAME_SCHEMA)
     .schema();
@@ -355,6 +357,9 @@ pub fn create_zpool(
             let output = crate::tools::run_command(command, None)?;
             worker.log(output);
 
+            let import_unit = format!("zfs-import@{}.service", systemd::escape_unit(&name, false));
+            systemd::enable_unit(&import_unit)?;
+
             if let Some(compression) = compression {
                 let mut command = std::process::Command::new("zfs");
                 command.args(&["set", &format!("compression={}", compression), &name]);
-- 
2.20.1





WARNING: multiple messages have this Message-ID
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pve-devel@lists.proxmox.com, pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [RFC proxmox-backup 1/1] api2/node/disks/zfs: instantiate import service
Date: Wed, 16 Sep 2020 14:14:18 +0200	[thread overview]
Message-ID: <20200916121419.3997-3-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20200916121419.3997-1-s.ivanov@proxmox.com>

When creating a new zpool for a datastore, also instantiate an
import-unit for it. This helps in cases where '/etc/zfs/zool.cache'
get corrupted and thus the pool is not imported upon boot.

This patch needs the corresponding addition of 'zfs-import@.service' in
the zfsonlinux repository.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
 src/api2/node/disks/zfs.rs | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/api2/node/disks/zfs.rs b/src/api2/node/disks/zfs.rs
index c5d6f6a6..0f0e4220 100644
--- a/src/api2/node/disks/zfs.rs
+++ b/src/api2/node/disks/zfs.rs
@@ -25,6 +25,8 @@ use crate::server::WorkerTask;
 
 use crate::api2::types::*;
 
+use crate::tools::systemd;
+
 pub const DISK_ARRAY_SCHEMA: Schema = ArraySchema::new(
     "Disk name list.", &BLOCKDEVICE_NAME_SCHEMA)
     .schema();
@@ -355,6 +357,9 @@ pub fn create_zpool(
             let output = crate::tools::run_command(command, None)?;
             worker.log(output);
 
+            let import_unit = format!("zfs-import@{}.service", systemd::escape_unit(&name, false));
+            systemd::enable_unit(&import_unit)?;
+
             if let Some(compression) = compression {
                 let mut command = std::process::Command::new("zfs");
                 command.args(&["set", &format!("compression={}", compression), &name]);
-- 
2.20.1





  parent reply	other threads:[~2020-09-16 12:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-16 12:14 [pve-devel] [RFC proxmox-backup/storage/zfsonlinux] improve zpool import for freshly created zpools Stoiko Ivanov
2020-09-16 12:14 ` [pbs-devel] " Stoiko Ivanov
2020-09-16 12:14 ` [pve-devel] [RFC zfsonlinux 1/1] Add systemd-unit for importing specific pools Stoiko Ivanov
2020-09-16 12:14   ` [pbs-devel] " Stoiko Ivanov
2020-09-29  3:54   ` [pve-devel] " Thomas Lamprecht
2020-09-29  3:54     ` [pbs-devel] " Thomas Lamprecht
2020-09-29 13:03   ` [pve-devel] applied: " Thomas Lamprecht
2020-09-29 13:03     ` [pbs-devel] applied: [pve-devel] " Thomas Lamprecht
2020-09-16 12:14 ` Stoiko Ivanov [this message]
2020-09-16 12:14   ` [pbs-devel] [RFC proxmox-backup 1/1] api2/node/disks/zfs: instantiate import service Stoiko Ivanov
2020-09-30  7:35   ` [pve-devel] applied: " Thomas Lamprecht
2020-09-30  7:35     ` [pbs-devel] applied: " Thomas Lamprecht
2020-09-16 12:14 ` [pve-devel] [RFC storage 1/1] Disks: instantiate import unit for created zpool Stoiko Ivanov
2020-09-16 12:14   ` [pbs-devel] " Stoiko Ivanov
2020-09-29 16:58   ` [pve-devel] applied: " Thomas Lamprecht
2020-09-29 16:58     ` [pbs-devel] applied: [pve-devel] " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200916121419.3997-3-s.ivanov@proxmox.com \
    --to=s.ivanov@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal