def main(arg): hostname = arg['-s'] version = arg['-v'] password = arg['-p'] username = arg['-u'] vm = arg["--vm"] logfile_name = 'Image_firstnet_provision_patch_%s.log' % hostname fp, out, err, log = cf.logfile_name_gen_open(logfile_name) image.cleanup(hostname, username, password) sys.stdout.flush() time.sleep(300) print "Will image the host %s" % hostname sys.stdout.flush() image.image(hostname, version, vm) ips = configure_firstnet.configure_firstnet(hostname, version, vm) print "Finish configure firstnet, you can use the following ip to configure:" print ips sys.stdout.flush() if not configure_firstnet.is_dcs(hostname, version): print "This host is OAK stack, please continue to deploy to %s manually!" % ( hostname, version) sys.stdout.flush() else: print "Will do the provision and patch to latest version!" sys.stdout.flush() host = oda_lib.Oda_ha(ips[0], "root", "welcome1") d_p_p.provision_patch(host) sys.stdout.flush() cf.closefile(fp, out, err) print "Done, please check the log %s for details!" % log
def main(hostname, username, password): logfile_name = 'check_deploy_patch_%s.log' % hostname fp, out, err, log = cf.logfile_name_gen_open(logfile_name) host = oda_lib.Oda_ha(hostname, username, password) provision_patch(host) #patch_deploy(host) error = cf.logfile_close_check_error(fp, out, err, log) return error
def main(hostname, username, password): logfile_name = 'check_dbhome_create_delete_%s.log' % hostname fp, out, err, log = cf.logfile_name_gen_open(logfile_name) host = oda_lib.Oda_ha(hostname, username, password) ver = random.choice(['170814', '171017', '180116', '180417']) check_dbhome(host, ver) error = cf.logfile_close_check_error(fp, out, err, log) return error
def main(hostname, username, password): logfile_name = 'check_cpucore_%s.log' % hostname fp, out, err, log = cf.logfile_name_gen_open(logfile_name) host = oda_lib.Oda_ha(hostname, username, password) cpucore_org = host.decribe_cpucore()[0]['cpuCores'] positive_case(host, int(cpucore_org)) negative_case(host) positive_case2(host, int(cpucore_org)) error = cf.logfile_close_check_error(fp, out, err, log) return error
def main(hostname, username, password): logfile_name = 'check_create_dbstorage_%s.log' % hostname fp, out, err,log = cf.logfile_name_gen_open(logfile_name) #out, err = sys.stdout, sys.stderr #fp = open(logfile_name_stamp, 'a') #sys.stdout, sys.stderr = fp, fp host = oda_lib.Oda_ha(hostname, username, password) dbstorage_asm_create(host) dbstorage_acfs_create(host) error = cf.logfile_close_check_error(fp, out, err,log) return error
def main(hostname, username, password, version): logfile_name = 'check_oda_patch_%s.log' % hostname fp, out, err, log = cf.logfile_name_gen_open(logfile_name) host = oda_lib.Oda_ha(hostname, username, password) dcs_patch(host, version) server_patch(host, version) time.sleep(600) cf.wait_until_ping(host.hostname) host2 = oda_lib.Oda_ha(hostname, username, password) dbhome_patch(host2, version) error = cf.logfile_close_check_error(fp, out, err, log) return error
def main(arg): hostname = arg['-s'] username = arg['-u'] password = arg['-p'] logfile_name = 'check_deploy_patch_%s.log' % hostname fp, out, err,log = cf.logfile_name_gen_open(logfile_name) host = oda_lib.Oda_ha(hostname, username, password) if arg['--pbd']: patch_deploy(host) else: provision_patch(host) error = cf.logfile_close_check_error(fp, out, err,log) return error
def main(hostname, username, password): logfile_name = 'check_create_database_%s.log' % hostname fp, out, err,log = cf.logfile_name_gen_open(logfile_name) #out, err = sys.stdout, sys.stderr #fp = open(logfile_name_stamp, 'a') #sys.stdout, sys.stderr = fp, fp host = oda_lib.Oda_ha(hostname,username,password) create_database_case(host) #delete_all_dbhomes(host) error = cf.logfile_close_check_error(fp, out, err,log) return error
def main(host): logfile_name = 'check_oak_preparing_patch_%s.log' % host.hostname fp, out, err, log = cf.logfile_name_gen_open(logfile_name) host2 = node2_host(host) scp_stat(host) scp_stat(host2) pre_patch_check(host) pre_patch_check(host2) scp_unpack_pb(host) scp_unpack_pb(host2) post_unpack(host) post_unpack(host2) cf.logfile_close_check_error(fp, out, err, log)
def main(hostname, username, password): logfile_name = 'check_create_backupconfig_%s.log' % hostname fp, out, err, log = cf.logfile_name_gen_open(logfile_name) #out, err = sys.stdout, sys.stderr #fp = open(logfile_name_stamp, 'a') #sys.stdout, sys.stderr = fp, fp host = oda_lib.Oda_ha(hostname, username, password) #create_bkc_disk(host) create_bkc_oss(host) #create_bkc_none(host) error = cf.logfile_close_check_error(fp, out, err, log) return error
def main(hostname, username, password): logfile_name = 'check_back_recovery_%s.log' % hostname fp, out, err,log = cf.logfile_name_gen_open(logfile_name) host = oda_lib.Oda_ha(hostname, username, password) global dbname dbname = randomget_dbname(host) print dbname if dbname: #backup_disk(host) backup_oss(host) else: print "Fail to get the dbname!" error = cf.logfile_close_check_error(fp, out, err,log) return error
def scp_template_file(host): oak1, oak2 = dom0_name(host) cmd = "sh scp_template.sh %s %s" % (oak1, oak2) cf.exc_cmd(cmd) def scp_crvm_script(host): remote_file = os.path.join(remote_dir, os.path.basename(vm_script)) host.scp2node(vm_script, remote_file) if __name__ == '__main__': arg = docopt(__doc__) print arg hostname = arg['-s'] username = arg['-u'] password = arg['-p'] host = oda_lib_oak.Oda_ha(hostname, username, password) logfile_name = 'check_oak_create_db_vm_%s.log' % hostname fp, out, err, log = cf.logfile_name_gen_open(logfile_name) if arg['crdb']: exec_crdb_script(host) if arg['crvm']: exec_crvm_scripts(host) if not arg['crdb'] and not arg['crvm']: exec_crdb_script(host) exec_crvm_scripts(host) cf.logfile_close_check_error(fp, out, err, log)