Commit 0289e725 authored by Dietmar Maurer's avatar Dietmar Maurer

use -mode instead of -snapshot, -suspend and -stop

parent 7d0b305b
...@@ -427,7 +427,7 @@ sub new { ...@@ -427,7 +427,7 @@ sub new {
check_bin ('cstream'); check_bin ('cstream');
check_bin ('ionice'); check_bin ('ionice');
if ($opts->{snapshot}) { if ($opts->{mode} && $opts->{mode} eq 'snapshot') {
check_bin ('lvcreate'); check_bin ('lvcreate');
check_bin ('lvs'); check_bin ('lvs');
check_bin ('lvremove'); check_bin ('lvremove');
...@@ -444,10 +444,6 @@ sub new { ...@@ -444,10 +444,6 @@ sub new {
} }
} }
$opts->{mode} = 'stop' if $opts->{stop};
$opts->{mode} = 'suspend' if $opts->{suspend};
$opts->{mode} = 'snapshot' if $opts->{snapshot};
$opts->{dumpdir} =~ s|/+$|| if ($opts->{dumpdir}); $opts->{dumpdir} =~ s|/+$|| if ($opts->{dumpdir});
$opts->{tmpdir} =~ s|/+$|| if ($opts->{tmpdir}); $opts->{tmpdir} =~ s|/+$|| if ($opts->{tmpdir});
...@@ -1048,20 +1044,12 @@ my $confdesc = { ...@@ -1048,20 +1044,12 @@ my $confdesc = {
optional => 1, optional => 1,
default => 0, default => 0,
}, },
stop => { mode => {
type => 'boolean', type => 'string',
description => "Stop/Restart VM when running.", description => "Backup mode.",
optional => 1,
},
snapshot => {
type => 'boolean',
description => "Try to use (LVM) snapshots when running.",
optional => 1,
},
suspend => {
type => 'boolean',
description => "Suspend/resume VM when running",
optional => 1, optional => 1,
default => 'stop',
enum => [ 'snapshot', 'suspend', 'stop' ],
}, },
exclude => { exclude => {
type => 'string', format => 'pve-vmid-list', type => 'string', format => 'pve-vmid-list',
...@@ -1136,6 +1124,11 @@ my $confdesc = { ...@@ -1136,6 +1124,11 @@ my $confdesc = {
}, },
}; };
sub option_exists {
my $key = shift;
return defined($confdesc->{$key});
}
# add JSON properties for create and set function # add JSON properties for create and set function
sub json_config_properties { sub json_config_properties {
my $prop = shift; my $prop = shift;
......
...@@ -56,7 +56,7 @@ machines (VMs). It basically creates a tar archive of the VM private area, ...@@ -56,7 +56,7 @@ machines (VMs). It basically creates a tar archive of the VM private area,
which also includes the VM configuration files. vzdump currently which also includes the VM configuration files. vzdump currently
supports OpenVZ and QemuServer VMs. supports OpenVZ and QemuServer VMs.
There are several ways to provide consistency: There are several ways to provide consistency (option C<mode>):
=over 2 =over 2
...@@ -157,15 +157,15 @@ Simply dump VM 777 - no snapshot, just archive the VM private area and configura ...@@ -157,15 +157,15 @@ Simply dump VM 777 - no snapshot, just archive the VM private area and configura
Use rsync and suspend/resume to create an snapshot (minimal downtime). Use rsync and suspend/resume to create an snapshot (minimal downtime).
# vzdump 777 --suspend # vzdump 777 --mode suspend
Backup all VMs and send notification mails to root and admin. Backup all VMs and send notification mails to root and admin.
# vzdump --all --suspend --mailto root --mailto admin # vzdump --all --mode suspend --mailto root --mailto admin
Use LVM2 to create snapshots (no downtime). Use LVM2 to create snapshots (no downtime).
# vzdump 777 --dumpdir /mnt/backup --snapshot # vzdump 777 --dumpdir /mnt/backup --mode snapshot
Backup more than one VM (selectively) Backup more than one VM (selectively)
...@@ -173,7 +173,7 @@ Backup more than one VM (selectively) ...@@ -173,7 +173,7 @@ Backup more than one VM (selectively)
Backup all VMs excluding VM 101 and 102 Backup all VMs excluding VM 101 and 102
# vzdump --suspend --exclude 101,102 # vzdump --mode suspend --exclude 101,102
Restore an OpenVZ machine to VM 600 Restore an OpenVZ machine to VM 600
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment