From 89d0a2aa8a5185ae57cc3018da60cad991f6596a Mon Sep 17 00:00:00 2001 From: Sandip Dey Date: Thu, 16 Feb 2017 01:56:09 -0800 Subject: [PATCH] Deleteing inaccessible nfs datastore before creating a new one Change-Id: I11e1aebff5912214ba7128185982e33b029d6e3a --- fixtures/vcenter.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fixtures/vcenter.py b/fixtures/vcenter.py index d1f7d705e..93eb9cd90 100644 --- a/fixtures/vcenter.py +++ b/fixtures/vcenter.py @@ -59,6 +59,11 @@ def __init__(self, inputs, vc): return #the vcenter server/reimaging the esxi hosts,we are only provisioning #the contrail-controllers.Hence, the nfs datastore becomes #in-accessiable.We need to create and mount the nfs datastore again. + else: + hosts = [host for cluster in vc._dc.hostFolder.childEntity for host in cluster.host] + for host in hosts: + self._delete_datastore(host,nas_ds) + username = inputs.host_data[self.server]['username'] password = inputs.host_data[self.server]['password'] with settings(host_string=username+'@'+self.server, password=password, @@ -75,6 +80,10 @@ def __init__(self, inputs, vc): for host in hosts: host.configManager.datastoreSystem.CreateNasDatastore(spec) + def _delete_datastore(self,host,datastore): + host.configManager.datastoreSystem.RemoveDatastore(datastore) + + class VcenterPvtVlanMgr: __metaclass__ = Singleton