def make_base_filesystem(suite, name, cfg=None, size=3000, mkfs='mke2fs'): if cfg is None: cfg = UmlConfig() bfpath = path(cfg.get('umlmachines', 'bootstrap_basepath')) / name bfpath = bfpath.expand() #path = join(cfg.get('umlmachines', 'bootstrap_basepath'), name) dirname = bfpath.dirname() print 'bfpath dirname', dirname makepaths(dirname) create_sparse_file(bfpath, size=size) return bfpath
def run(machine, init=None): cfg = UmlConfig(machine) u = UmlRunner(cfg) u.set(machine) if init is not None: u.options['init'] = init u.run()
def backup(machine): cfg = UmlConfig(machine) basefile = cfg['basefile'] backup = UmlChroot(cfg) backup.set_targetimage(basefile) backup.options['backup_target'] = machine backup.options['paella_action'] = 'backup' backup.run_uml()
def __init__(self, suite, rootimage=None, cfg=None): if rootimage is None: rootimage = suite + '.base' if cfg is None: cfg = UmlConfig() UmlChroot.__init__(self, cfg) self.set_targetimage(rootimage) o = self.options o['paellasuite'] = suite o['paella_action'] = 'bootstrap'
def install(machine, backup_=False, basefile=None): cfg = UmlConfig(machine) ui = UmlInstaller(cfg=cfg) u = UmlRunner(cfg) if basefile is None: basefile = cfg['basefile'] ui.install_profile(cfg['profile'], basefile) if backup_: backup(machine) u.set(machine) return u
def extract(tarball, basefile=None, size=None): cfg = UmlConfig() u = UmlChroot(cfg) u.options['paella_system_tarball'] = tarball u.options['paella_action'] = 'extract' u.options['devfs'] = 'mount' u.set_targetimage(basefile) if size is None: size = cfg['basefile_size'] create_sparse_file(basefile, size=size) u.run_uml()
def bootstrap_base(suite, path, cfg=None, size=3000, mkfs='mke2fs'): cfg = UmlConfig() makepaths(dirname(path)) create_sparse_file(path, size=size) uml = UmlBootstrapper(suite, path, cfg=cfg) uml.run_uml()
os.system(tarcmd) os.system('umount /mnt') def backup_target(self, name): self.check_guest() fs = self.cfg.get('umlmachines', 'backup_filesystem') if fs == 'nfs': self.backup_target_nfs(name) elif fs == 'hostfs': self.backup_target_hostfs(name) else: raise Error, 'unsupported backup filesystem' def mkrootfs(self): self.check_guest() mkrootfs() def extract_root_tarball(self, basetarball): self.check_guest() extract_tarball(self.target, basetarball) def setup_target(self, target='/tmp/target', device='/dev/ubd/1'): self.check_guest() self.set_target(target) setup_target(self.target, device=device) if __name__ == '__main__': c = UmlConfig() u = UmlChroot(c)
def _make_config(self, machine): return UmlConfig(machine)