Hi all,
I'm part of Cyberus Technology and currently working on the Cloud Hypervisor
driver backend of libvirt. We are currently implementing a feature to fix
device bus addresses in the domain definitions for PCI devices, guaranteeing
that devices remain available at the same address even after live migration and
restarts, and across libvirt versions. In doing so, some questions came up
about the intended semantics of the `--persistent` and `--live` flags in virsh
commands and the synchronization between runtime and persistent configuration.
So we wanted to ask you these questions.
Our first question revolves around `virsh mirgate --persistent`. The
documentation says `leaves the domain persistent on the destination host
physical machine`, but what domain definition is used from the source side to
migrate the VM? Is it that the live definition is sent, then migrated, and
persisted on the receiver side? Or is the source's persistent XML sent to the
receiver, and the receiver’s live definition created from the persistent
definition received?
The second question is about synchronization between live and persistent
configuration. To achieve the goal of keeping the same device at the same PCI
bus address across restarts and live migrations, to our understanding, we have
to ensure that one device is written to both domain definitions with the same
PCI bus address. Is this right, or do we miss something?
The next questions are about attaching/detaching devices (live). With respect
to our intention to implement fixed PCI bus addresses for devices, what would
be the right semantics for the following cases? Are they even valid? The source
code of the qemu driver leaves those questions open:
1) We attach a device `A` with `--persistent`and remove it with
`--live`. If we now attach `B`, either via `--persistent` and `--live`, we
expect that the PCI bus address formerly assigned to `A` is not reused for `B`.
Is this correct?
2) If we attach a device `A` with `--live` and a second device `B`
with `--persistent`, then `A` will not be present in the persistent domain XML.
Still, we expect that `B` is added to both live and persistent definitions,
using the same PCI bus address. By doing so, we would expect the attachment
routines for the persistent definition not to assign the address handed out by
the attachment routines of the live configuration for device `A`. In other
words, even if `A` is not present in the persistent configuration, we would
expect the address of `A` not be reused when attaching `B` to the persistent
definition. Are those semantics correct?
The last question is about target names for network devices (`ifname`). libvirt
does generate names for such devices in certain situations. Whenever a device
definition is parsed that contains an `ifname` that matches libvirt's
generation rules, e.g. vnet*, it is blanked out (see `virDomainNetDefParseXML`,
in domain_conf.c). When writing code that tries to identify network devices by
their `ifname`s, we found that this would be impossible because devices with an
autogenerated name will have a blank `ifname` in the definition. What is the
expected semantics around fixed PCI bus addresses for such devices? Would it be
right to assign a custom `ifname` to them in this case?
Thanks in advance!
Pascal