]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
Handle VMs missing consoles safely
authorZack Cerza <zack@redhat.com>
Fri, 6 Jan 2017 20:01:42 +0000 (13:01 -0700)
committerZack Cerza <zack@redhat.com>
Fri, 24 Feb 2017 16:03:33 +0000 (09:03 -0700)
Signed-off-by: Zack Cerza <zack@redhat.com>
teuthology/nuke/__init__.py
teuthology/nuke/actions.py
teuthology/orchestra/console.py
teuthology/orchestra/remote.py

index 605072d7ae539f794886ab51f548014d8a521983..987765c44cd3ee0c16b21668577bcb87d6f9f210 100644 (file)
@@ -294,11 +294,7 @@ def nuke_helper(ctx, should_unlock):
     host = target.split('@')[-1]
     shortname = host.split('.')[0]
     if should_unlock:
-        if 'vpm' in shortname:
-            return
-        status_info = get_status(host)
-        if is_vm(status=status_info) and \
-                status_info['machine_type'] == 'openstack':
+        if is_vm(shortname):
             return
     log.debug('shortname: %s' % shortname)
     log.debug('{ctx}'.format(ctx=ctx))
index 6b37fea9782f69cc0c8670e13736e9beb169a03a..deaa1fff9876bdcf0a4ae2d08640a5722dfccb03 100644 (file)
@@ -411,6 +411,8 @@ def check_console(hostname):
     remote = Remote(hostname)
     shortname = remote.shortname
     console = remote.console
+    if not console:
+        return
     cname = '{host}.{domain}'.format(
         host=shortname,
         domain=console.ipmidomain,
index f12b4cacb1c6252d83d3c011c34fed2ebc1eec03..c59c366531464d9a7d820f5e2c57f3c4fb74b5d3 100644 (file)
@@ -322,7 +322,7 @@ class VirtualConsole():
             if teuthology.lock.query.is_vm(status=status_info):
                 phys_host = status_info['vm_host']['name'].split('.')[0]
         except TypeError:
-            return
+            raise RuntimeError("Cannot create a virtual console for %s", name)
         self.connection = libvirt.open(phys_host)
         for i in self.connection.listDomainsID():
             d = self.connection.lookupByID(i)
index 572f4ad31545f07ffe87e9d29ab52fd173ab6d7c..441ece30a7823540f4b53b48b547a0b3eb17ea1e 100644 (file)
@@ -471,6 +471,9 @@ def getRemoteConsole(name, ipmiuser=None, ipmipass=None, ipmidomain=None,
     Return either VirtualConsole or PhysicalConsole depending on name.
     """
     if teuthology.lock.query.is_vm(name):
-        return console.VirtualConsole(name)
+        try:
+            return console.VirtualConsole(name)
+        except Exception:
+            return None
     return console.PhysicalConsole(
         name, ipmiuser, ipmipass, ipmidomain, logfile, timeout)