From 9bd455a82ca8e6f34ae29935de9e64378cfc8832 Mon Sep 17 00:00:00 2001 From: Ricardo Diaz Date: Mon, 22 Feb 2021 19:27:37 +0100 Subject: [PATCH] B #-: FC hooks iterate over all NICs (#855) Firecracker hooks (pre and clean) should only process those NICs whose VN driver matches the driver that actually calls the hook. Signed-off-by: Ricardo Diaz --- src/vnm_mad/remotes/hooks/clean/firecracker | 4 +++- src/vnm_mad/remotes/hooks/pre/firecracker | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/vnm_mad/remotes/hooks/clean/firecracker b/src/vnm_mad/remotes/hooks/clean/firecracker index 67c7c4ee98..4d2b26d871 100755 --- a/src/vnm_mad/remotes/hooks/clean/firecracker +++ b/src/vnm_mad/remotes/hooks/clean/firecracker @@ -39,7 +39,9 @@ def command(cmd) cmd_str end -XPATH_NICS = '//TEMPLATE/NIC' +vnmad = File.basename(File.expand_path('..', File.dirname(__FILE__))) + +XPATH_NICS = "//TEMPLATE/NIC[VN_MAD='#{vnmad}']" XPATH_HV = '//HISTORY/VM_MAD' #---------------------------------------------------------------------------- diff --git a/src/vnm_mad/remotes/hooks/pre/firecracker b/src/vnm_mad/remotes/hooks/pre/firecracker index a117b6e411..b81045791e 100755 --- a/src/vnm_mad/remotes/hooks/pre/firecracker +++ b/src/vnm_mad/remotes/hooks/pre/firecracker @@ -35,7 +35,9 @@ def command(cmd) cmd_str end -XPATH_NICS = '//TEMPLATE/NIC' +vnmad = File.basename(File.expand_path('..', File.dirname(__FILE__))) + +XPATH_NICS = "//TEMPLATE/NIC[VN_MAD='#{vnmad}']" XPATH_HV = '//HISTORY/VM_MAD' #---------------------------------------------------------------------------- @@ -86,4 +88,4 @@ template.elements.each(XPATH_NICS) do |nic_element| break unless rc.success? end -exit(-1) unless rc.success? +exit(-1) unless rc.nil? || rc.success?