[libvirt] [PATCH v2 2/7] qemu: domain: store and update panic info

Bjoern Walk bwalk at linux.ibm.com
Wed Mar 27 13:17:54 UTC 2019


Michal Privoznik <mprivozn at redhat.com> [2019-03-27, 02:05PM +0100]:
> On 3/25/19 9:04 AM, Bjoern Walk wrote:
> > @@ -14069,6 +14072,39 @@ qemuDomainStatePanicInfoFormatMsg(qemuDomainStatePanicInfoPtr info)
> >   }
> > +void
> > +qemuDomainStatePanicInfoSet(virDomainObjPtr vm,
> > +                            qemuDomainStatePanicInfoPtr info)
> > +{
> > +    qemuDomainObjPrivatePtr priv = vm->privateData;
> > +
> > +    if (!priv->panicInfo && VIR_ALLOC(priv->panicInfo) < 0)
> > +        return;
> > +
> > +    priv->panicInfo->type = info->type;
> > +
> > +    switch (info->type) {
> > +    case QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_HYPERV:
> > +        priv->panicInfo->data.hyperv.arg1 = info->data.hyperv.arg1;
> > +        priv->panicInfo->data.hyperv.arg2 = info->data.hyperv.arg2;
> > +        priv->panicInfo->data.hyperv.arg3 = info->data.hyperv.arg3;
> > +        priv->panicInfo->data.hyperv.arg4 = info->data.hyperv.arg4;
> > +        priv->panicInfo->data.hyperv.arg5 = info->data.hyperv.arg5;
> > +        break;
> > +    case QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_S390:
> > +        priv->panicInfo->data.s390.core = info->data.s390.core;
> > +        priv->panicInfo->data.s390.psw_mask = info->data.s390.psw_mask;
> > +        priv->panicInfo->data.s390.psw_addr = info->data.s390.psw_addr;
> > +        ignore_value(VIR_STRDUP(priv->panicInfo->data.s390.reason,
> > +                                info->data.s390.reason));
> > +        break;
> > +    case QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_NONE:
> > +    case QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_LAST:
> > +        break;
> > +    }
> 
> How about memcpy() and then just STRDUP() in the one place we need to?
> 
> No need to send v3 for that, just asking and if so, I can fix that before
> pushing.
> 
> My reasoning is that it might be easy to forget update this function if
> qemuDomainStatePanicInfo struct gets a new member.

Yes, I agree, that's much better.

> 
> Michal
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 902 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190327/7ca3dc85/attachment-0001.sig>


More information about the libvir-list mailing list