[libvirt] [PATCH] Use UPDATE_CPU when saving domain status

Kashyap Chamarthy kchamart at redhat.com
Sat Nov 1 19:39:49 UTC 2014


On Fri, Oct 31, 2014 at 04:29:07PM +0100, Ján Tomko wrote:
> We only format cpu model for MODE_CUSTOM in domain status XML,
> but we always format features if they are present.
> 
> This is a problem if we have a domain using MODE_HOST_PASSTHROUGH
> that has been managedsaved, then restored, since it now has
> a feature list but no model in /var/run/libvirt/qemu.
> 
> Use UPDATE_CPU even for the status XML to prevent libvirt
> from losing track of the domain.
> 
> Also accept a list of features for HOST_PASSTHROUGH even without
> a model specified, to catch domains started with older libvirtd.
> (We already accept the list of features with a model specified,
>  even though they have no effect for HOST_PASSTHROUGH)
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1030793

Just applied this patch and re-tested the above bug as noted further
below, I still same result.

Apply the patch and build libvirt RPMs:

  $ git am ~/Mail/RH/patchtemp/
  Applying: Use UPDATE_CPU when saving domain status

  $ git log | head -5
  commit 2ca40bebeec8ed6fdf90a2975a2a6cb1feac5d7c
  Author: Ján Tomko <jtomko at redhat.com>
  Date:   Fri Oct 31 16:29:07 2014 +0100
  
      Use UPDATE_CPU when saving domain status
  
  $ ./autogen.sh && make -j4 && make rpm
  
  $ rpm -Uvh ~/rpmbuild/RPMs/x86_64/libvirt-* --force
  
  $ sudo systemctl restart libvirtd && systemctl daemon-reload


Create an internal snapshot (for a guest with host cpu passthroguh on a
guest) and try to revert to it:

  $ virsh dumpxml f20vm | grep features -A3
    <features>
      <acpi/>
      <apic/>
      <pae/>
    </features>
    <cpu mode='host-passthrough'>
    </cpu>
    <clock offset='utc'>

  $ virsh snapshot-create-as f20vm snap1 
  Domain snapshot snap1 created

  $ virsh snapshot-revert f20vm snap1
  error: XML error: Non-empty feature list specified without CPU model


Am I missing something?


> https://bugzilla.redhat.com/show_bug.cgi?id=1151885
> ---
>  src/conf/cpu_conf.c    | 2 +-
>  src/conf/domain_conf.c | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
> index 9b7fbb0..96e1c38 100644
> --- a/src/conf/cpu_conf.c
> +++ b/src/conf/cpu_conf.c
> @@ -625,7 +625,7 @@ virCPUDefFormatBuf(virBufferPtr buf,
>                         (def->mode == VIR_CPU_MODE_CUSTOM && def->model)));
>  
>      if (!def->model &&
> -        def->mode != VIR_CPU_MODE_HOST_MODEL &&
> +        def->mode == VIR_CPU_MODE_CUSTOM &&
>          def->nfeatures) {
>          virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
>                         _("Non-empty feature list specified without CPU model"));
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index a351382..414161c 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -19621,6 +19621,7 @@ virDomainSaveStatus(virDomainXMLOptionPtr xmlopt,
>                      virDomainObjPtr obj)
>  {
>      unsigned int flags = (VIR_DOMAIN_XML_SECURE |
> +                          VIR_DOMAIN_XML_UPDATE_CPU |
>                            VIR_DOMAIN_XML_INTERNAL_STATUS |
>                            VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET |
>                            VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES |
> -- 
> 2.0.4
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

-- 
/kashyap




More information about the libvir-list mailing list