[pve-devel] [PATCH 1/3] introduce version_to_int
Stefan Priebe
s.priebe at profihost.ag
Mon May 27 22:52:15 CEST 2013
Signed-off-by: Stefan Priebe <s.priebe at profihost.ag>
---
PVE/QemuServer.pm | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index f90d56e..f4697d7 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -670,6 +670,18 @@ sub kvm_user_version {
}
+sub version_to_int {
+ my $ver = shift;
+
+ if ($ver =~ m/^(\d+)\.(\d+)$/) {
+ return $1*1000000+$2*1000;
+ } elsif ($ver =~ m/^(\d+)\.(\d+)\.(\d+)$/) {
+ return $1*1000000+$2*1000+$3;
+ }
+
+ die "Cannot read version $ver\n";
+}
+
my $kernel_has_vhost_net = -c '/dev/vhost-net';
sub disknames {
@@ -2228,12 +2240,7 @@ sub config_to_command {
my $pciaddr = '';
my $bridges = {};
my $kvmver = kvm_user_version();
- my $vernum = 0; # unknown
- if ($kvmver =~ m/^(\d+)\.(\d+)$/) {
- $vernum = $1*1000000+$2*1000;
- } elsif ($kvmver =~ m/^(\d+)\.(\d+)\.(\d+)$/) {
- $vernum = $1*1000000+$2*1000+$3;
- }
+ my $vernum = version_to_int($kvmver);
die "detected old qemu-kvm binary ($kvmver)\n" if $vernum < 15000;
--
1.7.10.4
More information about the pve-devel
mailing list