add mount/unmount command for openvz
This commit is contained in:
parent
4b808f6902
commit
8710f2803a
@ -1099,6 +1099,102 @@ __PACKAGE__->register_method({
|
||||
return $upid;
|
||||
}});
|
||||
|
||||
__PACKAGE__->register_method({
|
||||
name => 'vm_mount',
|
||||
path => '{vmid}/status/mount',
|
||||
method => 'POST',
|
||||
protected => 1,
|
||||
proxyto => 'node',
|
||||
description => "Mounts container private area.",
|
||||
permissions => {
|
||||
check => ['perm', '/vms/{vmid}', [ 'VM.PowerMgmt' ]],
|
||||
},
|
||||
parameters => {
|
||||
additionalProperties => 0,
|
||||
properties => {
|
||||
node => get_standard_option('pve-node'),
|
||||
vmid => get_standard_option('pve-vmid'),
|
||||
},
|
||||
},
|
||||
returns => {
|
||||
type => 'string',
|
||||
},
|
||||
code => sub {
|
||||
my ($param) = @_;
|
||||
|
||||
my $rpcenv = PVE::RPCEnvironment::get();
|
||||
|
||||
my $authuser = $rpcenv->get_user();
|
||||
|
||||
my $node = extract_param($param, 'node');
|
||||
|
||||
my $vmid = extract_param($param, 'vmid');
|
||||
|
||||
die "CT $vmid is running\n" if PVE::OpenVZ::check_running($vmid);
|
||||
|
||||
my $realcmd = sub {
|
||||
my $upid = shift;
|
||||
|
||||
syslog('info', "mount CT $vmid: $upid\n");
|
||||
|
||||
my $cmd = ['vzctl', 'mount', $vmid];
|
||||
|
||||
run_command($cmd);
|
||||
|
||||
return;
|
||||
};
|
||||
|
||||
return $rpcenv->fork_worker('vzmount', $vmid, $authuser, $realcmd);
|
||||
}});
|
||||
|
||||
__PACKAGE__->register_method({
|
||||
name => 'vm_umount',
|
||||
path => '{vmid}/status/umount',
|
||||
method => 'POST',
|
||||
protected => 1,
|
||||
proxyto => 'node',
|
||||
description => "Unmounts container private area.",
|
||||
permissions => {
|
||||
check => ['perm', '/vms/{vmid}', [ 'VM.PowerMgmt' ]],
|
||||
},
|
||||
parameters => {
|
||||
additionalProperties => 0,
|
||||
properties => {
|
||||
node => get_standard_option('pve-node'),
|
||||
vmid => get_standard_option('pve-vmid'),
|
||||
},
|
||||
},
|
||||
returns => {
|
||||
type => 'string',
|
||||
},
|
||||
code => sub {
|
||||
my ($param) = @_;
|
||||
|
||||
my $rpcenv = PVE::RPCEnvironment::get();
|
||||
|
||||
my $authuser = $rpcenv->get_user();
|
||||
|
||||
my $node = extract_param($param, 'node');
|
||||
|
||||
my $vmid = extract_param($param, 'vmid');
|
||||
|
||||
die "CT $vmid is running\n" if PVE::OpenVZ::check_running($vmid);
|
||||
|
||||
my $realcmd = sub {
|
||||
my $upid = shift;
|
||||
|
||||
syslog('info', "umount CT $vmid: $upid\n");
|
||||
|
||||
my $cmd = ['vzctl', 'umount', $vmid];
|
||||
|
||||
run_command($cmd);
|
||||
|
||||
return;
|
||||
};
|
||||
|
||||
return $rpcenv->fork_worker('vzumount', $vmid, $authuser, $realcmd);
|
||||
}});
|
||||
|
||||
__PACKAGE__->register_method({
|
||||
name => 'vm_shutdown',
|
||||
path => '{vmid}/status/shutdown',
|
||||
|
@ -75,6 +75,8 @@ my $cmddef = {
|
||||
start => [ 'PVE::API2::OpenVZ', 'vm_start', ['vmid'], { node => $nodename }, $upid_exit],
|
||||
shutdown => [ 'PVE::API2::OpenVZ', 'vm_shutdown', ['vmid'], { node => $nodename }, $upid_exit],
|
||||
stop => [ 'PVE::API2::OpenVZ', 'vm_stop', ['vmid'], { node => $nodename }, $upid_exit],
|
||||
mount => [ 'PVE::API2::OpenVZ', 'vm_mount', ['vmid'], { node => $nodename }, $upid_exit],
|
||||
umount => [ 'PVE::API2::OpenVZ', 'vm_umount', ['vmid'], { node => $nodename }, $upid_exit],
|
||||
migrate => [ "PVE::API2::OpenVZ", 'migrate_vm', ['vmid', 'target'], { node => $nodename }, $upid_exit],
|
||||
|
||||
};
|
||||
|
6
debian/changelog.Debian
vendored
6
debian/changelog.Debian
vendored
@ -1,3 +1,9 @@
|
||||
pve-manager (2.0-30) unstable; urgency=low
|
||||
|
||||
* add unmount button to openvz GUI
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 20 Feb 2012 10:11:13 +0100
|
||||
|
||||
pve-manager (2.0-29) unstable; urgency=low
|
||||
|
||||
* fix datacenter options GUI
|
||||
|
@ -2,7 +2,7 @@ RELEASE=2.0
|
||||
|
||||
VERSION=2.0
|
||||
PACKAGE=pve-manager
|
||||
PACKAGERELEASE=29
|
||||
PACKAGERELEASE=30
|
||||
|
||||
BINDIR=${DESTDIR}/usr/bin
|
||||
PERLLIBDIR=${DESTDIR}/usr/share/perl5
|
||||
|
@ -389,6 +389,8 @@ Ext.define('PVE.Utils', { statics: {
|
||||
vzmigrate: [ 'CT', gettext('Migrate') ],
|
||||
vzstart: ['CT', gettext('Start') ],
|
||||
vzstop: ['CT', gettext('Stop') ],
|
||||
vzmount: ['CT', gettext('Mount') ],
|
||||
vzumount: ['CT', gettext('Unmount') ],
|
||||
vzshutdown: ['CT', gettext('Shutdown') ],
|
||||
srvstart: ['SRV', gettext('Start') ],
|
||||
srvstop: ['SRV', gettext('Stop') ],
|
||||
|
@ -38,6 +38,15 @@ Ext.define('PVE.openvz.Config', {
|
||||
vm_command('start');
|
||||
}
|
||||
});
|
||||
|
||||
var umountBtn = Ext.create('Ext.Button', {
|
||||
text: gettext('Unmount'),
|
||||
disabled: true,
|
||||
hidden: true,
|
||||
handler: function() {
|
||||
vm_command('umount');
|
||||
}
|
||||
});
|
||||
|
||||
var stopBtn = Ext.create('PVE.button.Button', {
|
||||
text: gettext('Stop'),
|
||||
@ -96,7 +105,7 @@ Ext.define('PVE.openvz.Config', {
|
||||
Ext.apply(me, {
|
||||
title: Ext.String.format(gettext("Container {0} on node {1}"), descr, "'" + nodename + "'"),
|
||||
hstateid: 'ovztab',
|
||||
tbar: [ startBtn, shutdownBtn, stopBtn, removeBtn,
|
||||
tbar: [ startBtn, shutdownBtn, umountBtn, stopBtn, removeBtn,
|
||||
migrateBtn, consoleBtn ],
|
||||
defaults: { statusStore: me.statusStore },
|
||||
items: [
|
||||
@ -166,6 +175,16 @@ Ext.define('PVE.openvz.Config', {
|
||||
shutdownBtn.setDisabled(status !== 'running');
|
||||
stopBtn.setDisabled(status === 'stopped');
|
||||
removeBtn.setDisabled(status !== 'stopped');
|
||||
|
||||
if (status === 'mounted') {
|
||||
umountBtn.setDisabled(false);
|
||||
umountBtn.setVisible(true);
|
||||
stopBtn.setVisible(false);
|
||||
} else {
|
||||
umountBtn.setDisabled(true);
|
||||
umountBtn.setVisible(false);
|
||||
stopBtn.setVisible(true);
|
||||
}
|
||||
});
|
||||
|
||||
me.on('afterrender', function() {
|
||||
|
Loading…
Reference in New Issue
Block a user