RFC: add new API to known if domain has been updated

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, all

Suppose that one updated a domain, and want to restart the
domain with original configuration.

However, currently, unless shutdown the domain first, and then
restart or reload libvirtd, otherwise domain will still be started
with changed configuration. e.g.

# virsh list --all
 Id Name                 State
----------------------------------
  1 f14                  running

# virsh dumpxml f14 | grep -A 7 cdrom
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/cd1.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <alias name='ide0-1-0'/>
      <address type='drive' controller='0' bus='1' unit='0'/>
    </disk>

# virsh update-device f14 cd2.xml

# virsh dumpxml f14 | grep -A 7 cdrom
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/cd2.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <alias name='ide0-1-0'/>
      <address type='drive' controller='0' bus='1' unit='0'/>
    </disk>

# virsh destroy f14
# virsh start f14

# virsh dumpxml f14 | grep -A 7 cdrom
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/cd2.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <alias name='ide0-1-0'/>
      <address type='drive' controller='0' bus='1' unit='0'/>
    </disk>

it's caused by libvirtd doesn't known if a domain is updated or not,
it updated the domain configuration in memory, but client could
not known about it.

As a result, one wants to start the domain with original configuration,
he has to shutdown the domain first, and then restart libvirt.

It will be better if client could known if the domain is updated
or not, and could choose to start the domain with original
configuration or the updated one.

So, considered introducing a new member, the idea is adding
"unsigned int updated :1;" for "virDomainObj", adn the functions which
will update domain configuration should set it to "1" so that
libvirtd could known the domain is updated. e.g.

static int qemudDomainChangeEjectableMedia (....)
{
    .................

    /* if Media is changed or ejected successfully */
    if (!vm->updated)
        vm->updated = 1;

    ..................
}

And the client such as virsh could provide optional parameter for user
to choose if start the guest with original configuration or not. e.g.

# virsh start f14 --original

it tells "virsh" to start the domain with the persistent domain
configuration "/etc/libvirt/qemu/$domain.xml" but not the updated
one maitained by libvirtd.

PS: if this API is introduced finnally, we can also add "updated"
information in "dominfo".

What do you think about it? patches are coming following this thread.
awaiting feedback.. :-)

- Osier

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]