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_complete.py [-c vds_config_str] [-v] [-g] <random_num> [reboot]""" try: vds_config_str = None #FIXME: these flags are added for near future use installVirtualizationService = False installGlusterService = False opts, args = getopt.getopt(sys.argv[1:], "c:vg") for o,v in opts: 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 = True if o == "-g": installGlusterService = True logging.debug("installVirtualizationService = '%s', installGlusterService = '%s'"%(installVirtualizationService, installGlusterService)) rnum = args[0] except: print main.__doc__ return 0 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: res = deployUtil.setVdsConf(vds_config_str, VDSM_CONF_FILE) deployUtil.setService("vdsmd", "reconfigure") except: logging.error('bootstrap complete failed', exc_info=True) res = False if res: print "<BSTRAP component='RHEV_INSTALL' status='OK'/>" sys.stdout.flush() Reboot(arg) else: print "<BSTRAP component='RHEV_INSTALL' status='FAIL'/>" sys.stdout.flush()
def main(): """Usage: vds_bootstrap_complete.py [-c vds_config_str] <random_num> [reboot]""" try: vds_config_str = None opts, args = getopt.getopt(sys.argv[1:], "c:") for o,v in opts: if o == "-c": # it should looks like: 'ssl=true;ksm_nice=5;images=/images/irsd' # without white spaces in it. vds_config_str = v rnum = args[0] except: print main.__doc__ return 0 try: arg = 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: res = deployUtil.setVdsConf(vds_config_str, VDSM_CONF_FILE) deployUtil.setService("vdsmd", "reconfigure") Reboot(arg) except: logging.error('bootstrap complete failed', exc_info=True) res = False if res: print "<BSTRAP component='RHEV_INSTALL' status='OK'/>" else: print "<BSTRAP component='RHEV_INSTALL' status='FAIL'/>" sys.stdout.flush()
def main(): """Usage: vds_bootstrap_complete.py [-c vds_config_str] <random_num> [reboot]""" try: vds_config_str = None opts, args = getopt.getopt(sys.argv[1:], "c:") for o, v in opts: if o == "-c": # it should looks like: 'ssl=true;ksm_nice=5;images=/images/irsd' # without white spaces in it. vds_config_str = v rnum = args[0] except: print main.__doc__ return 0 try: arg = 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: res = deployUtil.setVdsConf(vds_config_str, VDSM_CONF_FILE) deployUtil.setService("vdsmd", "reconfigure") Reboot(arg) except: logging.error('bootstrap complete failed', exc_info=True) res = False if res: print "<BSTRAP component='RHEV_INSTALL' status='OK'/>" else: print "<BSTRAP component='RHEV_INSTALL' status='FAIL'/>" sys.stdout.flush()
def main(): """ Usage: register-to-engine.py [-f | --force] [-p PORT | --port PORT] OVIRT_ENGINE """ port = None force = False try: opts, args = getopt.getopt(sys.argv[1:], "hfp:", ["help", "force", "port="]) if len(args) != 1: usage() sys.exit(USAGE_ERROR) newVdcHostName = args[0] for o, v in opts: if o in ("-h", "--help"): usage() sys.exit(SUCCESS) elif o in ("-p", "--port"): try: port = int(v) except ValueError: sys.stderr.write('invalid port: %s\n' % v) sys.exit(INVALID_PORT_ERROR) elif o in ("-f", "--force"): force = True except getopt.GetoptError as e: sys.stderr.write("ERROR: %s\n" % (e.msg)) usage() sys.exit(USAGE_ERROR) config.read(VDSM_REG_CONF_FILE) if not port: try: port = config.get('vars', 'vdc_host_port') except ConfigParser.NoOptionError: sys.stderr.write("Failed to retrieve port number " "from config file: %s\n" % VDSM_REG_CONF_FILE) sys.exit(CONF_FILE_READ_ERROR) try: vdcHostName = config.get('vars', 'vdc_host_name') except ConfigParser.NoOptionError: vdcHostName = None if not force and vdcHostName and "NONE" != vdcHostName.upper(): sys.stdout.write('Node already configured to Engine %s\n' % vdcHostName) sys.stdout.write('Do you want to reset and use %s (yes/NO): ' % newVdcHostName) ans = sys.stdin.readline() if "YES" != ans.strip().upper(): sys.exit(0) if not isHostReachable(newVdcHostName, port): if not isHostReachable(newVdcHostName, port, ssl=False): sys.stderr.write('Engine %s ' % newVdcHostName + ' is not reachable by HTTP or HTTPS\n') sys.exit(OVIRT_ENGINE_NOT_REACHABLE_ERROR) if not deployUtil.setVdsConf("vdc_host_name=%s" % newVdcHostName, VDSM_REG_CONF_FILE): sys.exit(CONF_FILE_WRITE_ERROR) if not deployUtil.setVdsConf("vdc_host_port=%s" % port, VDSM_REG_CONF_FILE): sys.exit(CONF_FILE_WRITE_ERROR) out, err, rv = deployUtil.setService("vdsm-reg", "restart") if rv != 0: sys.stderr.write("Failed to restart vdsm-reg service: ") sys.stderr.write("(%s, %s, %s)\n" % (rv, out, err)) sys.exit(VDSM_REG_RESTART_FAILED_ERROR) sys.exit(SUCCESS)