ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmitriu...@apache.org
Subject [1/2] ambari git commit: AMBARI-12594. RU- 2.3 - 2.3 + - NFS jars are not upgraded and refer to old version after the upgrade (dlysnichenko)
Date Mon, 03 Aug 2015 17:39:46 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 59479e59b -> 49e41948a
  refs/heads/trunk d6058d956 -> 5cfe6d60d


AMBARI-12594. RU- 2.3 - 2.3 + - NFS jars are not upgraded and refer to old version after the
upgrade (dlysnichenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/49e41948
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/49e41948
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/49e41948

Branch: refs/heads/branch-2.1
Commit: 49e41948af4aa5d42a3680d05621768db4b357cc
Parents: 59479e5
Author: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Authored: Mon Aug 3 20:39:07 2015 +0300
Committer: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Committed: Mon Aug 3 20:39:07 2015 +0300

----------------------------------------------------------------------
 .../2.1.0.2.0/package/scripts/nfsgateway.py     | 11 ++++++++--
 .../stacks/HDP/2.3/upgrades/upgrade-2.3.xml     |  7 ++++++
 .../python/stacks/2.0.6/HDFS/test_nfsgateway.py | 23 ++++++++++++++++++++
 3 files changed, 39 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/49e41948/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/nfsgateway.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/nfsgateway.py
b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/nfsgateway.py
index d599b8c..be6f0d5 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/nfsgateway.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/nfsgateway.py
@@ -24,6 +24,9 @@ from resource_management.libraries.functions.security_commons import build_expec
   FILE_TYPE_XML
 from hdfs_nfsgateway import nfsgateway
 from hdfs import hdfs
+from resource_management.libraries.functions import conf_select
+from resource_management.libraries.functions import hdp_select
+from resource_management.libraries.functions.version import compare_versions, format_hdp_stack_version
 
 
 class NFSGateway(Script):
@@ -39,8 +42,12 @@ class NFSGateway(Script):
     self.install_packages(env, params.exclude_packages)
 
   def pre_rolling_restart(self, env):
-    # it does not need any Rolling Restart logic.
-    pass
+    import params
+    env.set_params(params)
+
+    if Script.is_hdp_stack_greater_or_equal('2.3.0.0'):
+      conf_select.select(params.stack_name, "hadoop", params.version)
+      hdp_select.select("hadoop-hdfs-nfs3", params.version)
 
   def start(self, env, rolling_restart=False):
     import params

http://git-wip-us.apache.org/repos/asf/ambari/blob/49e41948/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml
index 3dda481..7471025 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml
@@ -137,6 +137,7 @@
       <service-check>false</service-check>
       <service name="HDFS">
         <component>DATANODE</component>
+        <component>NFS_GATEWAY</component>
       </service>
       
       <service name="HBASE">
@@ -396,6 +397,12 @@
         </upgrade>
       </component>
 
+      <component name="NFS_GATEWAY">
+        <upgrade>
+          <task xsi:type="restart" />
+        </upgrade>
+      </component>
+
       <component name="HDFS_CLIENT">
         <upgrade>
           <task xsi:type="restart" />

http://git-wip-us.apache.org/repos/asf/ambari/blob/49e41948/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_nfsgateway.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_nfsgateway.py b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_nfsgateway.py
index 37dcb20..62458c1 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_nfsgateway.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_nfsgateway.py
@@ -18,6 +18,7 @@ See the License for the specific language governing permissions and
 limitations under the License.
 '''
 import os
+import json
 from stacks.utils.RMFTestCase import *
 from mock.mock import MagicMock, patch
 
@@ -377,3 +378,25 @@ class TestNFSGateway(RMFTestCase):
                        target = RMFTestCase.TARGET_COMMON_SERVICES
     )
     put_structured_out_mock.assert_called_with({"securityState": "UNSECURED"})
+    self.assertNoMoreResources()
+
+  @patch("resource_management.core.shell.call")
+  def test_pre_rolling_restart(self, call_mock):
+    call_mock.side_effects = [(0, None), (0, None)]
+    config_file = self.get_src_folder()+"/test/python/stacks/2.0.6/configs/default.json"
+    with open(config_file, "r") as f:
+      json_content = json.load(f)
+    version = '2.3.1.0-3242'
+    json_content['commandParams']['version'] = version
+    stack_version = '2.3'
+    json_content['hostLevelParams']['stack_version'] = stack_version
+    self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/nfsgateway.py",
+                       classname = "NFSGateway",
+                       command = "pre_rolling_restart",
+                       config_dict = json_content,
+                       hdp_stack_version = self.STACK_VERSION,
+                       target = RMFTestCase.TARGET_COMMON_SERVICES,
+                       call_mocks = [(0, None), (0, None), (0, None), (0, None)])
+    self.assertResourceCalled('Execute',
+                              ('hdp-select', 'set', 'hadoop-hdfs-nfs3', version), sudo=True,)
+    self.assertNoMoreResources()


Mime
View raw message