Skip to content

VMDisk import with invalid URL stays in progress forever #4059

Open

Description

@myasnikovdaniil

What is wrong?

VMDisk created from HTTP URL never reaches failed state when source keeps returning an error (reproduced with HTTP 404). CDI importer exits with error, but pod uses restartPolicy: OnFailure, so kubelet restarts it without limit. DataVolume stays in ImportInProgress, and backing HelmRelease keeps timing out and retrying.

From user side disk creation stays in progress forever. Error is only visible in importer logs, and changing source in VMDisk does not update already created DataVolume because chart keeps its existing spec.

How to reproduce?

  1. Create VMDisk with HTTP source URL returning 404.
  2. Wait for importer pod to start.
  3. Check DataVolume, importer pod and HelmRelease status.

Importer continues to restart, DataVolume remains in ImportInProgress, and HelmRelease gets repeated action timeouts.

How it should work?

Cozystack should expose terminal failed state after bounded retries or timeout for persistent import errors. API and dashboard should show source error and provide explicit retry with corrected source, or require disk recreation with clear message.

CDI retry behavior makes sense for temporary source failures, so this issue is about import lifecycle in Cozystack, not CDI resource ownership.

Activity

  1. lexfrei commented on Sep 23, 2026

    @lexfrei
    Contributor

    #4380 makes a stuck import visible through the API, but the import itself still never ends, so I'd keep this issue open for the rest.

    With #4380 the vm-disk WorkloadMonitor lists the DataVolumes it selects and reports not operational while one of them is still in flight (internal/controller/workloadmonitor_controller.go:103-130 at b0ff186). ImportScheduled and ImportInProgress are in that set, so a disk with a broken URL gets WorkloadsReady=False on the VMDisk (workloadmonitor_controller.go:866-868). The new vmdisk-unreachable e2e case checks exactly that with an .invalid URL (hack/e2e-chainsaw/vminstance/chainsaw-test.yaml:57-88). The ApplicationDefinition also stops Helm from waiting on the DataVolume (packages/system/vm-disk-rd/cozyrds/vm-disk.yaml:21-24). A new disk no longer produces the repeated HelmRelease timeouts, and an existing one picks this up on its next update.

    The retry loop is untouched. In CDI v1.66.1 the importer pod runs with RestartPolicy: OnFailure (pkg/controller/import-controller.go:1036). A failed import moves the DataVolume to Failed only when the error is marked fatal, (pkg/controller/datavolume/import-controller.go:290-295), and the only fatal case there is a checksum mismatch (pkg/controller/import-controller.go:397-407). A 404 or a DNS failure is retried forever and the DataVolume stays in ImportInProgress. Nothing in #4380 puts a deadline on that from the cozystack side.

    The source error is still not shown anywhere. The condition message is the generic "One or more workloads are not operational" (pkg/registry/apps/application/rest.go:1486). The dashboard reads only Ready, and Ready now follows the HelmRelease, which succeeds. So in the UI a new disk with a broken URL will look healthy, while before it at least stayed in progress.

    Changing the source of an existing disk is already handled on main, outside #4380. Since 06624ba the chart fails the release on a source edit and asks to delete and recreate the disk (packages/apps/vm-disk/templates/dv.yaml:44).

    What is left here: a terminal state for an import that keeps failing, the DataVolume error in the condition message, and a way for the dashboard to show it.

  2. added
    kind/bugCategorizes issue or PR as related to a bug
    area/virtualizationIssues or PRs related to virtualization (kubevirt, cdi, vmi, vm-import)
    triage/acceptedIndicates an issue is ready to be actively worked on
    priority/important-longtermImportant over the long term, but may not be staffed and/or may need multiple releases to complete
    and removed
    triage/needs-triageIndicates an issue needs triage by a maintainer
    on Sep 23, 2026
  3. lexfrei commented on Oct 7, 2026

    @lexfrei
    Contributor

    #4802 fixes this for golden images only. It treats a DataVolume as stuck when it is not Succeeded, status.restartCount is 3 or more and the Running condition is False. CDI v1.66.1 fills restartCount from the importer container restarts and sets Running=False while the importer is down, back-off included, so a 404 or a DNS failure matches without parsing the error text.

    A VMDisk's own import can't be caught at render time, because the same render creates its DataVolume. The WorkloadMonitor looks like the right place: isDataVolumeReady in internal/controller/workloadmonitor_controller.go could report a DataVolume matching this predicate as failed instead of in flight, and pass the Running message into the VMDisk condition.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/virtualizationIssues or PRs related to virtualization (kubevirt, cdi, vmi, vm-import)kind/bugCategorizes issue or PR as related to a bugpriority/important-longtermImportant over the long term, but may not be staffed and/or may need multiple releases to completetriage/acceptedIndicates an issue is ready to be actively worked on

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions