[pve-devel] [PATCH 2/2] add set migrate_downtime default value to 0.1 && add number type

Alexandre Derumier aderumier at odiso.com
Sun Dec 30 19:03:00 CET 2012


can be integer or float

ex:

1
1.0
0.3

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/QemuServer.pm |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 10865ad..5c39728 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -382,10 +382,10 @@ EODESCR
     },
     migrate_downtime => {
 	optional => 1,
-	type => 'integer',
+	type => 'number',
 	description => "Set maximum tolerated downtime (in seconds) for migrations.",
 	minimum => 0,
-	default => 1,
+	default => 0.1,
     },
     cdrom => {
 	optional => 1,
@@ -1441,6 +1441,9 @@ sub check_type {
     } elsif ($type eq 'integer') {
 	return int($1) if $value =~ m/^(\d+)$/;
 	die "type check ('integer') failed - got '$value'\n";
+    } elsif ($type eq 'number') {
+        return $value if $value =~ m/^(\d+)(\.\d+)?$/;
+        die "type check ('number') failed - got '$value'\n";
     } elsif ($type eq 'string') {
 	if (my $fmt = $confdesc->{$key}->{format}) {
 	    if ($fmt eq 'pve-qm-drive') {
-- 
1.7.10.4




More information about the pve-devel mailing list