From 47152e2ee31d14c3fdc5f386c9d14fd308a5652b Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Fri, 30 Mar 2012 09:13:31 +0200 Subject: [PATCH] fix bug #12: check storage availability early (migrate) --- Makefile | 2 +- PVE/API2/Qemu.pm | 3 +++ PVE/QemuServer.pm | 19 +++++++++++++++++++ changelog.Debian | 6 ++++++ 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 62d0ed4..9995b93 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ RELEASE=2.0 VERSION=2.0 PACKAGE=qemu-server -PKGREL=33 +PKGREL=34 DESTDIR= PREFIX=/usr diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index 9537a3c..91d9439 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -1633,6 +1633,9 @@ __PACKAGE__->register_method({ if !$param->{online}; } + my $storecfg = PVE::Storage::config(); + PVE::QemuServer::check_storage_availability($storecfg, $conf, "test"); + if (&$vm_is_ha_managed($vmid) && $rpcenv->{type} ne 'ha') { my $hacmd = sub { diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 8f771d5..80dc2b5 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -1682,6 +1682,25 @@ sub check_local_resources { return $loc_res; } +# check is used storages are available on all nodes (use by migrate) +sub check_storage_availability { + my ($storecfg, $conf, $node) = @_; + + foreach_drive($conf, sub { + my ($ds, $drive) = @_; + + my $volid = $drive->{file}; + return if !$volid; + + my ($sid, $volname) = PVE::Storage::parse_volume_id($volid, 1); + return if !$sid; + + # check if storage is available on both nodes + my $scfg = PVE::Storage::storage_check_node($storecfg, $sid); + PVE::Storage::storage_check_node($storecfg, $sid, $node); + }); +} + sub check_lock { my ($conf) = @_; diff --git a/changelog.Debian b/changelog.Debian index ba7c261..ad909db 100644 --- a/changelog.Debian +++ b/changelog.Debian @@ -1,3 +1,9 @@ +qemu-server (2.0-34) unstable; urgency=low + + * fix bug #12: check storage availability early (migrate) + + -- Proxmox Support Team Fri, 30 Mar 2012 09:12:46 +0200 + qemu-server (2.0-33) unstable; urgency=low * fix bug #121: activate volumes correctly -- 2.39.2