From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH zsync 06/10] add check_dataset_exists function
Date: Tue, 4 May 2021 10:10:00 +0200 [thread overview]
Message-ID: <20210504081004.21898-7-f.ebner@proxmox.com> (raw)
In-Reply-To: <20210504081004.21898-1-f.ebner@proxmox.com>
as a generalization and replacement of check_pool_exists.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
pve-zsync | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/pve-zsync b/pve-zsync
index 93b0d0d..a327d42 100755
--- a/pve-zsync
+++ b/pve-zsync
@@ -152,15 +152,15 @@ sub get_status {
return undef;
}
-sub check_pool_exists {
- my ($target, $user) = @_;
+sub check_dataset_exists {
+ my ($dataset, $ip, $user) = @_;
my $cmd = [];
- if ($target->{ip}) {
- push @$cmd, 'ssh', "$user\@$target->{ip}", '--';
+ if ($ip) {
+ push @$cmd, 'ssh', "$user\@$ip", '--';
}
- push @$cmd, 'zfs', 'list', '-H', '--', $target->{all};
+ push @$cmd, 'zfs', 'list', '-H', '--', $dataset;
eval {
run_cmd($cmd);
};
@@ -517,10 +517,12 @@ sub init {
run_cmd(['ssh-copy-id', '-i', '/root/.ssh/id_rsa.pub', "$param->{source_user}\@$ip"]);
}
- die "Pool $dest->{all} does not exists\n" if !check_pool_exists($dest, $param->{dest_user});
+ die "Pool $dest->{all} does not exist\n"
+ if !check_dataset_exists($dest->{all}, $dest->{ip}, $param->{dest_user});
if (!defined($source->{vmid})) {
- die "Pool $source->{all} does not exists\n" if !check_pool_exists($source, $param->{source_user});
+ die "Pool $source->{all} does not exist\n"
+ if !check_dataset_exists($source->{all}, $source->{ip}, $param->{source_user});
}
my $vm_type = vm_exists($source, $param->{source_user});
--
2.20.1
next prev parent reply other threads:[~2021-05-04 8:10 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-04 8:09 [pve-devel] [PATCH-SERIES zsync] fix #1669: allow prepending storage ID Fabian Ebner
2021-05-04 8:09 ` [pve-devel] [PATCH zsync 01/10] whitespace fix Fabian Ebner
2021-05-04 8:09 ` [pve-devel] [PATCH zsync 02/10] copyright: update year Fabian Ebner
2021-05-04 8:09 ` [pve-devel] [PATCH zsync 03/10] usage: describe flag parameters correctly Fabian Ebner
2021-05-04 8:09 ` [pve-devel] [PATCH zsync 04/10] usage: fix type for maxsnap Fabian Ebner
2021-05-04 8:09 ` [pve-devel] [PATCH zsync 05/10] add target_dataset function Fabian Ebner
2021-05-04 8:10 ` Fabian Ebner [this message]
2021-05-04 8:10 ` [pve-devel] [PATCH zsync 07/10] add create_file_system function Fabian Ebner
2021-05-04 8:10 ` [pve-devel] [PATCH zsync 08/10] parse disks: don't include colon in storage name variable Fabian Ebner
2021-05-04 8:10 ` [pve-devel] [PATCH zsync 09/10] parse disks: also include storage ID information Fabian Ebner
2021-05-04 8:10 ` [pve-devel] [PATCH zsync 10/10] fix #1669: add prepend-storage-id flag Fabian Ebner
2021-05-04 12:01 ` [pve-devel] applied-series: [PATCH-SERIES zsync] fix #1669: allow prepending storage ID 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=20210504081004.21898-7-f.ebner@proxmox.com \
--to=f.ebner@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox