Example #1
0
 def _fake_reconciler_instance(self,
                               uuid=INSTANCE_ID_1,
                               launched_at=None,
                               deleted_at=None,
                               deleted=False,
                               instance_type_id=INSTANCE_TYPE_ID_1,
                               instance_flavor_id=INSTANCE_FLAVOR_ID_1,
                               tenant=TENANT_ID_1,
                               os_arch=DEFAULT_OS_ARCH,
                               os_distro=DEFAULT_OS_DISTRO,
                               os_verison=DEFAULT_OS_VERSION,
                               rax_options=DEFAULT_RAX_OPTIONS):
     instance = rec_utils.empty_reconciler_instance()
     instance.update({
         'id': uuid,
         'launched_at': launched_at,
         'deleted_at': deleted_at,
         'deleted': deleted,
         'instance_type_id': instance_type_id,
         'instance_flavor_id': instance_flavor_id,
         'tenant': tenant,
         'os_architecture': os_arch,
         'os_distro': os_distro,
         'os_version': os_verison,
         'rax_options': rax_options,
     })
     return instance
Example #2
0
    def _to_reconciler_instance(self, instance):
        r_instance = empty_reconciler_instance()
        r_instance.update({
            'id': instance['uuid'],
            'instance_type_id': instance['instance_type_id'],
        })

        if instance['launched_at'] is not None:
            launched_at = stackutils.str_time_to_unix(instance['launched_at'])
            r_instance['launched_at'] = launched_at

        if instance['terminated_at'] is not None:
            deleted_at = stackutils.str_time_to_unix(instance['terminated_at'])
            r_instance['deleted_at'] = deleted_at

        if instance['deleted'] != 0:
            r_instance['deleted'] = True

        return r_instance
 def _fake_reconciler_instance(self, uuid=INSTANCE_ID_1, launched_at=None,
                               deleted_at=None, deleted=False,
                               instance_type_id=1, tenant=TENANT_ID_1,
                               os_arch=DEFAULT_OS_ARCH,
                               os_distro=DEFAULT_OS_DISTRO,
                               os_verison=DEFAULT_OS_VERSION,
                               rax_options=DEFAULT_RAX_OPTIONS):
     instance = rec_utils.empty_reconciler_instance()
     instance.update({
         'id': uuid,
         'launched_at': launched_at,
         'deleted_at': deleted_at,
         'deleted': deleted,
         'instance_type_id': instance_type_id,
         'tenant': tenant,
         'os_architecture': os_arch,
         'os_distro': os_distro,
         'os_version': os_verison,
         'rax_options': rax_options,
     })
     return instance
Example #4
0
    def _to_reconciler_instance(self, instance, metadata=None):
        r_instance = empty_reconciler_instance()
        r_instance.update({
            'id': instance['uuid'],
            'tenant': instance['project_id'],
            'instance_type_id': str(instance['instance_type_id']),
        })

        if instance['launched_at'] is not None:
            launched_at = stackutils.str_time_to_unix(instance['launched_at'])
            r_instance['launched_at'] = launched_at

        if instance['terminated_at'] is not None:
            deleted_at = stackutils.str_time_to_unix(instance['terminated_at'])
            r_instance['deleted_at'] = deleted_at

        if instance['deleted'] != 0:
            r_instance['deleted'] = True

        if metadata is not None:
            r_instance.update(metadata)

        return r_instance
Example #5
0
    def _to_reconciler_instance(self, instance, metadata=None):
        r_instance = empty_reconciler_instance()
        r_instance.update({
            'id': instance['uuid'],
            'tenant': instance['project_id'],
            'instance_type_id': str(instance['instance_type_id']),
            'instance_flavor_id': str(instance['flavorid']),
        })

        if instance['launched_at'] is not None:
            launched_at = stackutils.str_time_to_unix(instance['launched_at'])
            r_instance['launched_at'] = launched_at

        if instance['terminated_at'] is not None:
            deleted_at = stackutils.str_time_to_unix(instance['terminated_at'])
            r_instance['deleted_at'] = deleted_at

        if instance['deleted'] != 0:
            r_instance['deleted'] = True

        if metadata is not None:
            r_instance.update(metadata)

        return r_instance