def main(): """Usage: vds_bootstrap_complete.py [-c vds_config_str] [-v <ver>] [-V] [-g] <random_num> [reboot]""" try: vds_config_str = None #FIXME: these flags are added for near future use installVirtualizationService = True installGlusterService = False opts, args = getopt.getopt(sys.argv[1:], "v:c:Vg") for o, v in opts: if o == "-v": deployUtil.setBootstrapInterfaceVersion(int(v)) if o == "-c": # it should looks like: # 'ssl=true;ksm_nice=5;images=/images/irsd' without white # spaces in it. vds_config_str = v if o == "-V": installVirtualizationService = False if o == "-g": installGlusterService = True logging.debug("installVirtualizationService = '%s', " "installGlusterService = '%s'" % (installVirtualizationService, installGlusterService)) rnum = args[0] except: print main.__doc__ return False try: arg = int(args[1]) except: arg = 1 res = True try: res = deployUtil.instCert(rnum, VDSM_CONF_FILE) if res: res = deployUtil.setCoreDumpPath() if res: res = deployUtil.cleanAll(rnum) if res: try: deployUtil.setVdsConf(vds_config_str, VDSM_CONF_FILE) print "<BSTRAP component='VDS Configuration' status='OK'/>" except Exception, err: res = False print "<BSTRAP component='VDS Configuration' status='FAIL'" \ " message='%s'/>" % deployUtil.escapeXML(str(err)) deployUtil.setService("vdsmd", "reconfigure")
def main(): """Usage: vds_bootstrap_complete.py [-c vds_config_str] [-v <ver>] [-V] [-g] <random_num> [reboot]""" try: vds_config_str = None # FIXME: these flags are added for near future use installVirtualizationService = True installGlusterService = False opts, args = getopt.getopt(sys.argv[1:], "v:c:Vg") for o, v in opts: if o == "-v": deployUtil.setBootstrapInterfaceVersion(int(v)) if o == "-c": # it should looks like: # 'ssl=true;ksm_nice=5;images=/images/irsd' without white # spaces in it. vds_config_str = v if o == "-V": installVirtualizationService = False if o == "-g": installGlusterService = True logging.debug("installVirtualizationService = '%s', " "installGlusterService = '%s'" % (installVirtualizationService, installGlusterService)) rnum = args[0] except: print main.__doc__ return False try: arg = int(args[1]) except: arg = 1 res = True try: res = deployUtil.instCert(rnum, VDSM_CONF_FILE) if res: res = deployUtil.setCoreDumpPath() if res: res = deployUtil.cleanAll(rnum) if res: try: deployUtil.setVdsConf(vds_config_str, VDSM_CONF_FILE) print "<BSTRAP component='VDS Configuration' status='OK'/>" except Exception, err: res = False print "<BSTRAP component='VDS Configuration' status='FAIL'" \ " message='%s'/>" % deployUtil.escapeXML(str(err)) deployUtil.setService("vdsmd", "reconfigure")
def main(): """ Usage: vds_bootstrap.py [options] <url> <subject> <random_num> options: -v <bootstrap inteface version> - default 1 -O <organizationName> -t <systemTime> -f <firewall_rules_file> -- override firewall rules. -V - don't install virtualization service -g - install gluster service obsolete options: -r <rev_num> """ try: rev_num = None orgName = 'Red Hat Inc.' systime = None firewallRulesFile = None engine_ssh_key = None installVirtualizationService = True installGlusterService = False bridgeName = None opts, args = getopt.getopt(sys.argv[1:], "v:r:O:t:f:S:n:u:B:Vg") for o, v in opts: if o == "-v": deployUtil.setBootstrapInterfaceVersion(int(v)) if o == "-r": rev_num = v if o == "-O": orgName = v if o == "-t": systime = v if o == "-V": installVirtualizationService = False if o == "-g": installGlusterService = True elif o == '-f': firewallRulesFile = v NEEDED_SERVICES.append('iptables') elif o == '-S': engine_ssh_key = v elif o == '-B': bridgeName = v url = args[0] subject = args[1] random_num = args[2] # Where is REVISION defined ???? #if not rev_num: # rev_num = REVISION except: print main.__doc__ return False # # miniyum setup must be done first as process # is probably going to be reexecute with # proper selinux role # miniyum = None if deployUtil.getBootstrapInterfaceVersion() >= 2: try: from miniyum import MiniYum miniyumsink = myminiyumsink() MiniYum.setup_log_hook(sink=miniyumsink) extraLog = open(LOGFILE, "a") miniyum = MiniYum(sink=miniyumsink, extraLog=extraLog) miniyum.selinux_role() except: logging.error("MiniYum selinux setup failed", exc_info=True) print "<BSTRAP component='RHEV_INSTALL' status='FAIL'/>" return False logging.debug('**** Start VDS Validation ****') try: ret = VdsValidation( url, subject, random_num, rev_num, orgName, systime, firewallRulesFile, engine_ssh_key, installVirtualizationService, installGlusterService, bridgeName, miniyum ) except: logging.error("VDS validation failed", exc_info=True) logging.error(main.__doc__) logging.debug("<BSTRAP component='RHEV_INSTALL' status='FAIL'/>") print "<BSTRAP component='RHEV_INSTALL' status='FAIL'/>" return False else: message = ("<BSTRAP component='RHEV_INSTALL' status=") if ret: message += ("'OK'/>") else: message += ("'FAIL'/>") print(message) logging.debug(message) logging.debug('**** End VDS Validation ****') sys.stdout.flush() return ret
def main(): """ Usage: vds_bootstrap.py [options] <url> <subject> <random_num> options: -v <bootstrap inteface version> - default 1 -O <organizationName> -t <systemTime> -f <firewall_rules_file> -- override firewall rules. -V - don't install virtualization service -g - install gluster service obsolete options: -r <rev_num> """ try: rev_num = None orgName = 'Red Hat Inc.' systime = None firewallRulesFile = None engine_ssh_key = None installVirtualizationService = True installGlusterService = False bridgeName = None opts, args = getopt.getopt(sys.argv[1:], "v:r:O:t:f:S:n:u:B:Vg") for o, v in opts: if o == "-v": deployUtil.setBootstrapInterfaceVersion(int(v)) if o == "-r": rev_num = v if o == "-O": orgName = v if o == "-t": systime = v if o == "-V": installVirtualizationService = False if o == "-g": installGlusterService = True elif o == '-f': firewallRulesFile = v NEEDED_SERVICES.append('iptables') elif o == '-S': engine_ssh_key = v elif o == '-B': bridgeName = v url = args[0] subject = args[1] random_num = args[2] # Where is REVISION defined ???? # if not rev_num: # rev_num = REVISION except: print main.__doc__ return False # # miniyum setup must be done first as process # is probably going to be reexecute with # proper selinux role # miniyum = None if deployUtil.getBootstrapInterfaceVersion() >= 2: try: from miniyum import MiniYum miniyumsink = myminiyumsink() MiniYum.setup_log_hook(sink=miniyumsink) extraLog = open(LOGFILE, "a") miniyum = MiniYum(sink=miniyumsink, extraLog=extraLog) miniyum.selinux_role() except: logging.error("MiniYum selinux setup failed", exc_info=True) print "<BSTRAP component='RHEV_INSTALL' status='FAIL'/>" return False logging.debug('**** Start VDS Validation ****') try: ret = VdsValidation(url, subject, random_num, rev_num, orgName, systime, firewallRulesFile, engine_ssh_key, installVirtualizationService, installGlusterService, bridgeName, miniyum) except: logging.error("VDS validation failed", exc_info=True) logging.error(main.__doc__) logging.debug("<BSTRAP component='RHEV_INSTALL' status='FAIL'/>") print "<BSTRAP component='RHEV_INSTALL' status='FAIL'/>" return False else: message = ("<BSTRAP component='RHEV_INSTALL' status=") if ret: message += ("'OK'/>") else: message += ("'FAIL'/>") print(message) logging.debug(message) logging.debug('**** End VDS Validation ****') sys.stdout.flush() return ret