def main(): args = build_parser().parse_args() logging_lvl = logging.INFO if args.verbose: logging_lvl = logging.DEBUG log.logToSyslog(level=logging_lvl) if not network_backend_is_openvswitch(): log.info('Network backend type is not openvswitch, no need to inject query') sys.exit(0) inject_to_vifs(args)
os.rmdir(get_cg_dir(domid)) except OSError as e: # log and continue log.error("Failed to remove cgroup qemu-{}: {}" .format(domid, str(e))) # umount /dev, /sys from chroot directory if they are mounted. root_dir = get_root_dir(domid) dev_dir = root_dir + "/dev" sys_dir = root_dir + "/sys" if os.path.isdir(dev_dir + "/bus"): umount(dev_dir) if os.path.isdir(sys_dir + "/devices"): umount(sys_dir) if __name__ == "__main__": log.logToSyslog(level=logging.DEBUG) arg = parse_arg() if "attach" == arg.command: attach(arg.device, arg.domid, arg.pid, arg.reset_only) elif "detach" == arg.command: detach(arg.device, arg.domid) elif "cleanup" == arg.command: cleanup(arg.domid) else: log.error("Unexpected command: {}".format(arg.command)) exit(1)
os.rmdir(get_cg_dir(domid)) except OSError as e: # log and continue log.error("Failed to remove cgroup qemu-{}: {}".format( domid, str(e))) # umount /dev, /sys from chroot directory if they are mounted. root_dir = get_root_dir(domid) dev_dir = root_dir + "/dev" sys_dir = root_dir + "/sys" if os.path.isdir(dev_dir + "/bus"): umount(dev_dir) if os.path.isdir(sys_dir + "/devices"): umount(sys_dir) if __name__ == "__main__": log.logToSyslog(level=logging.DEBUG) arg = parse_arg() if "attach" == arg.command: attach(arg.device, arg.domid, arg.pid, arg.reset_only) elif "detach" == arg.command: detach(arg.device, arg.domid) elif "cleanup" == arg.command: cleanup(arg.domid) else: log.error("Unexpected command: {}".format(arg.command)) exit(1)