storage: remove $running param from volume_snapshot
not needed anymore after change in qemu-server Signed-off-by: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
This commit is contained in:
committed by
Wolfgang Bumiller
parent
4ef8ab60f6
commit
e17a33794c
@ -22,10 +22,6 @@ Future changes should be documented in here.
|
||||
Feel free to request allowing more drivers or options on the pve-devel mailing list based on your
|
||||
needs.
|
||||
|
||||
* Add `running` parameter to `volume_snapshot()`
|
||||
The parameter *can* be used if some extra actions need to be done at the storage
|
||||
layer when the snapshot has already be done at qemu level when the vm is running.
|
||||
|
||||
* Introduce rename_snapshot() plugin method
|
||||
This method allow to rename a vm disk snapshot name to a different snapshot name.
|
||||
|
||||
|
||||
@ -449,13 +449,13 @@ sub volume_rollback_is_possible {
|
||||
}
|
||||
|
||||
sub volume_snapshot {
|
||||
my ($cfg, $volid, $snap, $running) = @_;
|
||||
my ($cfg, $volid, $snap) = @_;
|
||||
|
||||
my ($storeid, $volname) = parse_volume_id($volid, 1);
|
||||
if ($storeid) {
|
||||
my $scfg = storage_config($cfg, $storeid);
|
||||
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
|
||||
return $plugin->volume_snapshot($scfg, $storeid, $volname, $snap, $running);
|
||||
return $plugin->volume_snapshot($scfg, $storeid, $volname, $snap);
|
||||
} elsif ($volid =~ m|^(/.+)$| && -e $volid) {
|
||||
die "snapshot file/device '$volid' is not possible\n";
|
||||
} else {
|
||||
|
||||
@ -561,7 +561,7 @@ sub volume_size_info {
|
||||
}
|
||||
|
||||
sub volume_snapshot {
|
||||
my ($class, $scfg, $storeid, $volname, $snap, $running) = @_;
|
||||
my ($class, $scfg, $storeid, $volname, $snap) = @_;
|
||||
|
||||
die "creating snapshots is not supported for $class\n";
|
||||
}
|
||||
|
||||
@ -232,7 +232,7 @@ sub volume_resize {
|
||||
}
|
||||
|
||||
sub volume_snapshot {
|
||||
my ($class, $scfg, $storeid, $volname, $snap, $running) = @_;
|
||||
my ($class, $scfg, $storeid, $volname, $snap) = @_;
|
||||
die "volume snapshot is not possible on iscsi device\n";
|
||||
}
|
||||
|
||||
|
||||
@ -959,21 +959,12 @@ sub volume_size_info {
|
||||
}
|
||||
|
||||
sub volume_snapshot {
|
||||
my ($class, $scfg, $storeid, $volname, $snap, $running) = @_;
|
||||
my ($class, $scfg, $storeid, $volname, $snap) = @_;
|
||||
|
||||
my ($vmid, $format) = ($class->parse_volname($volname))[2, 6];
|
||||
|
||||
die "can't snapshot '$format' volume\n" if $format ne 'qcow2';
|
||||
|
||||
if ($running) {
|
||||
#rename with blockdev-reopen is done at qemu level when running
|
||||
eval { alloc_snap_image($class, $storeid, $scfg, $volname, $snap) };
|
||||
if ($@) {
|
||||
die "can't allocate new volume $volname: $@\n";
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$class->activate_volume($storeid, $scfg, $volname);
|
||||
|
||||
#rename current volume to snap volume
|
||||
|
||||
@ -353,7 +353,7 @@ sub create_base {
|
||||
# sub volume_resize {} reuse code from parent class
|
||||
|
||||
sub volume_snapshot {
|
||||
my ($class, $scfg, $storeid, $volname, $snap, $running) = @_;
|
||||
my ($class, $scfg, $storeid, $volname, $snap) = @_;
|
||||
|
||||
my $vg = $scfg->{vgname};
|
||||
my $snapvol = "snap_${volname}_$snap";
|
||||
|
||||
@ -966,7 +966,7 @@ sub volume_resize {
|
||||
}
|
||||
|
||||
sub volume_snapshot {
|
||||
my ($class, $scfg, $storeid, $volname, $snap, $running) = @_;
|
||||
my ($class, $scfg, $storeid, $volname, $snap) = @_;
|
||||
die "volume snapshot is not possible on pbs device";
|
||||
}
|
||||
|
||||
|
||||
@ -1272,7 +1272,7 @@ sub volume_resize {
|
||||
}
|
||||
|
||||
sub volume_snapshot {
|
||||
my ($class, $scfg, $storeid, $volname, $snap, $running) = @_;
|
||||
my ($class, $scfg, $storeid, $volname, $snap) = @_;
|
||||
|
||||
if ($scfg->{'external-snapshots'}) {
|
||||
|
||||
@ -1280,18 +1280,14 @@ sub volume_snapshot {
|
||||
|
||||
my $vmid = ($class->parse_volname($volname))[2];
|
||||
|
||||
if (!$running) {
|
||||
#rename volume unless qemu has already done it for us
|
||||
$class->rename_snapshot($scfg, $storeid, $volname, 'current', $snap);
|
||||
}
|
||||
|
||||
eval { alloc_backed_image($class, $storeid, $scfg, $volname, $snap) };
|
||||
if ($@) {
|
||||
warn "$@ \n";
|
||||
#if running, the revert is done by qemu with blockdev-reopen
|
||||
if (!$running) {
|
||||
eval { $class->rename_snapshot($scfg, $storeid, $volname, $snap, 'current'); };
|
||||
warn $@ if $@;
|
||||
}
|
||||
die "can't allocate new volume $volname with $snap backing image\n";
|
||||
}
|
||||
|
||||
|
||||
@ -868,7 +868,7 @@ sub volume_resize {
|
||||
}
|
||||
|
||||
sub volume_snapshot {
|
||||
my ($class, $scfg, $storeid, $volname, $snap, $running) = @_;
|
||||
my ($class, $scfg, $storeid, $volname, $snap) = @_;
|
||||
|
||||
my ($vtype, $name, $vmid) = $class->parse_volname($volname);
|
||||
|
||||
|
||||
@ -480,7 +480,7 @@ sub volume_size_info {
|
||||
}
|
||||
|
||||
sub volume_snapshot {
|
||||
my ($class, $scfg, $storeid, $volname, $snap, $running) = @_;
|
||||
my ($class, $scfg, $storeid, $volname, $snap) = @_;
|
||||
|
||||
my $vname = ($class->parse_volname($volname))[1];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user