Blame SOURCES/bz1700544-fence_azure_arm-skip_shutdown.patch

d307bf
From 1b3e548fcc0bd427dade178fa260567047ff3a0e Mon Sep 17 00:00:00 2001
d307bf
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
d307bf
Date: Mon, 6 May 2019 13:24:18 +0200
d307bf
Subject: [PATCH] fence_azure_arm: use skip_shutdown feature when available
d307bf
d307bf
The "skip_shutdown" parameter is ignored in older Azure SDK, so there's
d307bf
no need for a fallback option.
d307bf
---
d307bf
 agents/azure_arm/fence_azure_arm.py     | 6 +++---
d307bf
 tests/data/metadata/fence_azure_arm.xml | 2 +-
d307bf
 2 files changed, 4 insertions(+), 4 deletions(-)
d307bf
d307bf
diff --git a/agents/azure_arm/fence_azure_arm.py b/agents/azure_arm/fence_azure_arm.py
d307bf
index 58b9eeb13..be0d40345 100755
d307bf
--- a/agents/azure_arm/fence_azure_arm.py
d307bf
+++ b/agents/azure_arm/fence_azure_arm.py
d307bf
@@ -114,8 +114,8 @@ def set_power_status(clients, options):
d307bf
                 azure_fence.set_network_state(compute_client, network_client, rgName, vmName, "unblock")
d307bf
 
d307bf
         if (options["--action"]=="off"):
d307bf
-            logging.info("Deallocating " + vmName + " in resource group " + rgName)
d307bf
-            compute_client.virtual_machines.deallocate(rgName, vmName)
d307bf
+            logging.info("Poweroff " + vmName + " in resource group " + rgName)
d307bf
+            compute_client.virtual_machines.power_off(rgName, vmName, skip_shutdown=True)
d307bf
         elif (options["--action"]=="on"):
d307bf
             logging.info("Starting " + vmName + " in resource group " + rgName)
d307bf
             compute_client.virtual_machines.start(rgName, vmName)
d307bf
@@ -199,7 +199,7 @@ def main():
d307bf
 
d307bf
     docs = {}
d307bf
     docs["shortdesc"] = "Fence agent for Azure Resource Manager"
d307bf
-    docs["longdesc"] = "Used to deallocate virtual machines and to report power state of virtual machines running in Azure. It uses Azure SDK for Python to connect to Azure.\
d307bf
+    docs["longdesc"] = "fence_azure_arm is an I/O Fencing agent for Azure Resource Manager. It uses Azure SDK for Python to connect to Azure.\
d307bf
 \n.P\n\
d307bf
 For instructions to setup credentials see: https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal\
d307bf
 \n.P\n\
d307bf
diff --git a/tests/data/metadata/fence_azure_arm.xml b/tests/data/metadata/fence_azure_arm.xml
d307bf
index 1c0b6cc6b..97ecfdba4 100644
d307bf
--- a/tests/data/metadata/fence_azure_arm.xml
d307bf
+++ b/tests/data/metadata/fence_azure_arm.xml
d307bf
@@ -1,6 +1,6 @@
d307bf
 
d307bf
 <resource-agent name="fence_azure_arm" shortdesc="Fence agent for Azure Resource Manager" >
d307bf
-<longdesc>Used to deallocate virtual machines and to report power state of virtual machines running in Azure. It uses Azure SDK for Python to connect to Azure.
d307bf
+<longdesc>fence_azure_arm is an I/O Fencing agent for Azure Resource Manager. It uses Azure SDK for Python to connect to Azure.
d307bf
 
d307bf
 For instructions to setup credentials see: https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal
d307bf