def _add_instances(self, ping, pong): if not utils.ping_include_instances(ping): return utils.ping_add_resources(pong, {"type": "hostUuid", "uuid": DockerConfig.docker_uuid()}) containers = [] running, nonrunning = self._get_all_containers_by_state() for key, container in running.iteritems(): self.add_container("running", container, containers) for key, container in nonrunning.iteritems(): self.add_container("stopped", container, containers) utils.ping_add_resources(pong, *containers) utils.ping_set_option(pong, "instances", True)
def _add_instances(self, ping, pong): if not utils.ping_include_instances(ping): return conn = LibvirtConnection.open(self.get_default_type()) vms = [] for vm in conn.listAllDomains(0): name = vm.name() if utils.is_uuid(name) and _is_running(conn, vm): vms.append({ 'type': 'instance', 'uuid': name, 'state': 'running' }) utils.ping_add_resources(pong, *vms) utils.ping_set_option(pong, 'instances', True)
def _add_instances(self, ping, pong): if not utils.ping_include_instances(ping): return utils.ping_add_resources(pong, { 'type': 'hostUuid', 'uuid': DockerConfig.docker_uuid() }) containers = [] running, nonrunning = self._get_all_containers_by_state() for key, container in running.iteritems(): self.add_container('running', container, containers) for key, container in nonrunning.iteritems(): self.add_container('stopped', container, containers) utils.ping_add_resources(pong, *containers) utils.ping_set_option(pong, 'instances', True)
def _add_instances(self, ping, pong): if not utils.ping_include_instances(ping): return containers = [] for c in docker_client().containers(): names = c.get('Names') if names is None: continue for name in names: if name.startswith('/'): name = name[1:] if utils.is_uuid(name): containers.append({ 'type': 'instance', 'uuid': name, 'state': 'running' }) utils.ping_add_resources(pong, *containers) utils.ping_set_option(pong, 'instances', True)