$ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin';
-my $ocf_ressource_type = $0;
+my $ocf_ressource_type = 'pvevm';
+
my $prio_hash = {
err => 3,
note => 5,
$status->{type} = $data->{type};
$status->{node} = $data->{node};
+ if ($status->{type} eq 'qemu') {
+ $status->{name} = "VM $vmid";
+ } else {
+ $status->{name} = "CT $vmid";
+ }
+
check_running($status);
};
if (my $err = $@) {
if ($cmd eq 'start') {
my $status = validate_all();
if ($status->{running}) {
- ocf_log('info', "Resource is already running");
+ ocf_log('info', "$status->{name} is already running");
exit(OCF_SUCCESS);
}
if ($status->{node} ne $nodename) {
- ocf_log('info', "Move config to local node");
+ ocf_log('info', "Move config for $status->{name} to local node");
my ($oldconfig, $newconfig);
if ($status->{type} eq 'qemu') {
$oldconfig = PVE::QemuServer::config_file($status->{vmid}, $status->{node});
eval { PVE::Tools::run_with_timeout($timeout, $wait_func); };
if (my $err = $@) {
- ocf_log('err', "Start of VM $status->{vmid} has failed");
+ ocf_log('err', "Start of $status->{name} has failed");
ocf_log('err', "error while waiting for '$testprog' - $err");
exit(OCF_ERR_GENERIC);
}
my $status = validate_all();
if (!$status->{running}) {
- ocf_log('info', "Resource is already stopped");
+ ocf_log('info', "$status->{name} is already stopped");
exit(OCF_SUCCESS);
}
my $status = validate_all();
if (!$status->{running}) {
- ocf_log('debug', "Resource is not running");
+ ocf_log('debug', "$status->{name} is not running");
exit(OCF_NOT_RUNNING);
}
- ocf_log('debug', "Resource is running");
+ ocf_log('debug', "$status->{name} is running");
my $testprog = $ENV{OCF_RESKEY_status_program};
my $checklevel = $ENV{OCF_CHECK_LEVEL};
} elsif($cmd eq 'migrate') {
my $status = validate_all();
if (!$status->{running}) {
- ocf_log('err', "Resource is not running");
+ ocf_log('err', "$status->{name} is not running");
exit(OCF_ERR_GENERIC);
}
my $status = validate_all();
if (!$status->{running}) {
- ocf_log('info', "Resource is already stopped");
+ ocf_log('info', "$status->{name} is already stopped");
exit(OCF_SUCCESS);
}