From 64e1340181601ab9ae538f838499018705cad7da Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Fri, 9 Sep 2011 12:13:21 +0200 Subject: [PATCH] New method to check if VM uses local resources --- PVE/QemuServer.pm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 1151f060..128fb8bd 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -1614,6 +1614,27 @@ sub config_list { return $res; } +# test if VM uses local resources (to prevent migration) +sub check_local_resources { + my ($conf, $noerr) = @_; + + my $loc_res = 0; + # fixme: + die "implement me"; + $loc_res = 1 if $conf->{hostusb}; + $loc_res = 1 if $conf->{hostpci}; + $loc_res = 1 if $conf->{serial}; + $loc_res = 1 if $conf->{parallel}; + + foreach $k (keys %$conf) { + $loc_res = 1 if $k =~ m/^(usb|pci)\d+$/; + } + + die "VM uses local resources\n" if $loc_res && !$noerr; + + return $loc_res; +} + sub check_lock { my ($conf) = @_;