def _create_log_dirs(self): data_dir = sh.joinpths(self.get_option("app_dir"), self.cfg.getdefaulted("swift", "data_location", "data")) cfg_dir = self.get_option("cfg_dir") log_dir = sh.joinpths(data_dir, LOG_DIR) self.tracewriter.dirs_made(*sh.mkdirslist(sh.joinpths(log_dir, "hourly"))) sh.symlink(sh.joinpths(cfg_dir, SYSLOG_CONF), SWIFT_RSYNC_LOC) self.tracewriter.symlink_made(SWIFT_RSYNC_LOC)
def _configure_symlinks(self): links = self.symlinks if not links: return 0 # This sort happens so that we link in the correct order # although it might not matter. Either way. We ensure that the right # order happens. Ie /etc/blah link runs before /etc/blah/blah link_srcs = sorted(links.keys()) link_srcs.reverse() link_nice = [] for source in link_srcs: links_to_be = links[source] for link in links_to_be: link_nice.append("%s => %s" % (link, source)) utils.log_iterable(link_nice, logger=LOG, header="Creating %s sym-links" % (len(link_nice))) links_made = 0 for source in link_srcs: links_to_be = links[source] for link in links_to_be: try: LOG.debug("Symlinking %s to %s.", link, source) sh.symlink(source, link, tracewriter=self.tracewriter) links_made += 1 except (IOError, OSError) as e: LOG.warn("Symlinking %s to %s failed: %s", colorizer.quote(link), colorizer.quote(source), e) return links_made
def _create_nodes(self): data_dir = sh.joinpths(self.get_option("app_dir"), self.cfg.getdefaulted("swift", "data_location", "data")) fs_dev = sh.joinpths(data_dir, DEVICE_PATH) for i in range(1, 5): self.tracewriter.dirs_made(sh.mkdirslist(sh.joinpths(fs_dev, "%d/node" % i))) link_tgt = sh.joinpths(data_dir, str(i)) sh.symlink(sh.joinpths(fs_dev, str(i)), link_tgt) self.tracewriter.symlink_made(link_tgt) start_port = 6010 + (i - 1) * 5 self._create_node_config(i, start_port) self._delete_templates()
def _fix_virt(self): virt_driver = nhelper.canon_virt_driver(self.get_option("virt_driver")) if virt_driver == "libvirt": virt_type = lv.canon_libvirt_type(self.get_option("libvirt_type")) if virt_type == "qemu": # On RHEL it appears a sym-link needs to be created # to enable qemu to actually work, apparently fixed # in RHEL 6.4. # # See: http://fedoraproject.org/wiki/Getting_started_with_OpenStack_EPEL if not sh.isfile("/usr/bin/qemu-system-x86_64"): sh.symlink("/usr/libexec/qemu-kvm", "/usr/bin/qemu-system-x86_64", tracewriter=self.tracewriter)
def _fix_virt(self): virt_driver = utils.canon_virt_driver(self.get_option('virt_driver')) if virt_driver == 'libvirt': virt_type = lv.canon_libvirt_type(self.get_option('libvirt_type')) if virt_type == 'qemu': # On RHEL it appears a sym-link needs to be created # to enable qemu to actually work, apparently fixed # in RHEL 6.4. # # See: http://fedoraproject.org/wiki/Getting_started_with_OpenStack_EPEL if not sh.isfile('/usr/bin/qemu-system-x86_64'): sh.symlink('/usr/libexec/qemu-kvm', '/usr/bin/qemu-system-x86_64', tracewriter=self.tracewriter)
def _install(self, pkg): yum.YumPackager._install(self, pkg) options = pkg.get('packager_options', {}) links = options.get('links', []) for entry in links: src = entry['source'] tgt = entry['target'] if not sh.islink(tgt): # This is actually a feature, EPEL must not conflict # with RHEL, so X pkg installs newer version in # parallel. # # This of course doesn't work when running from git # like anvil does.... sh.symlink(src, tgt) return True
def _install(self, pkg): yum.YumPackager._install(self, pkg) options = pkg.get('packager_options') or {} links = options.get('links') or [] for entry in links: tgt = entry.get('target') src = entry.get('source') if not tgt or not src: continue src = glob.glob(src) if not isinstance(tgt, (list, tuple)): tgt = [tgt] if len(src) != len(tgt): raise RuntimeError("Unable to link %s sources to %s locations" % (len(src), len(tgt))) for i in range(len(src)): i_src = src[i] i_tgt = tgt[i] if not sh.islink(i_tgt): sh.symlink(i_src, i_tgt)
def _configure_symlinks(self): links = self._get_symlinks() # This sort happens so that we link in the correct order # although it might not matter. Either way. We ensure that the right # order happens. Ie /etc/blah link runs before /etc/blah/blah link_srcs = sorted(links.keys()) link_srcs.reverse() links_made = 0 for source in link_srcs: link = links.get(source) try: LOG.info("Symlinking %s to %s.", colorizer.quote(link), colorizer.quote(source)) self.tracewriter.dirs_made(*sh.symlink(source, link)) self.tracewriter.symlink_made(link) links_made += 1 except OSError as e: LOG.warn("Symlinking %s to %s failed: %s", colorizer.quote(link), colorizer.quote(source), e) return links_made
def _turn_on_rsync(self): sh.symlink(sh.joinpths(self.get_option("cfg_dir"), RSYNC_CONF), RSYNCD_CONF_LOC) self.tracewriter.symlink_made(RSYNCD_CONF_LOC) sh.replace_in(RSYNC_CONF_LOC, RSYNC_ON_OFF_RE, "RSYNC_ENABLE=true", True)
def create_symlink_to_conf_file(self): sh.symlink(self.configurator.path_to_plugin_config, "/etc/neutron/plugin.ini", force=True)
def create_symlink_to_conf_file(self): sh.symlink(self.configurator.get_path_to_plugin_config, "/etc/quantum/plugin.ini", force=True)