def vir_list(args): old_verbose = app.options.verbose app.options.verbose = 2 try: for hostname in config.get_hosts(): server = config.host(hostname).get_front_ip() obj = ssh.Ssh(server, app.get_root_password()) app.print_verbose("List KVM guests on host " + hostname + " (" + server + ")") if (obj.is_alive()): obj.install_ssh_key() obj.ssh_exec("virsh list --all") else: app.print_verbose(" Not online.") except SettingsError, e: app.print_error(e, 2)
def test_config(self): self.assertEqual(config.get_servers(), ['syco-mysql-primary', 'syco-mysql-secondary', 'syco-install', 'syco-ldap', 'syco-vh01', 'syco-ntp']) self.assertEqual(config.get_hosts(), ['syco-vh01'])