From bdd231bf517bd61d0ca656ec59c011ef37fc2b13 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Wed, 3 Jun 2015 18:17:52 -0400 Subject: [PATCH 1/2] bug #3768: add tm/failmigrate call on error --- src/vmm_mad/exec/one_vmm_exec.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/vmm_mad/exec/one_vmm_exec.rb b/src/vmm_mad/exec/one_vmm_exec.rb index 4e4ffaa7b2..3f45fb4560 100755 --- a/src/vmm_mad/exec/one_vmm_exec.rb +++ b/src/vmm_mad/exec/one_vmm_exec.rb @@ -478,9 +478,11 @@ class ExecDriver < VirtualMachineDriver action = VmmAction.new(self, id, :migrate, drv_message) pre = "PRE" post = "POST" + failed = "FAIL" pre << action.data[:tm_command] << " " << action.data[:vm] post << action.data[:tm_command] << " " << action.data[:vm] + failed << action.data[:tm_command] << " " << action.data[:vm] steps=[ # Execute a pre-migrate TM setup @@ -499,7 +501,15 @@ class ExecDriver < VirtualMachineDriver { :driver => :vmm, :action => :migrate, - :parameters => [:deploy_id, :dest_host, :host] + :parameters => [:deploy_id, :dest_host, :host], + :fail_actions => [ + { + :driver => :tm, + :action => :tm_failmigrate, + :parameters => failed.split, + :no_fail => true + } + ] }, # Execute networking clean up operations # NOTE: VM is now in the new host. If we fail from now on, oned will From adc3e0e4e711149ff86bbfd273a74c0df520c625 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Thu, 4 Jun 2015 15:43:32 -0400 Subject: [PATCH 2/2] bug #3768: add placeholder failmigrate script --- install.sh | 9 +++++++++ src/tm_mad/ceph/failmigrate | 1 + src/tm_mad/common/failmigrate | 29 +++++++++++++++++++++++++++++ src/tm_mad/dev/failmigrate | 1 + src/tm_mad/dummy/failmigrate | 1 + src/tm_mad/fs_lvm/failmigrate | 1 + src/tm_mad/lvm/failmigrate | 1 + src/tm_mad/qcow2/failmigrate | 1 + src/tm_mad/shared/failmigrate | 1 + src/tm_mad/ssh/failmigrate | 1 + src/tm_mad/vmfs/failmigrate | 1 + 11 files changed, 47 insertions(+) create mode 120000 src/tm_mad/ceph/failmigrate create mode 100755 src/tm_mad/common/failmigrate create mode 120000 src/tm_mad/dev/failmigrate create mode 120000 src/tm_mad/dummy/failmigrate create mode 120000 src/tm_mad/fs_lvm/failmigrate create mode 120000 src/tm_mad/lvm/failmigrate create mode 120000 src/tm_mad/qcow2/failmigrate create mode 120000 src/tm_mad/shared/failmigrate create mode 120000 src/tm_mad/ssh/failmigrate create mode 120000 src/tm_mad/vmfs/failmigrate diff --git a/install.sh b/install.sh index d29e734f5f..075d381737 100755 --- a/install.sh +++ b/install.sh @@ -1018,6 +1018,7 @@ TM_SHARED_FILES="src/tm_mad/shared/clone \ src/tm_mad/shared/context \ src/tm_mad/shared/premigrate \ src/tm_mad/shared/postmigrate \ + src/tm_mad/shared/failmigrate \ src/tm_mad/shared/mvds \ src/tm_mad/shared/cpds" @@ -1028,6 +1029,7 @@ TM_FS_LVM_FILES="src/tm_mad/fs_lvm/clone \ src/tm_mad/fs_lvm/cpds \ src/tm_mad/fs_lvm/premigrate \ src/tm_mad/fs_lvm/postmigrate \ + src/tm_mad/fs_lvm/failmigrate \ src/tm_mad/fs_lvm/delete" TM_QCOW2_FILES="src/tm_mad/qcow2/clone \ @@ -1039,6 +1041,7 @@ TM_QCOW2_FILES="src/tm_mad/qcow2/clone \ src/tm_mad/qcow2/context \ src/tm_mad/qcow2/premigrate \ src/tm_mad/qcow2/postmigrate \ + src/tm_mad/qcow2/failmigrate \ src/tm_mad/qcow2/mvds \ src/tm_mad/qcow2/cpds" @@ -1051,6 +1054,7 @@ TM_SSH_FILES="src/tm_mad/ssh/clone \ src/tm_mad/ssh/context \ src/tm_mad/ssh/premigrate \ src/tm_mad/ssh/postmigrate \ + src/tm_mad/ssh/failmigrate \ src/tm_mad/ssh/mvds \ src/tm_mad/ssh/cpds" @@ -1063,6 +1067,7 @@ TM_DUMMY_FILES="src/tm_mad/dummy/clone \ src/tm_mad/dummy/context \ src/tm_mad/dummy/premigrate \ src/tm_mad/dummy/postmigrate \ + src/tm_mad/dummy/failmigrate \ src/tm_mad/dummy/mvds \ src/tm_mad/dummy/cpds" @@ -1076,6 +1081,7 @@ TM_VMFS_FILES="src/tm_mad/vmfs/clone \ src/tm_mad/vmfs/mvds \ src/tm_mad/vmfs/cpds \ src/tm_mad/vmfs/postmigrate \ + src/tm_mad/vmfs/failmigrate \ src/tm_mad/vmfs/premigrate" TM_LVM_FILES="src/tm_mad/lvm/clone \ @@ -1085,6 +1091,7 @@ TM_LVM_FILES="src/tm_mad/lvm/clone \ src/tm_mad/lvm/cpds \ src/tm_mad/lvm/premigrate \ src/tm_mad/lvm/postmigrate \ + src/tm_mad/lvm/failmigrate \ src/tm_mad/lvm/delete" TM_CEPH_FILES="src/tm_mad/ceph/clone \ @@ -1094,6 +1101,7 @@ TM_CEPH_FILES="src/tm_mad/ceph/clone \ src/tm_mad/ceph/cpds \ src/tm_mad/ceph/premigrate \ src/tm_mad/ceph/postmigrate \ + src/tm_mad/ceph/failmigrate \ src/tm_mad/ceph/delete" TM_DEV_FILES="src/tm_mad/dev/clone \ @@ -1103,6 +1111,7 @@ TM_DEV_FILES="src/tm_mad/dev/clone \ src/tm_mad/dev/cpds \ src/tm_mad/dev/premigrate \ src/tm_mad/dev/postmigrate \ + src/tm_mad/dev/failmigrate \ src/tm_mad/dev/delete" #------------------------------------------------------------------------------- diff --git a/src/tm_mad/ceph/failmigrate b/src/tm_mad/ceph/failmigrate new file mode 120000 index 0000000000..5928a42794 --- /dev/null +++ b/src/tm_mad/ceph/failmigrate @@ -0,0 +1 @@ +../common/failmigrate \ No newline at end of file diff --git a/src/tm_mad/common/failmigrate b/src/tm_mad/common/failmigrate new file mode 100755 index 0000000000..49ab4a881d --- /dev/null +++ b/src/tm_mad/common/failmigrate @@ -0,0 +1,29 @@ +#!/bin/bash + +# -------------------------------------------------------------------------- # +# Copyright 2002-2015, OpenNebula Project (OpenNebula.org), C12G Labs # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); you may # +# not use this file except in compliance with the License. You may obtain # +# a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +#--------------------------------------------------------------------------- # +# FAILMIGRATE SOURCE DST remote_system_dir vmid dsid template +# - SOURCE is the host where the VM is running +# - DST is the host where the VM failed to be migrated +# - remote_system_dir is the path for the VM home in the system datastore +# - vmid is the id of the VM +# - dsid is the target datastore +# - template is the template of the VM in XML and base64 encoded + +# To access the vm_template you can use the xpath.rb utility. Check the +# datastore drivers for an example. + +exit 0 diff --git a/src/tm_mad/dev/failmigrate b/src/tm_mad/dev/failmigrate new file mode 120000 index 0000000000..5928a42794 --- /dev/null +++ b/src/tm_mad/dev/failmigrate @@ -0,0 +1 @@ +../common/failmigrate \ No newline at end of file diff --git a/src/tm_mad/dummy/failmigrate b/src/tm_mad/dummy/failmigrate new file mode 120000 index 0000000000..5928a42794 --- /dev/null +++ b/src/tm_mad/dummy/failmigrate @@ -0,0 +1 @@ +../common/failmigrate \ No newline at end of file diff --git a/src/tm_mad/fs_lvm/failmigrate b/src/tm_mad/fs_lvm/failmigrate new file mode 120000 index 0000000000..5928a42794 --- /dev/null +++ b/src/tm_mad/fs_lvm/failmigrate @@ -0,0 +1 @@ +../common/failmigrate \ No newline at end of file diff --git a/src/tm_mad/lvm/failmigrate b/src/tm_mad/lvm/failmigrate new file mode 120000 index 0000000000..5928a42794 --- /dev/null +++ b/src/tm_mad/lvm/failmigrate @@ -0,0 +1 @@ +../common/failmigrate \ No newline at end of file diff --git a/src/tm_mad/qcow2/failmigrate b/src/tm_mad/qcow2/failmigrate new file mode 120000 index 0000000000..5928a42794 --- /dev/null +++ b/src/tm_mad/qcow2/failmigrate @@ -0,0 +1 @@ +../common/failmigrate \ No newline at end of file diff --git a/src/tm_mad/shared/failmigrate b/src/tm_mad/shared/failmigrate new file mode 120000 index 0000000000..5928a42794 --- /dev/null +++ b/src/tm_mad/shared/failmigrate @@ -0,0 +1 @@ +../common/failmigrate \ No newline at end of file diff --git a/src/tm_mad/ssh/failmigrate b/src/tm_mad/ssh/failmigrate new file mode 120000 index 0000000000..5928a42794 --- /dev/null +++ b/src/tm_mad/ssh/failmigrate @@ -0,0 +1 @@ +../common/failmigrate \ No newline at end of file diff --git a/src/tm_mad/vmfs/failmigrate b/src/tm_mad/vmfs/failmigrate new file mode 120000 index 0000000000..5928a42794 --- /dev/null +++ b/src/tm_mad/vmfs/failmigrate @@ -0,0 +1 @@ +../common/failmigrate \ No newline at end of file