new startup option to define startup order

This commit is contained in:
Dietmar Maurer 2012-04-19 14:28:05 +02:00
parent 71c11a8301
commit 59411c4e10
4 changed files with 49 additions and 2 deletions

View File

@ -2,7 +2,7 @@ RELEASE=2.0
VERSION=2.0
PACKAGE=qemu-server
PKGREL=38
PKGREL=39
DESTDIR=
PREFIX=/usr

View File

@ -320,6 +320,12 @@ EODESC
pattern => '(now|\d{4}-\d{1,2}-\d{1,2}(T\d{1,2}:\d{1,2}:\d{1,2})?)',
default => 'now',
},
startup => {
optional => 1,
type => 'string', format => 'pve-qm-startup',
typetext => '[[order=]\d+] [,up=\d+] [,down=\d+] ',
description => "Startup and shutdown behavior. Order is a non-negative number defining the general startup order. Shutdown in done with reverse ordering. Additionally you can set the 'up' or 'down' delay in seconds, which specifies a delay to wait before the next VM is started or stopped.",
},
args => {
optional => 1,
type => 'string',
@ -1244,6 +1250,41 @@ sub parse_watchdog {
return $res;
}
PVE::JSONSchema::register_format('pve-qm-startup', \&verify_startup);
sub verify_startup {
my ($value, $noerr) = @_;
return $value if parse_startup($value);
return undef if $noerr;
die "unable to parse startup options\n";
}
sub parse_startup {
my ($value) = @_;
return undef if !$value;
my $res = {};
foreach my $p (split(/,/, $value)) {
next if $p =~ m/^\s*$/;
if ($p =~ m/^(order=)?(\d+)$/) {
$res->{order} = $2;
} elsif ($p =~ m/^up=(\d+)$/) {
$res->{up} = $1;
} elsif ($p =~ m/^down=(\d+)$/) {
$res->{down} = $1;
} else {
return undef;
}
}
return $res;
}
sub parse_usb_device {
my ($value) = @_;

View File

@ -132,7 +132,7 @@ sub prepare {
my ($srcdev, $lvmpath, $lvmvg, $lvmlv, $fstype) =
PVE::VZDump::get_lvm_device ($dir, $lvmmap);
my $targetdev = PVE::VZDump::get_lvm_device ($task->{dumpdir}, $lvmmap);
my $targetdev = PVE::VZDump::get_lvm_device($task->{dumpdir}, $lvmmap);
die ("mode failure - unable to detect lvm volume group\n") if !$lvmvg;
die ("mode failure - wrong lvm mount point '$lvmpath'\n") if $dir !~ m|/?$lvmpath/?|;

View File

@ -1,3 +1,9 @@
qemu-server (2.0-39) unstable; urgency=low
* new startup option to define startup order.
-- Proxmox Support Team <support@proxmox.com> Thu, 19 Apr 2012 14:26:04 +0200
qemu-server (2.0-38) unstable; urgency=low
* add directsync cache mode