Blame SOURCES/bz1700546-fence_azure_arm-skip_shutdown.patch

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