コード例 #1
0
    def _config_az_cascaded(self):
        LOG.info("start config cascaded host, host: %s" % self.api_ip)
        # modify dns server address
        address = "/%(cascading_domain)s/%(cascading_ip)s,/%(cascaded_domain)s/%(cascaded_ip)s" \
                  % {"cascading_domain": self.cascading_domain,
                     "cascading_ip": self.cascading_api_ip,
                     "cascaded_domain":self.cascaded_domain,
                     "cascaded_ip":self.cascaded_ip}
        for i in range(30):
            try:
                commonutils.execute_cmd_without_stdout(
                    host=self.public_ip_api,
                    user=self.user,
                    password=self.password,
                    cmd=
                    'cd %(dir)s; source /root/adminrc; sh %(script)s replace %(address)s'
                    % {
                        "dir": constant.PublicConstant.SCRIPTS_DIR,
                        "script":
                        constant.PublicConstant.MODIFY_DNS_SERVER_ADDRESS,
                        "address": address
                    })
                break
            except exception.SSHCommandFailure as e:
                LOG.error("modify cascaded dns address error, cascaded: "
                          "%s, error: %s" % (self.domain, e.format_message()))
                time.sleep(1)

        LOG.info("config cascaded dns address success, cascaded: %s" %
                 self.public_ip_api)

        return True
コード例 #2
0
 def _config_az_cascaded(self):
     LOG.info("start config cascaded host, host: %s" % self.api_ip)
     #pdb.set_trace()
     gateway = _get_gateway(self.api_ip)
     for i in range(30):
         try:
             commonutils.execute_cmd_without_stdout(
                 host=self.public_ip_api,
                 user=constant.VcloudConstant.ROOT,
                 password=constant.VcloudConstant.ROOT_PWD,
                 cmd='cd %(dir)s; python %(script)s '
                     '%(cascading_domain)s %(cascading_api_ip)s '
                     '%(cascaded_domain)s %(cascaded_ip)s '
                     '%(gateway)s'
                     % {"dir": constant.Cascaded.REMOTE_VCLOUD_SCRIPTS_DIR,
                        "script":
                            constant.Cascaded.MODIFY_CASCADED_SCRIPT_PY,
                        "cascading_domain": self.cascading_domain,
                        "cascading_api_ip": self.cascading_api_ip,
                        "cascaded_domain": self.domain,
                        "cascaded_ip": self.api_ip,
                        "gateway": gateway})
             break
         except exception.SSHCommandFailure as e:
             LOG.error("modify cascaded domain error: %s"
                          % e.message)
             time.sleep(5)
     return True
コード例 #3
0
    def _config_az_cascaded(self):
        LOG.info("start config cascaded host, host: %s" % self.api_ip)
        # modify dns server address
        address = "/%(cascading_domain)s/%(cascading_ip)s,/%(cascaded_domain)s/%(cascaded_ip)s" \
                  % {"cascading_domain": self.cascading_domain,
                     "cascading_ip": self.cascading_api_ip,
                     "cascaded_domain":self.cascaded_domain,
                     "cascaded_ip":self.cascaded_ip}
        for i in range(30):
            try:
                commonutils.execute_cmd_without_stdout(
                    host=self.public_ip_api,
                    user=self.user,
                    password=self.password,
                    cmd='cd %(dir)s; source /root/adminrc; sh %(script)s replace %(address)s'
                        % {"dir": constant.PublicConstant.SCRIPTS_DIR,
                           "script": constant.PublicConstant.
                               MODIFY_DNS_SERVER_ADDRESS,
                           "address": address})
                break
            except exception.SSHCommandFailure as e:
                LOG.error("modify cascaded dns address error, cascaded: "
                             "%s, error: %s"
                             % (self.domain, e.format_message()))
                time.sleep(1)

        LOG.info(
            "config cascaded dns address success, cascaded: %s"
            % self.public_ip_api)

        return True