[ https://issues.apache.org/jira/browse/CLOUDSTACK-9438?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15530044#comment-15530044 ]
ASF GitHub Bot commented on CLOUDSTACK-9438: -------------------------------------------- Github user nvazquez commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1615#discussion_r80951509 --- Diff: test/integration/smoke/test_ssvm.py --- @@ -1197,3 +1205,148 @@ def test_10_destroy_cpvm(self): # Call to verify cloud process is running self.test_04_cpvm_internals() return + + @attr( + tags=[ + "advanced", + "advancedns", + "smoke", + "basic", + "sg"], + required_hardware="true") + def test_11_ss_nfs_version_on_ssvm(self): + """Test NFS Version on Secondary Storage mounted properly on SSVM + """ + + # 1) List SSVM in zone + # 2) Get id and url from mounted nfs store + # 3) Update NFS version for previous image store + # 4) Stop SSVM + # 5) Check NFS version of mounted nfs store after SSVM starts + + nfs_version = self.config.nfsVersion + if nfs_version == None: + self.skipTest('No NFS version provided in test data') + + #List SSVM for zone id + list_ssvm_response = list_ssvms( + self.apiclient, + systemvmtype='secondarystoragevm', + state='Running', + zoneid=self.zone.id + ) + self.assertEqual( + isinstance(list_ssvm_response, list), + True, + "Check list response returns a valid list" + ) + self.assertEqual( + len(list_ssvm_response), + 1, + "Check list System VMs response" + ) + + ssvm = list_ssvm_response[0] + image_stores_response = ImageStore.list(self.apiclient,zoneid=self.zone.id) + + if self.hypervisor.lower() in ('vmware', 'hyperv'): + # SSH into SSVMs is done via management server for Vmware and Hyper-V + result = get_process_status( + self.apiclient.connection.mgtSvr, + 22, + self.apiclient.connection.user, + self.apiclient.connection.passwd, + ssvm.privateip, + "mount | grep 'type nfs'", + hypervisor=self.hypervisor) + + for res in result: + split_res = res.split(" on ") + mounted_img_store_url = split_res[0] + for img_store in image_stores_response: + img_store_url = str(img_store.url) + if img_store_url.startswith("nfs://"): + img_store_url = img_store_url[6:] + #Add colon after ip address to match output from mount command + first_slash = img_store_url.find('/') + img_store_url = img_store_url[0:first_slash] + ':' + img_store_url[first_slash:] + if img_store_url == mounted_img_store_url: + img_store_id = img_store.id + break + + self.assertNotEqual( + img_store_id, + None, + "Check image store id mounted on SSVM" + ) + + #Update NFS version for image store mounted on SSVM + updateConfigurationCmd = updateConfiguration.updateConfigurationCmd() + updateConfigurationCmd.name = "secstorage.nfs.version" + updateConfigurationCmd.value = nfs_version + updateConfigurationCmd.imagestoreuuid = img_store_id + + updateConfigurationResponse = self.apiclient.updateConfiguration(updateConfigurationCmd) + self.logger.debug("updated the parameter %s with value %s"%(updateConfigurationResponse.name, updateConfigurationResponse.value)) + + #Stop SSVM + self.debug("Stopping SSVM: %s" % ssvm.id) + cmd = stopSystemVm.stopSystemVmCmd() + cmd.id = ssvm.id + self.apiclient.stopSystemVm(cmd) + + timeout = self.services["timeout"] + while True: + list_ssvm_response = list_ssvms( + self.apiclient, + id=ssvm.id + ) + if isinstance(list_ssvm_response, list): + if list_ssvm_response[0].state == 'Running': + break + if timeout == 0: + raise Exception("List SSVM call failed!") + + time.sleep(self.services["sleep"]) + timeout = timeout - 1 + + self.assertEqual( + isinstance(list_ssvm_response, list), + True, + "Check list response returns a valid list" + ) + ssvm = list_ssvm_response[0] + self.debug("SSVM state after debug: %s" % ssvm.state) + self.assertEqual( + ssvm.state, + 'Running', + "Check whether SSVM is running or not" + ) + # Wait for the agent to be up + self.waitForSystemVMAgent(ssvm.name) + + #Check NFS version on mounted image store + result = get_process_status( + self.apiclient.connection.mgtSvr, + 22, + self.apiclient.connection.user, + self.apiclient.connection.passwd, + ssvm.privateip, + "mount | grep '%s'"%mounted_img_store_url, + hypervisor=self.hypervisor) --- End diff -- Done, thanks > Fix for CLOUDSTACK-9252 - Make NFS version changeable in UI > ----------------------------------------------------------- > > Key: CLOUDSTACK-9438 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9438 > Project: CloudStack > Issue Type: Improvement > Security Level: Public(Anyone can view this level - this is the > default.) > Reporter: Nicolas Vazquez > Assignee: Nicolas Vazquez > > h3. Introduction > From [9252|https://issues.apache.org/jira/browse/CLOUDSTACK-9252] it was > possible to configure NFS version for secondary storage mount. > However, changing NFS version requires inserting an new detail on > {{image_store_details}} table, with {{name = 'nfs.version'}} and {{value = > X}} where X is desired NFS version, and then restarting management server for > changes to take effect. > Our improvement aims to make NFS version changeable from UI, instead of > previously described workflow. > h3. Proposed solution > Basically, NFS version is defined as an image store ConfigKey, this implied: > * Adding a new Config scope: *ImageStore* > * Make {{ImageStoreDetailsDao}} class to extend {{ResourceDetailsDaoBase}} > and {{ImageStoreDetailVO}} implement {{ResourceDetail}} > * Insert {{'display'}} column on {{image_store_details}} table > * Extending {{ListCfgsCmd}} and {{UpdateCfgCmd}} to support *ImageStore* > scope, which implied: > ** Injecting {{ImageStoreDetailsDao}} and {{ImageStoreDao}} on > {{ConfigurationManagerImpl}} class, on {{cloud-server}} module. > h4. Important > It is important to mention that {{ImageStoreDaoImpl}} and > {{ImageStoreDetailsDaoImpl}} classes were moved from {{cloud-engine-storage}} > to {{cloud-engine-schema}} module in order to Spring find those beans to > inject on {{ConfigurationManagerImpl}} in {{cloud-server}} module. > We had this maven dependencies between modules: > * {{cloud-server --> cloud-engine-schema}} > * {{cloud-engine-storage --> cloud-secondary-storage --> cloud-server}} > As {{ImageStoreDaoImpl}} and {{ImageStoreDetailsDaoImpl}} were defined in > {{cloud-engine-storage}}, and they needed in {{cloud-server}} module, to be > injected on {{ConfigurationManagerImpl}}, if we added dependency from > {{cloud-server}} to {{cloud-engine-storage}} we would introduce a dependency > cycle. To avoid this cycle, we moved those classes to {{cloud-engine-schema}} > module -- This message was sent by Atlassian JIRA (v6.3.4#6332)