Skip to content

vm_manager: add import command for cluster mode#85

Open
dupremathieu wants to merge 1 commit intoseapath:mainfrom
dupremathieu:main
Open

vm_manager: add import command for cluster mode#85
dupremathieu wants to merge 1 commit intoseapath:mainfrom
dupremathieu:main

Conversation

@dupremathieu
Copy link
Member

Add import_vm() to bring an existing libvirt VM under cluster management by retrieving its XML, stripping disk devices, and delegating to create() for Ceph/Pacemaker registration. Expose it via the import subcommand in vm_manager_cmd with support for --new-name, --disk-bus, --progress and all standard create/clone options.

Add import_vm() to bring an existing libvirt VM under cluster management
by retrieving its XML, stripping disk devices, and delegating to
create() for Ceph/Pacemaker registration. Expose it via the import
subcommand in vm_manager_cmd with support for --new-name, --disk-bus,
--progress and all standard create/clone options.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Mathieu Dupré <mathieu.dupre@savoirfairelinux.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 9, 2026

Copy link
Member

@eroussy eroussy left a comment

Choose a reason for hiding this comment

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

Seems great

if "disable" in args and args.disable:
args.enable = not args.disable
else:
args.enable = True
Copy link
Member

Choose a reason for hiding this comment

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

Where do these arguments come from ? Where do the user configures the livemigration for the import command ?

if source is not None:
disk_path = source.get("file") or source.get("dev")
if disk_path:
vm_options["image"] = disk_path
Copy link
Member

Choose a reason for hiding this comment

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

Add a check here, to raise an exception if the VM has more than one disk.
It is possible to have more than one disk in standalone, but not in cluster for now.

Also be aware of this PR #84

add_colocation,
remove_pacemaker_remote,
add_pacemaker_remote,
import_vm,
Copy link
Member

Choose a reason for hiding this comment

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

This naming might be confusing, I think we can find a better one

  • move_to_cluster ?
  • add_to_cluster ?
  • migrate_to_cluster ?

import_to_cluster can also work, but It is confusing with importing configuration files or creating a VM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants