]>
git.proxmox.com Git - pve-manager.git/blob - bin/vzrestore
ba85f2bc948827674ae2a735fd3e95e72391fff6
5 use PVE
::Tools
qw(extract_param);
7 use PVE
::RPCEnvironment
;
9 use PVE
::JSONSchema
qw(get_standard_option);
10 use PVE
::API2
::OpenVZ
;
12 use Data
::Dumper
; # fixme: remove
14 use base
qw(PVE::CLIHandler);
16 $ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin';
20 die "please run as root\n" if $> != 0;
22 PVE
::INotify
::inotify_init
();
24 my $rpcenv = PVE
::RPCEnvironment-
>init('cli');
26 $rpcenv->init_request();
27 $rpcenv->set_language($ENV{LANG
});
28 $rpcenv->set_user('root@pam');
30 __PACKAGE__-
>register_method({
34 description
=> "Restore OpenVZ containers.",
36 additionalProperties
=> 0,
38 vmid
=> get_standard_option
('pve-vmid'),
40 description
=> "The backup file. You can pass '-' to read from standard input.",
44 storage
=> get_standard_option
('pve-storage-id', {
45 description
=> "Target storage.",
52 description
=> "Allow to overwrite existing container.",
62 $param->{ostemplate
} = extract_param
($param, 'archive');
64 $param->{node
} = PVE
::INotify
::nodename
();
66 $param->{restore
} = 1;
68 return PVE
::API2
::OpenVZ-
>create_vm($param);
71 my $cmddef = [ __PACKAGE__
, 'vzrestore', ['archive', 'vmid'], undef,
74 my $status = PVE
::Tools
::upid_read_status
($upid);
75 exit($status eq 'OK' ?
0 : -1);
78 push @ARGV, 'help' if !scalar(@ARGV);
80 PVE
::CLIHandler
::handle_simple_cmd
($cmddef, \
@ARGV, undef, $0);
88 vzrestore - restore OpenVZ vzdump backups
96 Restores OpenVZ vzdump backups.
100 vzdump(1) qmrestore(1)
102 =include pve_copyright