mirror of
https://git.proxmox.com/git/pve-guest-common
synced 2025-08-02 19:13:04 +00:00
add VZDump base Plugin.pm
moved from pve-manager
This commit is contained in:
parent
e115c4af33
commit
a19d93a25d
130
PVE/VZDump/Plugin.pm
Normal file
130
PVE/VZDump/Plugin.pm
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
package PVE::VZDump::Plugin;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use PVE::VZDump;
|
||||||
|
|
||||||
|
sub set_logfd {
|
||||||
|
my ($self, $logfd) = @_;
|
||||||
|
|
||||||
|
$self->{logfd} = $logfd;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub cmd {
|
||||||
|
my ($self, $cmdstr, %param) = @_;
|
||||||
|
|
||||||
|
return PVE::VZDump::run_command($self->{logfd}, $cmdstr, %param);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub cmd_noerr {
|
||||||
|
my ($self, $cmdstr, %param) = @_;
|
||||||
|
|
||||||
|
my $res;
|
||||||
|
eval { $res = $self->cmd($cmdstr, %param); };
|
||||||
|
$self->logerr ($@) if $@;
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub loginfo {
|
||||||
|
my ($self, $msg) = @_;
|
||||||
|
|
||||||
|
PVE::VZDump::debugmsg('info', $msg, $self->{logfd}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub logerr {
|
||||||
|
my ($self, $msg) = @_;
|
||||||
|
|
||||||
|
PVE::VZDump::debugmsg('err', $msg, $self->{logfd}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub type {
|
||||||
|
return 'unknown';
|
||||||
|
};
|
||||||
|
|
||||||
|
sub vmlist {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
return [ keys %{$self->{vmlist}} ] if $self->{vmlist};
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
sub vm_status {
|
||||||
|
my ($self, $vmid) = @_;
|
||||||
|
|
||||||
|
die "internal error"; # implement in subclass
|
||||||
|
}
|
||||||
|
|
||||||
|
sub prepare {
|
||||||
|
my ($self, $task, $vmid, $mode) = @_;
|
||||||
|
|
||||||
|
die "internal error"; # implement in subclass
|
||||||
|
}
|
||||||
|
|
||||||
|
sub lock_vm {
|
||||||
|
my ($self, $vmid) = @_;
|
||||||
|
|
||||||
|
die "internal error"; # implement in subclass
|
||||||
|
}
|
||||||
|
|
||||||
|
sub unlock_vm {
|
||||||
|
my ($self, $vmid) = @_;
|
||||||
|
|
||||||
|
die "internal error"; # implement in subclass
|
||||||
|
}
|
||||||
|
|
||||||
|
sub stop_vm {
|
||||||
|
my ($self, $task, $vmid) = @_;
|
||||||
|
|
||||||
|
die "internal error"; # implement in subclass
|
||||||
|
}
|
||||||
|
|
||||||
|
sub start_vm {
|
||||||
|
my ($self, $task, $vmid) = @_;
|
||||||
|
|
||||||
|
die "internal error"; # implement in subclass
|
||||||
|
}
|
||||||
|
|
||||||
|
sub suspend_vm {
|
||||||
|
my ($self, $task, $vmid) = @_;
|
||||||
|
|
||||||
|
die "internal error"; # implement in subclass
|
||||||
|
}
|
||||||
|
|
||||||
|
sub resume_vm {
|
||||||
|
my ($self, $task, $vmid) = @_;
|
||||||
|
|
||||||
|
die "internal error"; # implement in subclass
|
||||||
|
}
|
||||||
|
|
||||||
|
sub snapshot {
|
||||||
|
my ($self, $task, $vmid) = @_;
|
||||||
|
|
||||||
|
die "internal error"; # implement in subclass
|
||||||
|
}
|
||||||
|
|
||||||
|
sub copy_data_phase2 {
|
||||||
|
my ($self, $task, $vmid) = @_;
|
||||||
|
|
||||||
|
die "internal error"; # implement in subclass
|
||||||
|
}
|
||||||
|
|
||||||
|
sub assemble {
|
||||||
|
my ($self, $task, $vmid) = @_;
|
||||||
|
|
||||||
|
die "internal error"; # implement in subclass
|
||||||
|
}
|
||||||
|
|
||||||
|
sub archive {
|
||||||
|
my ($self, $task, $vmid, $filename, $comp) = @_;
|
||||||
|
|
||||||
|
die "internal error"; # implement in subclass
|
||||||
|
}
|
||||||
|
|
||||||
|
sub cleanup {
|
||||||
|
my ($self, $task, $vmid) = @_;
|
||||||
|
|
||||||
|
die "internal error"; # implement in subclass
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
Loading…
Reference in New Issue
Block a user