Blame SOURCES/bz1700546-fence_azure_arm-skip_shutdown.patch

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