Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pve-manager
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
pve-manager
Commits
5c1b7462
Commit
5c1b7462
authored
Mar 27, 2012
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug #97: execute 'clusvcadm' commands for HA managed CTs
parent
6800ed38
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
102 additions
and
32 deletions
+102
-32
OpenVZ.pm
PVE/API2/OpenVZ.pm
+95
-31
changelog.Debian
debian/changelog.Debian
+6
-0
defines.mk
defines.mk
+1
-1
No files found.
PVE/API2/OpenVZ.pm
View file @
5c1b7462
...
...
@@ -923,6 +923,16 @@ __PACKAGE__->register_method({
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
({
name
=>
'
vm_status
',
path
=>
'
{vmid}/status/current
',
...
...
@@ -950,12 +960,7 @@ __PACKAGE__->register_method({
my
$vmstatus
=
PVE::OpenVZ::
vmstatus
(
$param
->
{
vmid
});
my
$status
=
$vmstatus
->
{
$param
->
{
vmid
}};
my
$cc
=
PVE::Cluster::
cfs_read_file
('
cluster.conf
');
if
(
PVE::Cluster::
cluster_conf_lookup_pvevm
(
$cc
,
0
,
$param
->
{
vmid
},
1
))
{
$status
->
{
ha
}
=
1
;
}
else
{
$status
->
{
ha
}
=
0
;
}
$status
->
{
ha
}
=
&
$vm_is_ha_managed
(
$param
->
{
vmid
});
return
$status
;
}});
...
...
@@ -1037,19 +1042,40 @@ __PACKAGE__->register_method({
die
"
CT
$vmid
already running
\n
"
if
PVE::OpenVZ::
check_running
(
$vmid
);
my
$realcmd
=
sub
{
my
$upid
=
shift
;
if
(
&
$vm_is_ha_managed
(
$vmid
)
&&
$rpcenv
->
{
type
}
ne
'
ha
')
{
my
$hacmd
=
sub
{
my
$upid
=
shift
;
my
$service
=
"
pvevm:
$vmid
";
my
$cmd
=
['
clusvcadm
',
'
-e
',
$service
,
'
-m
',
$node
];
print
"
Executing HA start for CT
$vmid
\n
";
PVE::Tools::
run_command
(
$cmd
);
return
;
};
return
$rpcenv
->
fork_worker
('
hastart
',
$vmid
,
$authuser
,
$hacmd
);
}
else
{
my
$realcmd
=
sub
{
my
$upid
=
shift
;
syslog
('
info
',
"
starting CT
$vmid
:
$upid
\n
");
syslog
('
info
',
"
starting CT
$vmid
:
$upid
\n
");
my
$cmd
=
['
vzctl
',
'
start
',
$vmid
];
my
$cmd
=
['
vzctl
',
'
start
',
$vmid
];
run_command
(
$cmd
);
run_command
(
$cmd
);
return
;
};
return
;
};
return
$rpcenv
->
fork_worker
('
vzstart
',
$vmid
,
$authuser
,
$realcmd
);
return
$rpcenv
->
fork_worker
('
vzstart
',
$vmid
,
$authuser
,
$realcmd
);
}
}});
__PACKAGE__
->
register_method
({
...
...
@@ -1085,20 +1111,39 @@ __PACKAGE__->register_method({
die
"
CT
$vmid
not running
\n
"
if
!
PVE::OpenVZ::
check_running
(
$vmid
);
my
$realcmd
=
sub
{
my
$upid
=
shift
;
if
(
&
$vm_is_ha_managed
(
$vmid
)
&&
$rpcenv
->
{
type
}
ne
'
ha
')
{
syslog
('
info
',
"
stoping CT
$vmid
:
$upid
\n
");
my
$hacmd
=
sub
{
my
$upid
=
shift
;
my
$cmd
=
['
vzctl
',
'
stop
',
$vmid
,
'
--fast
'];
run_command
(
$cmd
);
return
;
};
my
$service
=
"
pvevm:
$vmid
";
my
$upid
=
$rpcenv
->
fork_worker
('
vzstop
',
$vmid
,
$authuser
,
$realcmd
)
;
my
$cmd
=
['
clusvcadm
',
'
-d
',
$service
]
;
return
$upid
;
print
"
Executing HA stop for CT
$vmid
\n
";
PVE::Tools::
run_command
(
$cmd
);
return
;
};
return
$rpcenv
->
fork_worker
('
hastop
',
$vmid
,
$authuser
,
$hacmd
);
}
else
{
my
$realcmd
=
sub
{
my
$upid
=
shift
;
syslog
('
info
',
"
stoping CT
$vmid
:
$upid
\n
");
my
$cmd
=
['
vzctl
',
'
stop
',
$vmid
,
'
--fast
'];
run_command
(
$cmd
);
return
;
};
return
$rpcenv
->
fork_worker
('
vzstop
',
$vmid
,
$authuser
,
$realcmd
);
}
}});
__PACKAGE__
->
register_method
({
...
...
@@ -1329,17 +1374,36 @@ __PACKAGE__->register_method({
if
!
$param
->
{
online
};
}
my
$realcmd
=
sub
{
my
$upid
=
shift
;
if
(
&
$vm_is_ha_managed
(
$vmid
)
&&
$rpcenv
->
{
type
}
ne
'
ha
')
{
PVE::
OpenVZMigrate
->
migrate
(
$target
,
$targetip
,
$vmid
,
$param
);
my
$hacmd
=
sub
{
my
$upid
=
shift
;
return
;
};
my
$service
=
"
pvevm:
$vmid
";
my
$upid
=
$rpcenv
->
fork_worker
('
vzmigrate
',
$vmid
,
$authuser
,
$realcmd
)
;
my
$cmd
=
['
clusvcadm
',
'
-M
',
$service
,
'
-m
',
$target
]
;
return
$upid
;
print
"
Executing HA migrate for CT
$vmid
to node
$target
\n
";
PVE::Tools::
run_command
(
$cmd
);
return
;
};
return
$rpcenv
->
fork_worker
('
hamigrate
',
$vmid
,
$authuser
,
$hacmd
);
}
else
{
my
$realcmd
=
sub
{
my
$upid
=
shift
;
PVE::
OpenVZMigrate
->
migrate
(
$target
,
$targetip
,
$vmid
,
$param
);
return
;
};
return
$rpcenv
->
fork_worker
('
vzmigrate
',
$vmid
,
$authuser
,
$realcmd
);
}
}});
1
;
debian/changelog.Debian
View file @
5c1b7462
pve-manager (2.0-48) unstable; urgency=low
* fix bug #97: execute 'clusvcadm' commands for HA managed CTs
-- Proxmox Support Team <support@proxmox.com> Tue, 27 Mar 2012 10:59:33 +0200
pve-manager (2.0-47) unstable; urgency=low
* fix bug 114: do not display 'nothing selected' after logout
...
...
defines.mk
View file @
5c1b7462
...
...
@@ -2,7 +2,7 @@ RELEASE=2.0
VERSION=2.0
PACKAGE=pve-manager
PACKAGERELEASE=4
7
PACKAGERELEASE=4
8
BINDIR=${DESTDIR}/usr/bin
PERLLIBDIR=${DESTDIR}/usr/share/perl5
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment