def clean_unused_data(export_id, export_path, host, databaseinfra): provider = NfsaasProvider() provider.grant_access(environment=databaseinfra.environment, host=host, export_id=export_id) mount_path = "/mnt_{}_{}".format(databaseinfra.name, export_id) command = "mkdir -p {}".format(mount_path) command += "\nmount -t nfs -o bg,intr {} {}".format( export_path, mount_path) command += "\nrm -rf {}/*".format(mount_path) command += "\numount {}".format(mount_path) command += "\nrm -rf {}".format(mount_path) LOG.info(command) cs_host_attr = CsHostAttr.objects.get(host=host) output = {} exec_remote_command(server=host.address, username=cs_host_attr.vm_user, password=cs_host_attr.vm_password, command=command, output=output) LOG.info(output)
def do(self, workflow_dict): try: databaseinfra = workflow_dict['databaseinfra'] host = workflow_dict['host'] volume = workflow_dict['volume'] NfsaasProvider.grant_access(environment=databaseinfra.environment, host=host, export_id=volume.nfsaas_export_id) return True except Exception: traceback = full_stack() workflow_dict['exceptions']['error_codes'].append(DBAAS_0022) workflow_dict['exceptions']['traceback'].append(traceback) return False
def do(self, workflow_dict): try: databaseinfra = workflow_dict['databaseinfra'] for host_and_export in workflow_dict['hosts_and_exports']: NfsaasProvider.grant_access(environment=databaseinfra.environment, host=host_and_export['host'], export_id=host_and_export['new_export_id']) return True except Exception: traceback = full_stack() workflow_dict['exceptions']['error_codes'].append(DBAAS_0021) workflow_dict['exceptions']['traceback'].append(traceback) return False
def do(self, workflow_dict): try: databaseinfra = workflow_dict['databaseinfra'] for host_and_export in workflow_dict['hosts_and_exports']: NfsaasProvider.grant_access( environment=databaseinfra.environment, host=host_and_export['host'], export_id=host_and_export['new_export_id']) return True except Exception: traceback = full_stack() workflow_dict['exceptions']['error_codes'].append(DBAAS_0021) workflow_dict['exceptions']['traceback'].append(traceback) return False
def do(self, workflow_dict): try: databaseinfra = workflow_dict['databaseinfra'] source_host = workflow_dict['source_hosts'][0] target_host = source_host.future_host nfsaas_export_id = source_host.nfsaas_host_attributes.all()[0].nfsaas_export_id NfsaasProvider.grant_access(environment=databaseinfra.environment, host=target_host, export_id=nfsaas_export_id) return True except Exception: traceback = full_stack() workflow_dict['exceptions']['error_codes'].append(DBAAS_0020) workflow_dict['exceptions']['traceback'].append(traceback) return False
def do(self, workflow_dict): try: databaseinfra = workflow_dict['databaseinfra'] source_host = workflow_dict['source_hosts'][0] target_host = source_host.future_host nfsaas_export_id = source_host.nfsaas_host_attributes.all( )[0].nfsaas_export_id NfsaasProvider.grant_access(environment=databaseinfra.environment, host=target_host, export_id=nfsaas_export_id) return True except Exception: traceback = full_stack() workflow_dict['exceptions']['error_codes'].append(DBAAS_0020) workflow_dict['exceptions']['traceback'].append(traceback) return False