Discussion:
[libvirt-users] console type tcp with logging
Vasiliy Tolstov
2018-11-29 15:19:43 UTC
Permalink
Hi! I want to have ability to connect to guest console via libvirt api
(and expose this data to xtermjs via websocket) with getty tty. And
also i want to have log of tty1 (do log grub, kernel booting and
errors).
What i need to do in libvirt xml for such case?
--
Vasiliy Tolstov,
e-mail: ***@selfip.ru
Daniel P. Berrangé
2018-11-29 15:23:10 UTC
Permalink
Post by Vasiliy Tolstov
Hi! I want to have ability to connect to guest console via libvirt api
(and expose this data to xtermjs via websocket) with getty tty. And
also i want to have log of tty1 (do log grub, kernel booting and
errors).
What i need to do in libvirt xml for such case?
XML is described here

https://libvirt.org/formatdomain.html#elementsConsole

In particular regardless of what backend type you use for the
seral port, you can add logging using

<log file="/var/log/libvirt/qemu/guestname-serial0.log" append="off"/>



Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Vasiliy Tolstov
2018-11-29 17:57:54 UTC
Permalink
Post by Daniel P. Berrangé
Post by Vasiliy Tolstov
Hi! I want to have ability to connect to guest console via libvirt api
(and expose this data to xtermjs via websocket) with getty tty. And
also i want to have log of tty1 (do log grub, kernel booting and
errors).
What i need to do in libvirt xml for such case?
XML is described here
https://libvirt.org/formatdomain.html#elementsConsole
In particular regardless of what backend type you use for the
seral port, you can add logging using
<log file="/var/log/libvirt/qemu/guestname-serial0.log" append="off"/>
Thanks! Does it possible to read this log via libvirt api?
--
Vasiliy Tolstov,
e-mail: ***@selfip.ru
Daniel P. Berrangé
2018-11-30 09:43:12 UTC
Permalink
Post by Vasiliy Tolstov
Post by Daniel P. Berrangé
Post by Vasiliy Tolstov
Hi! I want to have ability to connect to guest console via libvirt api
(and expose this data to xtermjs via websocket) with getty tty. And
also i want to have log of tty1 (do log grub, kernel booting and
errors).
What i need to do in libvirt xml for such case?
XML is described here
https://libvirt.org/formatdomain.html#elementsConsole
In particular regardless of what backend type you use for the
seral port, you can add logging using
<log file="/var/log/libvirt/qemu/guestname-serial0.log" append="off"/>
Thanks! Does it possible to read this log via libvirt api?
No, not at this time.


Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Vasiliy Tolstov
2018-12-01 21:34:54 UTC
Permalink
Post by Daniel P. Berrangé
Post by Vasiliy Tolstov
Post by Daniel P. Berrangé
Post by Vasiliy Tolstov
Hi! I want to have ability to connect to guest console via libvirt api
(and expose this data to xtermjs via websocket) with getty tty. And
also i want to have log of tty1 (do log grub, kernel booting and
errors).
What i need to do in libvirt xml for such case?
XML is described here
https://libvirt.org/formatdomain.html#elementsConsole
In particular regardless of what backend type you use for the
seral port, you can add logging using
<log file="/var/log/libvirt/qemu/guestname-serial0.log" append="off"/>
Thanks! Does it possible to read this log via libvirt api?
No, not at this time.
Thanks! Do you have some plans to add this ability or patches welcome? =)
--
Vasiliy Tolstov,
e-mail: ***@selfip.ru
Daniel P. Berrangé
2018-12-03 09:27:15 UTC
Permalink
Post by Vasiliy Tolstov
Post by Daniel P. Berrangé
Post by Vasiliy Tolstov
Post by Daniel P. Berrangé
Post by Vasiliy Tolstov
Hi! I want to have ability to connect to guest console via libvirt api
(and expose this data to xtermjs via websocket) with getty tty. And
also i want to have log of tty1 (do log grub, kernel booting and
errors).
What i need to do in libvirt xml for such case?
XML is described here
https://libvirt.org/formatdomain.html#elementsConsole
In particular regardless of what backend type you use for the
seral port, you can add logging using
<log file="/var/log/libvirt/qemu/guestname-serial0.log" append="off"/>
Thanks! Does it possible to read this log via libvirt api?
No, not at this time.
Thanks! Do you have some plans to add this ability or patches welcome? =)
We don't have any plans to add it, but if someone's interested we'd
accept patches. It would need to integrate with our virStream APIs
to allow download, in similar way to how virStorageVolDownload() works


Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Vasiliy Tolstov
2018-12-03 10:38:45 UTC
Permalink
Post by Daniel P. Berrangé
We don't have any plans to add it, but if someone's interested we'd
accept patches. It would need to integrate with our virStream APIs
to allow download, in similar way to how virStorageVolDownload() works
What args this function need to receive? VolDownload this args:
virStorageVolDownload(virStorageVolPtr vol,
virStreamPtr stream,
unsigned long long offset,
unsigned long long length,
unsigned int flags)

I think that we can use all of this, but instead of vol, what we need to recv?

Vasiliy Tolstov,
e-mail: ***@selfip.ru
Daniel P. Berrangé
2018-12-03 11:06:10 UTC
Permalink
Post by Vasiliy Tolstov
Post by Daniel P. Berrangé
We don't have any plans to add it, but if someone's interested we'd
accept patches. It would need to integrate with our virStream APIs
to allow download, in similar way to how virStorageVolDownload() works
virStorageVolDownload(virStorageVolPtr vol,
virStreamPtr stream,
unsigned long long offset,
unsigned long long length,
unsigned int flags)
I think that we can use all of this, but instead of vol, what we need to recv?
We need the domain object, and the device alias name, eg

virDomainOpenDeviceLogFile(virDomainPtr dom,
const char *name,
unsigned long long offset,
unsigned long long length,
unsigned int flags);

Where name maps to <alias name=.../>.

Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Michal Privoznik
2018-12-03 14:15:05 UTC
Permalink
Post by Daniel P. Berrangé
Post by Vasiliy Tolstov
Post by Daniel P. Berrangé
We don't have any plans to add it, but if someone's interested we'd
accept patches. It would need to integrate with our virStream APIs
to allow download, in similar way to how virStorageVolDownload() works
virStorageVolDownload(virStorageVolPtr vol,
virStreamPtr stream,
unsigned long long offset,
unsigned long long length,
unsigned int flags)
I think that we can use all of this, but instead of vol, what we need to recv?
We need the domain object, and the device alias name, eg
virDomainOpenDeviceLogFile(virDomainPtr dom,
virStreamPtr stream,
Post by Daniel P. Berrangé
const char *name,
unsigned long long offset,
unsigned long long length,
unsigned int flags);
We can have it used the same way as virStorageVolDownload:

stream = virStreamNew();

virDomainOpenDeviceLogFile(dom, stream, alias, 0, 0, 0);

virStreamRecvAll(stream, ...);


Michal

Continue reading on narkive:
Loading...