def get_instance(self, instance_id):
        try:
            nova = self.nova_client
            cinder = self.cinder_client

            instance = nova.servers.get(instance_id)
            try:
                attached_volume_ids = [v.volumeId for v in nova.volumes.get_server_volumes(instance_id)]
                if len(attached_volume_ids) != 2:
                    raise OpenStackBackendError('Only instances with 2 volumes are supported')

                for volume_id in attached_volume_ids:
                    volume = cinder.volumes.get(volume_id)
                    # Blessed be OpenStack developers for returning booleans as strings
                    if volume.bootable == 'true':
                        system_volume = volume
                    elif volume.bootable == 'false':
                        data_volume = volume

                flavor = nova.flavors.get(instance.flavor['id'])
                cores = flavor.vcpus
                ram = flavor.ram

                ips = {}
                for net_conf in instance.addresses.values():
                    for ip in net_conf:
                        if ip['OS-EXT-IPS:type'] == 'fixed':
                            ips['internal'] = ip['addr']
                        if ip['OS-EXT-IPS:type'] == 'floating':
                            ips['external'] = ip['addr']

            except nova_exceptions.ClientException as e:
                logger.exception("Failed to lookup instance %s information", instance_id)
                six.reraise(OpenStackBackendError, e)

            try:
                d = dateparse.parse_datetime(instance.to_dict()['OS-SRV-USG:launched_at'])
            except (__HOLE__, ValueError):
                launch_time = None
            else:
                # At the moment OpenStack does not provide any timezone info,
                # but in future it might do.
                if timezone.is_naive(d):
                    launch_time = timezone.make_aware(d, timezone.utc)

            instance.nc_model_data = dict(
                name=instance.name or instance.id,
                key_name=instance.key_name or '',
                start_time=launch_time,
                state=self._get_instance_state(instance),
                created=dateparse.parse_datetime(instance.created),

                cores=cores,
                ram=ram,
                disk=self.gb2mb(system_volume.size + data_volume.size),

                system_volume_id=system_volume.id,
                system_volume_size=self.gb2mb(system_volume.size),
                data_volume_id=data_volume.id,
                data_volume_size=self.gb2mb(data_volume.size),

                internal_ips=ips.get('internal', ''),
                external_ips=ips.get('external', ''),

                security_groups=[sg['name'] for sg in instance.security_groups],
            )
        except (glance_exceptions.ClientException,
                cinder_exceptions.ClientException,
                nova_exceptions.ClientException,
                neutron_exceptions.NeutronClientException) as e:
            six.reraise(OpenStackBackendError, e)

        return instance
dataset/ETHPy150Open opennode/nodeconductor/nodeconductor/openstack/backend.py/OpenStackBackend.get_instance