Re: [HELP] QEMU guest agent via ISA serial port, or shutdown hooks?

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

 



On 18.10.2012 01:27, Thorsten Glaser wrote:
> Hi,
> 
> http://www.redhat.com/archives/libvir-list/2012-January/msg00629.html
> added support only for when using the virtio channel to the guest.
> 
> However, QEMU Guest Agent support is most useful to guests that do
> not implement ACPI shutdown support; these usually don’t have virtio
> (especially since I was unable to find a how-to-implement-virtio-in-
> a-kernel document, otherwise MirBSD might do virtio-rng at least ☺),
> so the serial transport would be best.
> 
> The problem is of course the two lines:
> +        if (channel->targetType != VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO)
> +            continue;
> 
> I’ve done a bit of hacking to allow the name attribute in the domain
> XML for any character device (probably half wrong, but this was just
> a quick test for me) and commented out these two lines, to see whether
> qga support on ISA ports is doable. (You probably would want to allow
> the attribute only on virtio and ISA serial ports, then.)

That's correct; as long as qga supports just virtio-serial and
isa-serial channels.

> 
> Patch follows, NOT FOR APPLYING AS-IS:
> 
> --- libvirt-0.9.12.orig/src/conf/domain_conf.c
> +++ libvirt-0.9.12/src/conf/domain_conf.c
> @@ -1266,6 +1266,7 @@ void virDomainChrDefFree(virDomainChrDef
>          break;
>  
>      default:
> +        VIR_FREE(def->target.name);
>          break;
>      }
>  
> @@ -4954,6 +4955,7 @@ virDomainChrDefParseTargetXML(virCapsPtr
>          break;
>  
>      default:
> +        def->target.name = virXMLPropString(cur, "name");
>          portStr = virXMLPropString(cur, "port");
>          if (portStr == NULL) {
>              /* Set to negative value to indicate we should set it later */
> @@ -11685,11 +11687,16 @@ virDomainChrDefFormat(virBufferPtr buf,
>                            virDomainChrTargetTypeToString(def->deviceType,
>                                                           def->targetType),
>                            def->target.port);
> +        //XXX def->target.name is lost
>          break;
>  
>      default:
> -        virBufferAsprintf(buf, "      <target port='%d'/>\n",
> +        virBufferAsprintf(buf, "      <target port='%d'",
>                            def->target.port);
> +        if (def->target.name) {
> +            virBufferEscapeString(buf, " name='%s'", def->target.name);
> +        }
> +        virBufferAddLit(buf, "/>\n");
>          break;
>      }
>  
> --- libvirt-0.9.12.orig/src/qemu/qemu_process.c
> +++ libvirt-0.9.12/src/qemu/qemu_process.c
> @@ -191,8 +191,8 @@ qemuFindAgentConfig(virDomainDefPtr def)
>      for (i = 0 ; i < def->nchannels ; i++) {
>          virDomainChrDefPtr channel = def->channels[i];
>  
> -        if (channel->targetType != VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO)
> -            continue;
> +//        if (channel->targetType != VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO)
> +//            continue;
>  
>          if (STREQ_NULLABLE(channel->target.name, "org.qemu.guest_agent.0")) {
>              config = &channel->source;
> 
> Unfortunately, that seems to not be enough: trying to build the
> resulting libvirt package segfaults in the testsuite, so I must
> have some mistakes in the XML part. I’m really not familiar with
> all this, I’d “just” like to have my BSD VMs shut down cleanly
> when the host is shut down, so please advice.
> 
> Does libvirt (the dæmon, probably) offer a shutdown hook, e.g.
> I could tell it to run a shellscript that ssh(1)s to the VM with
> a passwordless key to shut it down, instead? (Same for when the
> Shutdown or Restart functions in virt-manager are used, or virsh.)

Not yet.

> 
> Thanks in advance,
> //mirabilos
> 

I can implement isa-serial channel. But not too soon, though.

Michal

--
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]