def parseExistingInstallation(self): results = {} if len(self.nodelist.getElementsByTagName('existing-installation')) == 0: raise AnswerfileError, "No existing installation specified." ei = getText(self.nodelist.getElementsByTagName('existing-installation')[0].childNodes) if ei.startswith('iscsi:'): # ei is a rfc4173 spec identifying a LUN in the iBFT. # We should be logged into this already. # Convert this spec into a disk location. disk = diskutil.rfc4173_to_disk(ei) else: disk = normalize_disk(ei) # If answerfile names a multipath replace with the master! master = disktools.getMpathMaster(disk) if master: disk = master results['primary-disk'] = disk installations = product.findXenSourceProducts() installations = filter(lambda x: x.primary_disk == disk or diskutil.idFromPartition(x.primary_disk) == disk, installations) if len(installations) == 0: raise AnswerfileError, "Could not locate the installation specified to be reinstalled." elif len(installations) > 1: xelogging.log("Warning: multiple paths detected - recommend use of --device_mapper_multipath=yes") xelogging.log("Warning: selecting 1st path from %s" % str(map(lambda x: x.primary_disk, installations))) results['installation-to-overwrite'] = installations[0] return results
def parseExistingInstallation(self): results = {} inst = getElementsByTagName(self.top_node, ['existing-installation'], mandatory=True) disk = normalize_disk(getText(inst[0])) xelogging.log("Normalized disk: %s" % disk) disk = disktools.getMpathMasterOrDisk(disk) xelogging.log('Primary disk: ' + disk) results['primary-disk'] = disk installations = product.findXenSourceProducts() installations = filter( lambda x: x.primary_disk == disk or diskutil.idFromPartition( x.primary_disk) == disk, installations) if len(installations) == 0: raise AnswerfileException, "Could not locate the installation specified to be reinstalled." elif len(installations) > 1: # FIXME non-multipath case? xelogging.log( "Warning: multiple paths detected - recommend use of --device_mapper_multipath=yes" ) xelogging.log("Warning: selecting 1st path from %s" % str(map(lambda x: x.primary_disk, installations))) results['installation-to-overwrite'] = installations[0] return results
def main(args): xcp.logger.openLog(sys.stdout) xelogging.openLog(sys.stdout) dest_url = None answer_device = 'all' answer_config = 'dhcp' init_network = False reboot = False xelogging.log("Command line args: %s" % str(args)) for (opt, val) in args.items(): if opt in ['--answerfile_device', '--network_device']: answer_device = val.lower() init_network = True elif opt == '--network_config': answer_config = val.lower() elif opt == "--reboot": reboot = True elif opt == "--dest": dest_url = val if init_network: configureNetworking(answer_device, answer_config) # probe for XS installations insts = product.findXenSourceProducts() if len(insts) == 0: xcp.logger.log("No installations found.") return if not dest_url: xcp.logger.log("Destination directory not specified.") return for inst in insts: xcp.logger.log(str(inst)) bugtool(inst, dest_url) return reboot
def main(args): xcp.logger.openLog(sys.stdout) xelogging.openLog(sys.stdout) dest_url = None answer_device = 'all' answer_config = 'dhcp' init_network = False reboot = False xelogging.log("Command line args: %s" % str(args)) for (opt, val) in args.items(): if opt in ['--answerfile_device', '--network_device']: answer_device = val.lower() init_network = True elif opt == '--network_config': answer_config = val.lower() elif opt == "--reboot": reboot = True elif opt == "--dest": dest_url = val if init_network: configureNetworking(answer_device, answer_config) # probe for XS installations insts = product.findXenSourceProducts() if len(insts) == 0: xcp.logger.log("No XenServer installations found.") return if not dest_url: xcp.logger.log("Destination directory not specified.") return for inst in insts: xcp.logger.log(str(inst)) bugtool(inst, dest_url) return reboot