[PATCH] qemuDomainChangeDiskLive: Modify 'startupPolicy' before changing source

Han Han hhan at redhat.com
Thu Sep 30 04:25:34 UTC 2021


On Mon, Sep 13, 2021 at 4:10 PM Peter Krempa <pkrempa at redhat.com> wrote:

> On Fri, Sep 10, 2021 at 22:04:01 +0300, Nir Soffer wrote:
> > On Fri, Sep 10, 2021 at 4:35 PM Peter Krempa <pkrempa at redhat.com> wrote:
> > >
> > > We don't support all startup policies with all source types so to
> > > correctly allow switching from a 'file' based cdrom with 'optional'
> > > startup policy to a 'block' based one which doesn't support optional we
> > > must update the startup policy field first. Obviously we need to have
> > > fallback if the update fails.
> >
> > Why is there a difference between file and block for startup policy?
>
> I'm not sure about the historic reasons for why 'block' was not
> considered when this was implemented originally.
>
Hi Peter,
I searched in the commits history and found the error message """
'startupPolicy' is only valid for 'file' type volume """ comes from
43404fee37(
https://listman.redhat.com/archives/libvir-list/2013-April/msg00419.html):
Author: Osier Yang <jyang at redhat.com>
Date:   Fri Apr 5 03:37:58 2013 +0800

    Support startupPolicy for 'volume' disk

    "startupPolicy" is only valid for file type storage volume, otherwise
    it fails on starting the domain.

But it's not clear why the author said "startupPolicy" is not valid for
block type.
Maybe we can have test on
https://listman.redhat.com/archives/libvir-list/2021-September/msg00903.html
,
to see if it fails to start the domain with startupPolicy and block disk
type.

>
> > Is this documented?
>
> (citation from 'formatdomain.rst' the source for
> https://www.libvirt.org/formatdomain.html )
>
>    For a "file" or "volume" disk type which represents a cdrom or floppy
> (the
>    ``device`` attribute), it is possible to define policy what to do with
> the
>    disk if the source file is not accessible. (NB, ``startupPolicy`` is not
>    valid for "volume" disk unless the specified storage volume is of "file"
>    type). This is done by the ``startupPolicy`` attribute ( :since:`since
> 0.9.7`
>    ), accepting these values:
>
>    =========
> =====================================================================
>    mandatory fail if missing for any reason (the default)
>    requisite fail if missing on boot up, drop if missing on
> migrate/restore/revert
>    optional  drop if missing at any start attempt
>    =========
> =====================================================================
>
>    :since:`Since 1.1.2` the ``startupPolicy`` is extended to support hard
> disks
>    besides cdrom and floppy. On guest cold bootup, if a certain disk is not
>    accessible or its disk chain is broken, with startupPolicy 'optional'
> the
>    guest will drop this disk. This feature doesn't support migration
> currently.
>
> As you can notice only "file" and "volume" (pointing to a file) are
> allowed.
>
> > Do we have a way to switch from file to block with current libvirt
> > (centos 8 stream, rhel 8.4) without this patch, or do we need to wait
> > until this fix is available? (rhel 8.5?)
>
> You can issue two separate update calls. One updating the startup policy
> first and then the second one updating the source.
>
> On another note, I don't quite understand though why oVirt actually even
> uses startup policy in the first place. Since oVirt is already doing a
> pretty complicated storage management, checking whether the image file
> exists is a trivial operation.
>
> Similarly, when migrating you can use the destination XML (which can be
> optionally used with the migration API) allows you to update storage
> source and even provide empty storage for a cdrom. This can be used to
> update paths to storage too. This allows superior flexibility when
> compared to startup policy.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20210930/e9fa4805/attachment-0001.htm>


More information about the libvir-list mailing list