Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions coriolis/providers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,23 @@ def platform(self) -> str:
"""Platform type."""
raise NotImplementedError("Missing provider platform attribute.")

@classmethod
def supports_shared_disks(cls) -> bool:
"""Whether this provider supports shared (multi-writer) disks.

Destination import providers that can attach the same volume to
multiple instances (e.g. Libvirt ``<shareable/>``) should override
this to return ``True``. Defaults to ``False``.

In order to coordinate shared disk operations, the conductor will mark
one of the instances as owner of the shared disk.

As such, operations such as disk creation, deletion, resize or
data migration should be handled by tasks that are targeting the
owner instance.
"""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd also add the following since the ability to attach the volumes to multiple instances isn't all that's required on the provider side.

In order to coordinate shared disk operations, the conductor will mark one of the instances
as owner of the shared disk.

As such, operations such as disk creation, deletion, resize or data migration should be handled
by tasks that are targeting the owner instance.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

return False


class BaseEndpointProvider(BaseProvider):

Expand Down
9 changes: 9 additions & 0 deletions coriolis/tasks/replica_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,15 @@ def _run(self, ctxt, instance, origin, destination, task_info,
"Replica Import validation for destination platform "
"'%s'" % destination_type)

disks = export_info.get("devices", {}).get("disks") or []
if any(d.get("owner") and d.get("owner") != instance
for d in disks if d):
if not destination_provider.supports_shared_disks():
raise exception.NotSupportedOperation(
operation=(
"Destination platform '%s' does not support shared "
"disks" % destination_type))

target_environment = task_info["target_environment"]
self._validate_provider_replica_import_input(
destination_provider, ctxt, destination_connection_info,
Expand Down
Loading