Skip to content

Volume class missing NFS mount fields (pseudo_path, mount_command, etc.) #78

@mtparet

Description

@mtparet

Problem

The Volume class in the SDK only exposes a limited subset of fields from the Verda API's volume response. Critical NFS mount-related fields are missing, which are essential for properly mounting shared NVMe volumes.

Missing Fields

When calling GET /v1/volumes/{volume_id}, the API returns these fields that are not exposed by the SDK's Volume class:

  • pseudo_path - Volume pseudo path for NFS export
  • mount_command - Ready-to-use NFS mount command
  • filesystem_to_fstab_command - fstab entry command
  • create_directory_command - mkdir command for mount point
  • instances - Array of attached instance details (not just instance_id)
  • Pricing fields: base_hourly_cost, monthly_price, currency
  • Contract details: contract, long_term

API Response Example

{
  "id": "ac9f666d-849f-4cdb-9a7b-b4e43317ef36",
  "name": "OS-NVMe-84Ca37Jf",
  "pseudo_path": "volume-84Ca37Jf",
  "mount_command": "mount -t nfs -o nconnect=16 nfs.fin-01.datacrunch.io:volume-88eb67d0 /mnt/volume",
  "create_directory_command": "mkdir -p /mnt/volume",
  "filesystem_to_fstab_command": "grep -qxF 'nfs.fin-01.datacrunch.io:volume-88eb67d0 /mnt/volume nfs defaults 0 0' /etc/fstab || echo '...' | sudo tee -a /etc/fstab",
  "instances": [...],
  ...
}

Current SDK Behavior

The Volume class (verda/volumes/_volumes.py) only includes:

  • id, status, name, size, type
  • is_os_volume, created_at, target, location
  • instance_id, ssh_key_ids, deleted_at

The VolumesService.create() method does call get_by_id() after creation, but the returned Volume object doesn't expose the NFS fields.

Impact

Users working with NVMe shared volumes need these fields to:

  1. Construct proper NFS mount points (pseudo_path)
  2. Automate volume mounting (mount_command, create_directory_command)
  3. Configure persistent mounts (filesystem_to_fstab_command)

Current Workaround

We're currently bypassing the SDK and making direct HTTP calls:

# Instead of:
volume = client.volumes.get_by_id(volume_id)  # Returns limited Volume object

# We use:
response = client._http_client.get(f"/volumes/{volume_id}")
volume_data = response.json()  # Full API response with all fields

Proposed Solution

Option 1: Add missing fields to the Volume class

class Volume:
    def __init__(self, ..., pseudo_path: str | None = None, 
                 mount_command: str | None = None, ...):
        self._pseudo_path = pseudo_path
        self._mount_command = mount_command
        ...
    
    @property
    def pseudo_path(self) -> str | None:
        return self._pseudo_path

Option 2: Add a method to access raw response data

class Volume:
    def __init__(self, raw_data: dict | None = None, ...):
        self._raw_data = raw_data
        ...
    
    def get_raw_data(self) -> dict:
        return self._raw_data

Option 3: Return both Volume object and raw dict

def get_by_id(self, id: str) -> tuple[Volume, dict]:
    volume_dict = self._http_client.get(f'/volumes/{id}').json()
    return (Volume.create_from_dict(volume_dict), volume_dict)

References

  • Verda API docs: GET /v1/volumes/{volume_id}
  • Related: Volume creation also needs the second GET request to populate these fields

Preference: Option 1 (add fields to Volume class) is cleanest and most type-safe.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions