(mc, name, bucket, zpool)
Perform minimal snapshot import, symmetric to do_export_minimal
Perform minimal snapshot import, symmetric to do_export_minimal
Perform minimal snapshot import symmetric to do_export_minimal
def do_import_minimal(mc, name, bucket, zpool):
    """Perform minimal snapshot import, symmetric to do_export_minimal"""
    logging.info("Downloading installation info")
    mc.fget_object(
        bucket,
        f"{name}/install.json",
        os.path.join(ETC_DIR, InstallInfo._INSTALL_FILENAME),
    )

    logging.info("Downloading VM config")
    mc.fget_object(
        bucket, f"{name}/cfg.template", os.path.join(ETC_DIR, "scripts", "cfg.template")
    )

    # Now we have imported InstallInfo object
    install_info = InstallInfo.load()

    # Patch ZFS pool name
    if zpool is not None:
        install_info.zfs_tank_name = zpool
        # Save patched ZFS dataset name (storage backend has to know it)
        install_info.save()

    storage = get_storage_backend(install_info)

    with tempfile.NamedTemporaryFile() as disk_image:
        logging.info("Downloading VM disk image")
        mc.fget_object(bucket, f"{name}/disk.img", disk_image.name)

        logging.info("Importing VM disk")
        storage.import_vm0(disk_image.name)
def do_import_minimal ( mc , name , bucket , zpool ) : logging . info ( "Downloading installation info" ) mc . fget_object ( bucket , f"{name}/install.json" , os . path . join ( ETC_DIR , InstallInfo . _INSTALL_FILENAME ) , ) logging . info ( "Downloading VM config" ) mc . fget_object ( bucket , f"{name}/cfg.template" , os . path . join ( ETC_DIR , "scripts" , "cfg.template" ) ) # Now we have imported InstallInfo object install_info = InstallInfo . load ( ) # Patch ZFS pool name if zpool is not None : install_info . zfs_tank_name = zpool # Save patched ZFS dataset name (storage backend has to know it) install_info . save ( ) storage = get_storage_backend ( install_info ) with tempfile . NamedTemporaryFile ( ) as disk_image : logging . info ( "Downloading VM disk image" ) mc . fget_object ( bucket , f"{name}/disk.img" , disk_image . name ) logging . info ( "Importing VM disk" ) storage . import_vm0 ( disk_image . name )