Compare commits

..

No commits in common. "5b2e679db0a9e4ac704618d614337060295a0e8d" and "4a0680b27fea6e26cb008a72640c5ff12f482d6a" have entirely different histories.

6 changed files with 858 additions and 1321 deletions

View File

@ -3194,23 +3194,7 @@ class API_VM_Snapshot(Resource):
id: Message id: Message
""" """
snapshot_name = reqargs.get("snapshot_name", None) snapshot_name = reqargs.get("snapshot_name", None)
return api_helper.create_vm_snapshot(vm, snapshot_name=snapshot_name)
task = run_celery_task(
"vm.create_snapshot",
domain=vm,
snapshot_name=snapshot_name,
run_on="primary",
)
return (
{
"task_id": task.id,
"task_name": "vm.create_snapshot",
"run_on": f"{get_primary_node()} (primary)",
},
202,
{"Location": Api.url_for(api, API_Tasks_Element, task_id=task.id)},
)
@RequestParser( @RequestParser(
[ [
@ -3252,23 +3236,7 @@ class API_VM_Snapshot(Resource):
id: Message id: Message
""" """
snapshot_name = reqargs.get("snapshot_name", None) snapshot_name = reqargs.get("snapshot_name", None)
return api_helper.remove_vm_snapshot(vm, snapshot_name)
task = run_celery_task(
"vm.remove_snapshot",
domain=vm,
snapshot_name=snapshot_name,
run_on="primary",
)
return (
{
"task_id": task.id,
"task_name": "vm.remove_snapshot",
"run_on": f"{get_primary_node()} (primary)",
},
202,
{"Location": Api.url_for(api, API_Tasks_Element, task_id=task.id)},
)
api.add_resource(API_VM_Snapshot, "/vm/<vm>/snapshot") api.add_resource(API_VM_Snapshot, "/vm/<vm>/snapshot")
@ -3316,23 +3284,7 @@ class API_VM_Snapshot_Rollback(Resource):
id: Message id: Message
""" """
snapshot_name = reqargs.get("snapshot_name", None) snapshot_name = reqargs.get("snapshot_name", None)
return api_helper.rollback_vm_snapshot(vm, snapshot_name)
task = run_celery_task(
"vm.rollback_snapshot",
domain=vm,
snapshot_name=snapshot_name,
run_on="primary",
)
return (
{
"task_id": task.id,
"task_name": "vm.rollback_snapshot",
"run_on": f"{get_primary_node()} (primary)",
},
202,
{"Location": Api.url_for(api, API_Tasks_Element, task_id=task.id)},
)
api.add_resource(API_VM_Snapshot_Rollback, "/vm/<vm>/snapshot/rollback") api.add_resource(API_VM_Snapshot_Rollback, "/vm/<vm>/snapshot/rollback")
@ -3402,24 +3354,8 @@ class API_VM_Snapshot_Export(Resource):
snapshot_name = reqargs.get("snapshot_name", None) snapshot_name = reqargs.get("snapshot_name", None)
export_path = reqargs.get("export_path", None) export_path = reqargs.get("export_path", None)
incremental_parent = reqargs.get("incremental_parent", None) incremental_parent = reqargs.get("incremental_parent", None)
return api_helper.export_vm_snapshot(
task = run_celery_task( vm, snapshot_name, export_path, incremental_parent
"vm.export_snapshot",
domain=vm,
snapshot_name=snapshot_name,
export_path=export_path,
incremental_parent=incremental_parent,
run_on="primary",
)
return (
{
"task_id": task.id,
"task_name": "vm.export_snapshot",
"run_on": f"{get_primary_node()} (primary)",
},
202,
{"Location": Api.url_for(api, API_Tasks_Element, task_id=task.id)},
) )
@ -3491,24 +3427,8 @@ class API_VM_Snapshot_Import(Resource):
snapshot_name = reqargs.get("snapshot_name", None) snapshot_name = reqargs.get("snapshot_name", None)
import_path = reqargs.get("import_path", None) import_path = reqargs.get("import_path", None)
retain_snapshot = bool(strtobool(reqargs.get("retain_snapshot", "True"))) retain_snapshot = bool(strtobool(reqargs.get("retain_snapshot", "True")))
return api_helper.import_vm_snapshot(
task = run_celery_task( vm, snapshot_name, import_path, retain_snapshot
"vm.import_snapshot",
domain=vm,
snapshot_name=snapshot_name,
import_path=import_path,
retain_snapshot=retain_snapshot,
run_on="primary",
)
return (
{
"task_id": task.id,
"task_name": "vm.import_snapshot",
"run_on": f"{get_primary_node()} (primary)",
},
202,
{"Location": Api.url_for(api, API_Tasks_Element, task_id=task.id)},
) )

View File

@ -1758,7 +1758,7 @@ def cli_vm_flush_locks(domain, wait_flag):
NOTE: This is a task-based command. The "--wait" flag (default) will block and show progress. Specifying the "--no-wait" flag will return immediately with a job ID instead, which can be queried externally later. NOTE: This is a task-based command. The "--wait" flag (default) will block and show progress. Specifying the "--no-wait" flag will return immediately with a job ID instead, which can be queried externally later.
""" """
retcode, retmsg = pvc.lib.vm.vm_locks(CLI_CONFIG, domain, wait_flag=wait_flag) retcode, retmsg = pvc.lib.vm.vm_locks(CLI_CONFIG, domain, wait_flag)
if retcode and wait_flag: if retcode and wait_flag:
retmsg = wait_for_celery_task(CLI_CONFIG, retmsg) retmsg = wait_for_celery_task(CLI_CONFIG, retmsg)
@ -1787,15 +1787,7 @@ def cli_vm_snapshot():
@connection_req @connection_req
@click.argument("domain") @click.argument("domain")
@click.argument("snapshot_name", required=False, default=None) @click.argument("snapshot_name", required=False, default=None)
@click.option( def cli_vm_snapshot_create(domain, snapshot_name):
"--wait/--no-wait",
"wait_flag",
is_flag=True,
default=True,
show_default=True,
help="Wait or don't wait for task to complete, showing progress",
)
def cli_vm_snapshot_create(domain, snapshot_name, wait_flag):
""" """
Create a snapshot of the disks and XML configuration of virtual machine DOMAIN, with the Create a snapshot of the disks and XML configuration of virtual machine DOMAIN, with the
optional name SNAPSHOT_NAME. DOMAIN may be a UUID or name. optional name SNAPSHOT_NAME. DOMAIN may be a UUID or name.
@ -1805,12 +1797,18 @@ def cli_vm_snapshot_create(domain, snapshot_name, wait_flag):
VM at the moment of the snapshot. VM at the moment of the snapshot.
""" """
retcode, retmsg = pvc.lib.vm.vm_create_snapshot( echo(
CLI_CONFIG, domain, snapshot_name=snapshot_name, wait_flag=wait_flag CLI_CONFIG,
f"Taking snapshot of VM '{domain}'... ",
newline=False,
) )
retcode, retmsg = pvc.lib.vm.vm_create_snapshot(
if retcode and wait_flag: CLI_CONFIG, domain, snapshot_name=snapshot_name
retmsg = wait_for_celery_task(CLI_CONFIG, retmsg) )
if retcode:
echo(CLI_CONFIG, "done.")
else:
echo(CLI_CONFIG, "failed.")
finish(retcode, retmsg) finish(retcode, retmsg)
@ -1821,27 +1819,23 @@ def cli_vm_snapshot_create(domain, snapshot_name, wait_flag):
@connection_req @connection_req
@click.argument("domain") @click.argument("domain")
@click.argument("snapshot_name") @click.argument("snapshot_name")
@click.option(
"--wait/--no-wait",
"wait_flag",
is_flag=True,
default=True,
show_default=True,
help="Wait or don't wait for task to complete, showing progress",
)
@confirm_opt("Remove shapshot {snapshot_name} of VM {domain}") @confirm_opt("Remove shapshot {snapshot_name} of VM {domain}")
def cli_vm_snapshot_remove(domain, snapshot_name, wait_flag): def cli_vm_snapshot_remove(domain, snapshot_name):
""" """
Remove the snapshot SNAPSHOT_NAME of the disks and XML configuration of virtual machine DOMAIN, Remove the snapshot SNAPSHOT_NAME of the disks and XML configuration of virtual machine DOMAIN,
DOMAIN may be a UUID or name. DOMAIN may be a UUID or name.
""" """
retcode, retmsg = pvc.lib.vm.vm_remove_snapshot( echo(
CLI_CONFIG, domain, snapshot_name, wait_flag=wait_flag CLI_CONFIG,
f"Removing snapshot '{snapshot_name}' of VM '{domain}'... ",
newline=False,
) )
retcode, retmsg = pvc.lib.vm.vm_remove_snapshot(CLI_CONFIG, domain, snapshot_name)
if retcode and wait_flag: if retcode:
retmsg = wait_for_celery_task(CLI_CONFIG, retmsg) echo(CLI_CONFIG, "done.")
else:
echo(CLI_CONFIG, "failed.")
finish(retcode, retmsg) finish(retcode, retmsg)
@ -1854,29 +1848,25 @@ def cli_vm_snapshot_remove(domain, snapshot_name, wait_flag):
@connection_req @connection_req
@click.argument("domain") @click.argument("domain")
@click.argument("snapshot_name") @click.argument("snapshot_name")
@click.option(
"--wait/--no-wait",
"wait_flag",
is_flag=True,
default=True,
show_default=True,
help="Wait or don't wait for task to complete, showing progress",
)
@confirm_opt( @confirm_opt(
"Roll back to snapshot {snapshot_name} of {domain} and lose all data and changes since this snapshot" "Roll back to snapshot {snapshot_name} of {domain} and lose all data and changes since this snapshot"
) )
def cli_vm_snapshot_rollback(domain, snapshot_name, wait_flag): def cli_vm_snapshot_rollback(domain, snapshot_name):
""" """
Roll back to the snapshot SNAPSHOT_NAME of the disks and XML configuration of virtual machine DOMAIN, Roll back to the snapshot SNAPSHOT_NAME of the disks and XML configuration of virtual machine DOMAIN,
DOMAIN may be a UUID or name. DOMAIN may be a UUID or name.
""" """
retcode, retmsg = pvc.lib.vm.vm_rollback_snapshot( echo(
CLI_CONFIG, domain, snapshot_name, wait_flag=wait_flag CLI_CONFIG,
f"Rolling back to snapshot '{snapshot_name}' of VM '{domain}'... ",
newline=False,
) )
retcode, retmsg = pvc.lib.vm.vm_rollback_snapshot(CLI_CONFIG, domain, snapshot_name)
if retcode and wait_flag: if retcode:
retmsg = wait_for_celery_task(CLI_CONFIG, retmsg) echo(CLI_CONFIG, "done.")
else:
echo(CLI_CONFIG, "failed.")
finish(retcode, retmsg) finish(retcode, retmsg)
@ -1897,17 +1887,7 @@ def cli_vm_snapshot_rollback(domain, snapshot_name, wait_flag):
default=None, default=None,
help="Perform an incremental volume export from this parent snapshot.", help="Perform an incremental volume export from this parent snapshot.",
) )
@click.option( def cli_vm_snapshot_export(domain, snapshot_name, export_path, incremental_parent):
"--wait/--no-wait",
"wait_flag",
is_flag=True,
default=True,
show_default=True,
help="Wait or don't wait for task to complete, showing progress",
)
def cli_vm_snapshot_export(
domain, snapshot_name, export_path, incremental_parent, wait_flag
):
""" """
Export the (existing) snapshot SNAPSHOT_NAME of virtual machine DOMAIN to the absolute path EXPORT_PATH on the current PVC primary coordinator. Export the (existing) snapshot SNAPSHOT_NAME of virtual machine DOMAIN to the absolute path EXPORT_PATH on the current PVC primary coordinator.
DOMAIN may be a UUID or name. DOMAIN may be a UUID or name.
@ -1921,17 +1901,19 @@ def cli_vm_snapshot_export(
Full export volume images are sparse-allocated, however it is recommended for safety to consider their maximum allocated size when allocated space for the EXPORT_PATH. Incremental volume images are generally small but are dependent entirely on the rate of data change in each volume. Full export volume images are sparse-allocated, however it is recommended for safety to consider their maximum allocated size when allocated space for the EXPORT_PATH. Incremental volume images are generally small but are dependent entirely on the rate of data change in each volume.
""" """
retcode, retmsg = pvc.lib.vm.vm_export_snapshot( _, primary_node = pvc.lib.cluster.get_primary_node(CLI_CONFIG)
echo(
CLI_CONFIG, CLI_CONFIG,
domain, f'Exporting snapshot "{snapshot_name}" of VM "{domain}" to "{primary_node}:{export_path}"... ',
snapshot_name, newline=False,
export_path,
incremental_parent=incremental_parent,
wait_flag=wait_flag,
) )
retcode, retmsg = pvc.lib.vm.vm_export_snapshot(
if retcode and wait_flag: CLI_CONFIG, domain, snapshot_name, export_path, incremental_parent
retmsg = wait_for_celery_task(CLI_CONFIG, retmsg) )
if retcode:
echo(CLI_CONFIG, "done.")
else:
echo(CLI_CONFIG, "failed.")
finish(retcode, retmsg) finish(retcode, retmsg)
@ -1951,17 +1933,7 @@ def cli_vm_snapshot_export(
default=True, default=True,
help="Retain or remove restored (parent, if incremental) snapshot in Ceph.", help="Retain or remove restored (parent, if incremental) snapshot in Ceph.",
) )
@click.option( def cli_vm_snapshot_import(domain, snapshot_name, import_path, retain_snapshot):
"--wait/--no-wait",
"wait_flag",
is_flag=True,
default=True,
show_default=True,
help="Wait or don't wait for task to complete, showing progress",
)
def cli_vm_snapshot_import(
domain, snapshot_name, import_path, retain_snapshot, wait_flag
):
""" """
Import the snapshot SNAPSHOT_NAME of virtual machine DOMAIN from the absolute path IMPORT_PATH on the current PVC primary coordinator. Import the snapshot SNAPSHOT_NAME of virtual machine DOMAIN from the absolute path IMPORT_PATH on the current PVC primary coordinator.
DOMAIN may be a UUID or name. DOMAIN may be a UUID or name.
@ -1970,24 +1942,25 @@ def cli_vm_snapshot_import(
The import will include the VM configuration, metainfo, and the point-in-time snapshot of all attached RBD volumes. Incremental imports will be automatically handled. The import will include the VM configuration, metainfo, and the point-in-time snapshot of all attached RBD volumes. Incremental imports will be automatically handled.
A VM named DOMAIN or with the same UUID must not exist; if a VM with the same name or UUID already exists, it must be removed (or renamed and then undefined, to preserve volumes while freeing the UUID) before importing. A VM named DOMAIN or with the same UUID must not exist; if a VM with the same name or UUID already exists, it must be removed, or renamed and then undefined (to preserve volumes), before importing.
If the "-r"/"--retain-snapshot" option is specified (the default), for incremental imports, only the parent snapshot is kept; for full imports, the imported snapshot is kept. If the "-R"/"--remove-snapshot" option is specified, the imported snapshot is removed. If the "-r"/"--retain-snapshot" option is specified (the default), for incremental imports, only the parent snapshot is kept; for full imports, the imported snapshot is kept. If the "-R"/"--remove-snapshot" option is specified, the imported snapshot is removed.
WARNING: The "-R"/"--remove-snapshot" option will invalidate any existing incremental snapshots based on the same incremental parent for the imported VM. WARNING: The "-R"/"--remove-snapshot" option will invalidate any existing incremental snapshots based on the same incremental parent for the imported VM.
""" """
retcode, retmsg = pvc.lib.vm.vm_import_snapshot( echo(
CLI_CONFIG, CLI_CONFIG,
domain, f"Importing snapshot '{snapshot_name}' of VM '{domain}'... ",
snapshot_name, newline=False,
import_path,
retain_snapshot=retain_snapshot,
wait_flag=wait_flag,
) )
retcode, retmsg = pvc.lib.vm.vm_import_snapshot(
if retcode and wait_flag: CLI_CONFIG, domain, snapshot_name, import_path, retain_snapshot
retmsg = wait_for_celery_task(CLI_CONFIG, retmsg) )
if retcode:
echo(CLI_CONFIG, "done.")
else:
echo(CLI_CONFIG, "failed.")
finish(retcode, retmsg) finish(retcode, retmsg)
@ -2082,7 +2055,7 @@ def cli_vm_backup_restore(domain, backup_datestring, backup_path, retain_snapsho
The restore will import the VM configuration, metainfo, and the point-in-time snapshot of all attached RBD volumes. Incremental backups will be automatically handled. The restore will import the VM configuration, metainfo, and the point-in-time snapshot of all attached RBD volumes. Incremental backups will be automatically handled.
A VM named DOMAIN or with the same UUID must not exist; if a VM with the same name or UUID already exists, it must be removed (or renamed and then undefined, to preserve volumes while freeing the UUID) before importing. A VM named DOMAIN or with the same UUID must not exist; if a VM with the same name or UUID already exists, it must be removed, or renamed and then undefined (to preserve volumes), before restoring.
If the "-r"/"--retain-snapshot" option is specified (the default), for incremental restores, only the parent snapshot is kept; for full restores, the restored snapshot is kept. If the "-R"/"--remove-snapshot" option is specified, the imported snapshot is removed. If the "-r"/"--retain-snapshot" option is specified (the default), for incremental restores, only the parent snapshot is kept; for full restores, the restored snapshot is kept. If the "-R"/"--remove-snapshot" option is specified, the imported snapshot is removed.

View File

@ -121,8 +121,6 @@ def wait_for_celery_task(CLI_CONFIG, task_detail, start_late=False):
break break
if task_status.get("current") > last_task: if task_status.get("current") > last_task:
current_task = int(task_status.get("current")) current_task = int(task_status.get("current"))
total_task = int(task_status.get("total"))
bar.length = total_task
bar.update(current_task - last_task) bar.update(current_task - last_task)
last_task = current_task last_task = current_task
# The extensive spaces at the end cause this to overwrite longer previous messages # The extensive spaces at the end cause this to overwrite longer previous messages

View File

@ -421,7 +421,7 @@ def vm_node(config, vm, target_node, action, force=False, wait=False, force_live
return retstatus, response.json().get("message", "") return retstatus, response.json().get("message", "")
def vm_locks(config, vm, wait_flag=True): def vm_locks(config, vm, wait_flag):
""" """
Flush RBD locks of (stopped) VM Flush RBD locks of (stopped) VM
@ -498,7 +498,7 @@ def vm_restore(config, vm, backup_path, backup_datestring, retain_snapshot=False
return True, response.json().get("message", "") return True, response.json().get("message", "")
def vm_create_snapshot(config, vm, snapshot_name=None, wait_flag=True): def vm_create_snapshot(config, vm, snapshot_name=None):
""" """
Take a snapshot of a VM's disks and configuration Take a snapshot of a VM's disks and configuration
@ -513,10 +513,13 @@ def vm_create_snapshot(config, vm, snapshot_name=None, wait_flag=True):
config, "post", "/vm/{vm}/snapshot".format(vm=vm), params=params config, "post", "/vm/{vm}/snapshot".format(vm=vm), params=params
) )
return get_wait_retdata(response, wait_flag) if response.status_code != 200:
return False, response.json().get("message", "")
else:
return True, response.json().get("message", "")
def vm_remove_snapshot(config, vm, snapshot_name, wait_flag=True): def vm_remove_snapshot(config, vm, snapshot_name):
""" """
Remove a snapshot of a VM's disks and configuration Remove a snapshot of a VM's disks and configuration
@ -529,10 +532,13 @@ def vm_remove_snapshot(config, vm, snapshot_name, wait_flag=True):
config, "delete", "/vm/{vm}/snapshot".format(vm=vm), params=params config, "delete", "/vm/{vm}/snapshot".format(vm=vm), params=params
) )
return get_wait_retdata(response, wait_flag) if response.status_code != 200:
return False, response.json().get("message", "")
else:
return True, response.json().get("message", "")
def vm_rollback_snapshot(config, vm, snapshot_name, wait_flag=True): def vm_rollback_snapshot(config, vm, snapshot_name):
""" """
Roll back to a snapshot of a VM's disks and configuration Roll back to a snapshot of a VM's disks and configuration
@ -545,12 +551,13 @@ def vm_rollback_snapshot(config, vm, snapshot_name, wait_flag=True):
config, "post", "/vm/{vm}/snapshot/rollback".format(vm=vm), params=params config, "post", "/vm/{vm}/snapshot/rollback".format(vm=vm), params=params
) )
return get_wait_retdata(response, wait_flag) if response.status_code != 200:
return False, response.json().get("message", "")
else:
return True, response.json().get("message", "")
def vm_export_snapshot( def vm_export_snapshot(config, vm, snapshot_name, export_path, incremental_parent):
config, vm, snapshot_name, export_path, incremental_parent=None, wait_flag=True
):
""" """
Export an (existing) snapshot of a VM's disks and configuration to export_path, optionally Export an (existing) snapshot of a VM's disks and configuration to export_path, optionally
incremental with incremental_parent incremental with incremental_parent
@ -570,12 +577,13 @@ def vm_export_snapshot(
config, "post", "/vm/{vm}/snapshot/export".format(vm=vm), params=params config, "post", "/vm/{vm}/snapshot/export".format(vm=vm), params=params
) )
return get_wait_retdata(response, wait_flag) if response.status_code != 200:
return False, response.json().get("message", "")
else:
return True, response.json().get("message", "")
def vm_import_snapshot( def vm_import_snapshot(config, vm, snapshot_name, import_path, retain_snapshot=False):
config, vm, snapshot_name, import_path, retain_snapshot=False, wait_flag=True
):
""" """
Import a snapshot of {vm} and its volumes from a local primary coordinator filesystem path Import a snapshot of {vm} and its volumes from a local primary coordinator filesystem path
@ -592,7 +600,10 @@ def vm_import_snapshot(
config, "post", "/vm/{vm}/snapshot/import".format(vm=vm), params=params config, "post", "/vm/{vm}/snapshot/import".format(vm=vm), params=params
) )
return get_wait_retdata(response, wait_flag) if response.status_code != 200:
return False, response.json().get("message", "")
else:
return True, response.json().get("message", "")
def vm_vcpus_set(config, vm, vcpus, topology, restart): def vm_vcpus_set(config, vm, vcpus, topology, restart):

File diff suppressed because it is too large Load Diff

View File

@ -28,11 +28,6 @@ from daemon_lib.vm import (
vm_worker_flush_locks, vm_worker_flush_locks,
vm_worker_attach_device, vm_worker_attach_device,
vm_worker_detach_device, vm_worker_detach_device,
vm_worker_create_snapshot,
vm_worker_remove_snapshot,
vm_worker_rollback_snapshot,
vm_worker_export_snapshot,
vm_worker_import_snapshot,
) )
from daemon_lib.ceph import ( from daemon_lib.ceph import (
osd_worker_add_osd, osd_worker_add_osd,
@ -128,87 +123,6 @@ def vm_device_detach(self, domain=None, xml=None, run_on=None):
return run_vm_device_detach(self, domain, xml) return run_vm_device_detach(self, domain, xml)
@celery.task(name="vm.create_snapshot", bind=True, routing_key="run_on")
def vm_create_snapshot(self, domain=None, snapshot_name=None, run_on="primary"):
@ZKConnection(config)
def run_vm_create_snapshot(zkhandler, self, domain, snapshot_name):
return vm_worker_create_snapshot(zkhandler, self, domain, snapshot_name)
return run_vm_create_snapshot(self, domain, snapshot_name)
@celery.task(name="vm.remove_snapshot", bind=True, routing_key="run_on")
def vm_remove_snapshot(self, domain=None, snapshot_name=None, run_on="primary"):
@ZKConnection(config)
def run_vm_remove_snapshot(zkhandler, self, domain, snapshot_name):
return vm_worker_remove_snapshot(zkhandler, self, domain, snapshot_name)
return run_vm_remove_snapshot(self, domain, snapshot_name)
@celery.task(name="vm.rollback_snapshot", bind=True, routing_key="run_on")
def vm_rollback_snapshot(self, domain=None, snapshot_name=None, run_on="primary"):
@ZKConnection(config)
def run_vm_rollback_snapshot(zkhandler, self, domain, snapshot_name):
return vm_worker_rollback_snapshot(zkhandler, self, domain, snapshot_name)
return run_vm_rollback_snapshot(self, domain, snapshot_name)
@celery.task(name="vm.export_snapshot", bind=True, routing_key="run_on")
def vm_export_snapshot(
self,
domain=None,
snapshot_name=None,
export_path=None,
incremental_parent=None,
run_on="primary",
):
@ZKConnection(config)
def run_vm_export_snapshot(
zkhandler, self, domain, snapshot_name, export_path, incremental_parent=None
):
return vm_worker_export_snapshot(
zkhandler,
self,
domain,
snapshot_name,
export_path,
incremental_parent=incremental_parent,
)
return run_vm_export_snapshot(
self, domain, snapshot_name, export_path, incremental_parent=incremental_parent
)
@celery.task(name="vm.import_snapshot", bind=True, routing_key="run_on")
def vm_import_snapshot(
self,
domain=None,
snapshot_name=None,
import_path=None,
retain_snapshot=True,
run_on="primary",
):
@ZKConnection(config)
def run_vm_import_snapshot(
zkhandler, self, domain, snapshot_name, import_path, retain_snapshot=True
):
return vm_worker_import_snapshot(
zkhandler,
self,
domain,
snapshot_name,
import_path,
retain_snapshot=retain_snapshot,
)
return run_vm_import_snapshot(
self, domain, snapshot_name, import_path, retain_snapshot=retain_snapshot
)
@celery.task(name="osd.add", bind=True, routing_key="run_on") @celery.task(name="osd.add", bind=True, routing_key="run_on")
def osd_add( def osd_add(
self, self,