=====================
python-vmmsclient
=====================

Python client library and CLI plugin for the VM Migration Scheduler (VMMS) service.

Description
-----------

This package provides a Python client library and OpenStack CLI plugin for
interacting with the VM Migration Scheduler API. It allows users to schedule,
list, and manage virtual machine migrations through command-line interfaces
or programmatically.

Installation
------------

Install using pip::

    pip install python-vmmsclient

Prerequisites
-------------

- OpenStack environment with VMMS service deployed
- Valid OpenStack credentials
- python-openstackclient installed

CLI Usage
---------

Once installed, the vmms commands are available through the openstack CLI:

Add a VM for immediate migration::

    openstack vmms vm add <vm-id> <vm-name>

Add a VM for scheduled migration::

    openstack vmms vm add <vm-id> <vm-name> --schedule-time <ISO-timestamp>

List all VM migrations::

    openstack vmms vm list

Remove a VM migration::

    openstack vmms vm remove <migration-id>

Examples
--------

Add a VM for immediate migration::

    openstack vmms vm add 3d99ca07-92a2-4ff6-a0dc-2012adb57083 "my-test-vm"

Add a VM for scheduled migration::

    openstack vmms vm add 3d99ca07-92a2-4ff6-a0dc-2012adb57083 "scheduled-vm" \
        --schedule-time "2025-10-07T22:00:00Z"

List all migrations::

    openstack vmms vm list

Remove a migration::

    openstack vmms vm remove 123e4567-e89b-12d3-a456-426614174000

API Usage
---------

The client can also be used programmatically::

    from keystoneauth1.identity import v3
    from keystoneauth1 import session
    from vmmsclient.v2.client import Client

    # Create keystone session
    auth = v3.Password(auth_url='http://keystone:5000/v3',
                      username='admin',
                      password='password',
                      project_name='admin',
                      user_domain_name='Default',
                      project_domain_name='Default')
    sess = session.Session(auth=auth)

    # Create VMMS client
    client = Client(session=sess)

    # Add a VM migration
    migration = client.add_vm('vm-id', 'vm-name')

    # List migrations
    migrations = client.list_vms()

    # Remove a migration
    client.remove_vm('migration-id')

Development
-----------

Running tests::

    pip install -r test-requirements.txt
    stestr run

License
-------

Apache License, Version 2.0
