Blame SOURCES/bz1700544-fence_azure_arm-skip_shutdown.patch

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