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
25ac9b68
Commit
25ac9b68
authored
Dec 02, 2011
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implemente openvz migration
parent
784729f4
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
589 additions
and
30 deletions
+589
-30
OpenVZ.pm
PVE/API2/OpenVZ.pm
+11
-12
Makefile
PVE/Makefile
+1
-0
OpenVZ.pm
PVE/OpenVZ.pm
+19
-15
OpenVZMigrate.pm
PVE/OpenVZMigrate.pm
+548
-0
pvectl
bin/pvectl
+3
-2
changelog.Debian
debian/changelog.Debian
+6
-0
defines.mk
defines.mk
+1
-1
No files found.
PVE/API2/OpenVZ.pm
View file @
25ac9b68
...
...
@@ -16,6 +16,7 @@ use PVE::Storage;
use
PVE::
RESTHandler
;
use
PVE::
RPCEnvironment
;
use
PVE::
OpenVZ
;
use
PVE::
OpenVZMigrate
;
use
PVE::
JSONSchema
qw(get_standard_option)
;
use
base
qw(PVE::RESTHandler)
;
...
...
@@ -139,7 +140,7 @@ my $restore_openvz = sub {
if
(
-
f
$backup_cfg
)
{
print
"
restore configuration to '
$conffile
'
\n
";
$conf
=
PVE::Tools::
file_get_contents
(
$backup_cfg
);
my
$conf
=
PVE::Tools::
file_get_contents
(
$backup_cfg
);
$conf
=~
s/VE_ROOT=.*/VE_ROOT=\"$root\"/
;
$conf
=~
s/VE_PRIVATE=.*/VE_PRIVATE=\"$private\"/
;
...
...
@@ -251,7 +252,7 @@ __PACKAGE__->register_method({
my
$basecfg_fn
=
PVE::OpenVZ::
config_file
(
$vmid
);
if
(
$param
->
{
force
})
{
die
"
cant overwrite mounted container
\n
"
if
PVE::OpenVZ::
check_mounted
(
$vmid
);
die
"
cant overwrite mounted container
\n
"
if
PVE::OpenVZ::
check_mounted
(
$
conf
,
$
vmid
);
}
else
{
die
"
container
$vmid
already exists
\n
"
if
-
f
$basecfg_fn
;
}
...
...
@@ -314,6 +315,11 @@ __PACKAGE__->register_method({
# hack: vzctl '--userpasswd' starts the CT, but we want
# to avoid that for create
PVE::OpenVZ::
set_rootpasswd
(
$private
,
$password
)
if
defined
(
$password
);
# is this really needed?
my
$cmd
=
['
vzctl
',
'
--skiplock
',
'
--quiet
',
'
set
',
$vmid
,
'
--applyconfig_map
',
'
name
',
'
--save
'];
run_command
(
$cmd
);
};
return
$rpcenv
->
fork_worker
(
$param
->
{
restore
}
?
'
vzrestore
'
:
'
vzcreate
',
...
...
@@ -614,8 +620,8 @@ __PACKAGE__->register_method({
my
$stcfg
=
cfs_read_file
("
storage.cfg
");
if
(
$veconf
->
{
ve_private
}
&&
$
ve
conf
->
{
ve_private
}
->
{
value
})
{
my
$path
=
$veconf
->
{
ve_private
}
->
{
value
}
;
if
(
$veconf
->
{
ve_private
}
&&
$conf
->
{
ve_private
}
->
{
value
})
{
my
$path
=
PVE::OpenVZ::
get_privatedir
(
$veconf
,
$param
->
{
vmid
})
;
my
(
$vtype
,
$volid
)
=
PVE::Storage::
path_to_volume_id
(
$stcfg
,
$path
);
my
(
$sid
,
$volname
)
=
PVE::Storage::
parse_volume_id
(
$volid
,
1
)
if
$volid
;
$conf
->
{
storage
}
=
$sid
||
$path
;
...
...
@@ -1031,14 +1037,7 @@ __PACKAGE__->register_method({
my
$realcmd
=
sub
{
my
$upid
=
shift
;
my
$cmd
=
['
/usr/sbin/vzmigrate
'];
push
@$cmd
,
'
--online
'
if
$param
->
{
online
};
push
@$cmd
,
$targetip
;
push
@$cmd
,
$vmid
;
run_command
(
$cmd
);
PVE::OpenVZMigrate::
migrate
(
$target
,
$targetip
,
$vmid
,
$param
->
{
online
});
return
;
};
...
...
PVE/Makefile
View file @
25ac9b68
...
...
@@ -8,6 +8,7 @@ PERLSOURCE = \
APIDaemon.pm
\
REST.pm
\
OpenVZ.pm
\
OpenVZMigrate.pm
\
VZDump.pm
\
APLInfo.pm
...
...
PVE/OpenVZ.pm
View file @
25ac9b68
...
...
@@ -15,7 +15,7 @@ use PVE::JSONSchema;
use
Digest::
SHA1
;
use
Encode
;
use
constant
SCRIPT_EXT
=>
qw (start
stop
mount
umount
);
use
constant
SCRIPT_EXT
=>
qw (start
stop
mount
umount
premount
postumount
);
my
$cpuinfo
=
PVE::ProcFSTools::
read_cpuinfo
();
my
$nodename
=
PVE::INotify::
nodename
();
...
...
@@ -64,11 +64,9 @@ sub load_config {
}
sub
check_mounted
{
my
(
$vmid
)
=
@_
;
my
$root
=
$global_vzconf
->
{
rootdir
};
$root
=~
s/\$VEID/$vmid/
;
my
(
$conf
,
$vmid
)
=
@_
;
my
$root
=
get_rootdir
(
$conf
,
$vmid
);
return
(
-
d
"
$root
/etc
"
||
-
d
"
$root
/proc
");
}
...
...
@@ -102,6 +100,18 @@ sub get_privatedir {
return
$private
;
}
sub
get_rootdir
{
my
(
$conf
,
$vmid
)
=
@_
;
my
$root
=
$global_vzconf
->
{
rootdir
};
if
(
$conf
->
{
ve_root
}
&&
$conf
->
{
ve_root
}
->
{
value
})
{
$root
=
$conf
->
{
ve_root
}
->
{
value
};
}
$root
=~
s/\$VEID/$vmid/
;
return
$root
;
}
sub
read_user_beancounters
{
my
$ubc
=
{};
if
(
my
$fh
=
IO::
File
->
new
("
/proc/user_beancounters
",
"
r
"))
{
...
...
@@ -222,20 +232,14 @@ sub vmstatus {
}
else
{
$d
->
{
ip
}
=
'
-
';
}
$d
->
{
status
}
=
'
mounted
'
if
check_mounted
(
$conf
,
$vmid
);
}
else
{
delete
$list
->
{
$vmid
};
}
}
if
(
my
$fh
=
IO::
File
->
new
("
/proc/mounts
",
"
r
"))
{
while
(
defined
(
my
$line
=
<
$fh
>
))
{
if
(
$line
=~
m|/private/(\d+)\s+/var/lib/vz/root/\d+\s|
)
{
$list
->
{
$1
}
->
{
status
}
=
'
mounted
'
if
defined
(
$list
->
{
$1
});
}
}
close
(
$fh
);
}
my
$ubchash
=
read_user_beancounters
();
foreach
my
$vmid
(
keys
%
$ubchash
)
{
my
$d
=
$list
->
{
$vmid
};
...
...
@@ -731,7 +735,7 @@ my $ovz_ressources = {
dgramrcvbuf
=>
\&
parse_res_bytes_bytes
,
dcachesize
=>
\&
parse_res_bytes_bytes
,
diskquota
=>
\&
parse_boolean
,
disk
_
quota
=>
\&
parse_boolean
,
diskspace
=>
\&
parse_res_block_block
,
diskinodes
=>
\&
parse_res_num_num
,
quotatime
=>
\&
parse_integer
,
...
...
PVE/OpenVZMigrate.pm
0 → 100644
View file @
25ac9b68
This diff is collapsed.
Click to expand it.
bin/pvectl
View file @
25ac9b68
...
...
@@ -54,8 +54,8 @@ my $cmddef = {
}
}
],
create
=>
[
'
PVE::API2::OpenVZ
',
'
create_vm
',
['
vmid
',
'
ostemplate
'],
{
node
=>
$nodename
}
],
destroy
=>
[
'
PVE::API2::OpenVZ
',
'
destroy_vm
',
['
vmid
'],
{
node
=>
$nodename
}
],
create
=>
[
'
PVE::API2::OpenVZ
',
'
create_vm
',
['
vmid
',
'
ostemplate
'],
{
node
=>
$nodename
}
,
$upid_exit
],
destroy
=>
[
'
PVE::API2::OpenVZ
',
'
destroy_vm
',
['
vmid
'],
{
node
=>
$nodename
}
,
$upid_exit
],
set
=>
[
"
PVE::API2::OpenVZ
",
'
update_vm
',
['
vmid
'],
{
node
=>
$nodename
}
],
...
...
@@ -74,6 +74,7 @@ my $cmddef = {
start
=>
[
'
PVE::API2::OpenVZ
',
'
vm_start
',
['
vmid
'],
{
node
=>
$nodename
},
$upid_exit
],
stop
=>
[
'
PVE::API2::OpenVZ
',
'
vm_stop
',
['
vmid
'],
{
node
=>
$nodename
},
$upid_exit
],
migrate
=>
[
"
PVE::API2::OpenVZ
",
'
migrate_vm
',
['
target
',
'
vmid
'],
{
node
=>
$nodename
},
$upid_exit
],
};
...
...
debian/changelog.Debian
View file @
25ac9b68
pve-manager (2.0-13) unstable; urgency=low
* implemente openvz migration ('pvectl migrate')
-- Proxmox Support Team <support@proxmox.com> Fri, 02 Dec 2011 10:37:28 +0100
pve-manager (2.0-12) unstable; urgency=low
* minor bug fixes
...
...
defines.mk
View file @
25ac9b68
...
...
@@ -2,7 +2,7 @@ RELEASE=2.0
VERSION=2.0
PACKAGE=pve-manager
PACKAGERELEASE=1
2
PACKAGERELEASE=1
3
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