Commit 14beca2c authored by Dietmar Maurer's avatar Dietmar Maurer

use new PVE::Cluster::vm_is_ha_managed()

parent 2ba2236b
...@@ -1051,16 +1051,6 @@ __PACKAGE__->register_method({ ...@@ -1051,16 +1051,6 @@ __PACKAGE__->register_method({
return $res; return $res;
}}); }});
my $vm_is_ha_managed = sub {
my ($vmid) = @_;
my $cc = PVE::Cluster::cfs_read_file('cluster.conf');
if (PVE::Cluster::cluster_conf_lookup_pvevm($cc, 0, $vmid, 1)) {
return 1;
}
return 0;
};
__PACKAGE__->register_method({ __PACKAGE__->register_method({
name => 'vm_status', name => 'vm_status',
path => '{vmid}/status/current', path => '{vmid}/status/current',
...@@ -1088,7 +1078,7 @@ __PACKAGE__->register_method({ ...@@ -1088,7 +1078,7 @@ __PACKAGE__->register_method({
my $vmstatus = PVE::OpenVZ::vmstatus($param->{vmid}); my $vmstatus = PVE::OpenVZ::vmstatus($param->{vmid});
my $status = $vmstatus->{$param->{vmid}}; my $status = $vmstatus->{$param->{vmid}};
$status->{ha} = &$vm_is_ha_managed($param->{vmid}); $status->{ha} = PVE::Cluster::vm_is_ha_managed($param->{vmid});
return $status; return $status;
}}); }});
...@@ -1170,7 +1160,7 @@ __PACKAGE__->register_method({ ...@@ -1170,7 +1160,7 @@ __PACKAGE__->register_method({
die "CT $vmid already running\n" if PVE::OpenVZ::check_running($vmid); die "CT $vmid already running\n" if PVE::OpenVZ::check_running($vmid);
if (&$vm_is_ha_managed($vmid) && $rpcenv->{type} ne 'ha') { if (PVE::Cluster::vm_is_ha_managed($vmid) && $rpcenv->{type} ne 'ha') {
my $hacmd = sub { my $hacmd = sub {
my $upid = shift; my $upid = shift;
...@@ -1251,7 +1241,7 @@ __PACKAGE__->register_method({ ...@@ -1251,7 +1241,7 @@ __PACKAGE__->register_method({
die "CT $vmid not running\n" if !PVE::OpenVZ::check_running($vmid); die "CT $vmid not running\n" if !PVE::OpenVZ::check_running($vmid);
if (&$vm_is_ha_managed($vmid) && $rpcenv->{type} ne 'ha') { if (PVE::Cluster::vm_is_ha_managed($vmid) && $rpcenv->{type} ne 'ha') {
my $hacmd = sub { my $hacmd = sub {
my $upid = shift; my $upid = shift;
...@@ -1610,7 +1600,7 @@ __PACKAGE__->register_method({ ...@@ -1610,7 +1600,7 @@ __PACKAGE__->register_method({
if !$param->{online}; if !$param->{online};
} }
if (&$vm_is_ha_managed($vmid) && $rpcenv->{type} ne 'ha') { if (PVE::Cluster::vm_is_ha_managed($vmid) && $rpcenv->{type} ne 'ha') {
my $hacmd = sub { my $hacmd = sub {
my $upid = shift; my $upid = shift;
......
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