Skip to content

libvirt: fix rm/rm-all on domains with a managed save image - #412

Merged
Johan-Liebert1 merged 1 commit into
bootc-dev:mainfrom
Rolv-Apneseth:managed_save
Nov 3, 2026
Merged

Johan-Liebert1 merged 1 commit into
bootc-dev:mainfrom
Rolv-Apneseth:managed_save

Conversation

@Rolv-Apneseth

Copy link
Copy Markdown
Contributor

While running bcvk libvirt rm-all --label bootc.test=1, I managed to get an error:

Removing VM 'bootc-tmt-l6km09im-tmt-plans-integration-plan-01-readonly'...
  Removing libvirt domain...
  Failed to remove libvirt domain 'bootc-tmt-l6km09im-tmt-plans-integration-plan-01-readonly': error: Failed to undefine domain 'bootc-tmt-l6km09im-tmt-plans-integration-plan-01-readonly'
error: Requested operation is not valid: Refusing to undefine while domain managed save image exists

From the man page for virsh(1):

The --managed-save flag guarantees that any managed save image (see
the managedsave command) is  also  cleaned  up. Without the flag,
attempts to undefine a domain with a managed save image will fail.

I think it makes sense for bcvk libvirt rm and bcvk libvirt rm-all to delete managed save state considering they already delete NVRAM and disk storage, so this commit adds the argument to both undefine calls.

While running `bcvk libvirt rm-all --label bootc.test=1`, I managed to get an
error:

    Removing VM
'bootc-tmt-l6km09im-tmt-plans-integration-plan-01-readonly'...
      Removing libvirt domain...
      Failed to remove libvirt domain
'bootc-tmt-l6km09im-tmt-plans-integration-plan-01-readonly': error:
Failed to undefine domain
'bootc-tmt-l6km09im-tmt-plans-integration-plan-01-readonly'
    error: Requested operation is not valid: Refusing to undefine while
domain managed save image exists

From the man page for virsh(1):

    The --managed-save flag guarantees that any managed save image (see
    the managedsave command) is  also  cleaned  up. Without the flag,
    attempts to undefine a domain with a managed save image will fail.

I think it makes sense for `bcvk libvirt rm` and `bcvk libvirt rm-all` to
delete managed save state considering they already delete NVRAM and disk
storage, so this commit adds the argument to both undefine calls.

Signed-off-by: Rolv Apneseth <[email protected]>

@Johan-Liebert1 Johan-Liebert1 left a comment

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.

LGTM

@Johan-Liebert1
Johan-Liebert1 merged commit 5349e13 into bootc-dev:main Nov 3, 2026
28 checks passed
@Rolv-Apneseth
Rolv-Apneseth deleted the managed_save branch November 3, 2026 10:22
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