'Group all instances'

def group_instances(self):

    groups = defaultdict(list)
    meta = {'hostvars': {}}
    for node in self.driver.vms.list():
        assert isinstance(node, params.VM)
        name = node.get_name()
        meta['hostvars'][name] = self.node_to_dict(node)
        zone = node.get_cluster().get_name()
        groups[zone].append(name)
        tags = self.get_tags(node)
        for t in tags:
            tag = ('tag_%s' % t)
            groups[tag].append(name)
        nets = [x.get_name() for x in node.get_nics().list()]
        for net in nets:
            net = ('network_%s' % net)
            groups[net].append(name)
        status = node.get_status().get_state()
        stat = ('status_%s' % status.lower())
        if (stat in groups):
            groups[stat].append(name)
        else:
            groups[stat] = [name]
    groups['_meta'] = meta
    return groups
