Marketplace Resource Identifiers
This document describes the identifier fields used in Waldur marketplace Resources and provides examples of how they work with OpenStack instances and volumes.
Identifier Fields Overview
The marketplace Resource model (src/waldur_mastermind/marketplace/models.py:1255) provides a comprehensive identifier system through various mixins and direct fields:
| Field | Type | Source | Purpose | Uniqueness | Notes |
|---|---|---|---|---|---|
id |
int |
Django AutoField | Primary key | Globally unique | Auto-incremented database ID |
uuid |
UUID |
UuidMixin | External API identifier | Globally unique | Used in REST API endpoints |
name |
CharField(150) |
NameMixin | Human-readable identifier | Per scope | Display name with validation |
slug |
SlugField |
SlugMixin | URL-friendly identifier | Per scope | Auto-generated from name |
backend_id |
CharField(255) |
BackendMixin | Backend system identifier | Per backend | External system mapping |
effective_id |
CharField(255) |
Resource | Remote Waldur identifier | Per remote system | Used for remote provisioning |
content_type |
ForeignKey |
ScopeMixin | Generic relation type | N/A | Part of generic foreign key |
object_id |
PositiveIntegerField |
ScopeMixin | Generic relation ID | N/A | Part of generic foreign key |
Identifier Categories
Internal Identification
id: Primary key for database operationsuuid: Public API identifier, used in REST endpoints like/api/marketplace-resources/{uuid}/
Human Identification
name: User-friendly display nameslug: URL-safe version of name for web interfaces
External Integration
backend_id: Maps to external system identifiers (e.g., OpenStack instance UUID)effective_id: Used when resource is provisioned through remote Waldur instances
Scope Linking
content_type/object_id: Generic foreign key linking to the underlying resource implementation
Examples with OpenStack Resources
OpenStack Instance Resource
When a marketplace Resource represents an OpenStack virtual machine (offering type "OpenStack.Instance"):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |
OpenStack Volume Resource
When a marketplace Resource represents an OpenStack volume (offering type "OpenStack.Volume"):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | |
Identifier Relationships
API Usage
- REST API endpoints use
uuid:/api/marketplace-resources/{uuid}/
Backend Synchronization
backend_idstores the OpenStack UUID for API calls to OpenStack- The linked scope object (Instance/Volume) also stores this UUID in its
backend_id - This creates a redundant but necessary mapping for efficient queries
Remote Provisioning
effective_idis used when resources are provisioned through remote Waldur instances- For local OpenStack resources, this field remains empty
- Enables federated deployments where one Waldur manages resources on another
Integration Guidelines
Slug Uniqueness and History
The slug field provides URL-friendly identifiers with specific uniqueness guarantees:
- Intended to be unique in history - When generating new slugs, Waldur considers both active and soft-deleted objects
- Soft deletion safe - Resources marked as deleted but not hard-deleted are still considered for slug uniqueness
- Hard deletion risk - Objects that are hard-deleted (e.g., Customer objects) can result in duplicate slugs in historical data
- Full historical uniqueness - Only UUIDs provide complete uniqueness guarantees across the entire system history
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
Project Slug Templates
Organizations can define custom slug templates for their projects via the project_slug_template field on the Customer model. When set, new projects auto-generate slugs using the template instead of the default name-based generation.
Configuration: Staff users set the template on a Customer via the API:
1 2 | |
The field is read-only for non-staff users but visible in API responses.
Supported placeholders:
| Placeholder | Description | Example |
|---|---|---|
{customer_slug} |
Organization slug | acme |
{project_name} |
Slugified project name | my-project |
{year} |
Current year (4-digit) | 2026 |
{month} |
Current month (2-digit) | 04 |
{counter} |
Sequential project number per organization | 3 |
{counter_padded} |
Zero-padded 3-digit counter | 003 |
Behavior:
- Slug is generated only on project creation when no slug is provided
- If a staff user provides a slug explicitly, it takes precedence over the template
- If the template is invalid or contains unknown placeholders, generation falls back to the default name-based slug
- Counter is scoped per customer (counts existing projects in the organization)
- Uniqueness is enforced globally; a numeric suffix is appended on collision
- The template can be changed at any time, even when projects exist
Examples:
| Template | Result (3rd project, customer slug csc) |
|---|---|
{customer_slug}-{counter_padded} |
csc-003 |
{customer_slug}-{year}{month}-{counter_padded} |
csc-202604-003 |
{project_name}-{counter} |
my-project-3 |
| (no template set) | Default: slugified project name, e.g. my-projec |
Backend ID Usage
The backend_id field serves as a bridge to external systems with specific characteristics:
- External system ownership - Set by external parties, not controlled by Waldur
- No uniqueness guarantees - Waldur makes no assumptions about backend_id uniqueness
- Discovery mechanism - Used to map Waldur resources to external system identifiers
- Integration flexibility - Allows multiple resources to share the same backend_id if the external system requires it
Integration Examples
Storage System Path Mapping
A common integration pattern where Waldur resources map to storage system paths:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
SLURM Account Integration
Integration with SLURM workload manager where accounts are managed externally:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
Backend ID Discovery Patterns
Common patterns for using backend_id in external integrations:
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
Best Practices
- Always use
uuidfor API operations - it's the stable public identifier - Use
backend_idfor backend system integration - direct mapping to external UUIDs - Leverage scope relationships - access the underlying resource through
resource.scope - Maintain identifier consistency - ensure
backend_idmatches the scope object's identifiers - Handle effective_id for federation - check this field when dealing with remote resources
- Consider slug history - When using slugs for external paths, account for soft-deletion behavior
- Design for backend_id flexibility - Don't assume uniqueness, allow for shared backend resources
- Document discovery patterns - Clearly define how external systems will query Waldur using backend_id