[libvirt] serial console/events example script

Eric Blake eblake at redhat.com
Tue May 29 23:10:01 UTC 2012


On 05/29/2012 07:30 AM, Dave Allan wrote:

>>>>>
>>>>> A while back I wrote the attached code to demonstrate how to use
>>>>> events and serial console to create a serial console that stays up
>>>>> even when the VM is down.  Is it worth adding to the examples?  It
>>>>> might need some work, as I am not terribly strong with Python.

>>> Add it to the examples/ directory in GIT I say.
>>
>> Agreed.  Dave, do you need help incorporating it into the actual
>> libvirt.git tree?
> 
> Thanks, that'd be great--I don't have an r/w tree atm.

Done:

From bc8296d2e31d1f7a51485d4c564e50da018ad093 Mon Sep 17 00:00:00 2001
From: Dave Allan <dallan at redhat.com>
Date: Tue, 29 May 2012 16:49:13 -0600
Subject: [PATCH] examples: add consolecallback example python script

A while back I wrote the attached code to demonstrate how to use
events and serial console to create a serial console that stays up
even when the VM is down.  It might need some work, as I am not
terribly strong with Python.

* examples/python/consolecallback.py: New file.
* examples/python/Makefile.am (EXTRA_DIST): Ship it.
---
 examples/python/Makefile.am        |    3 +-
 examples/python/consolecallback.py |   88
++++++++++++++++++++++++++++++++++++
 2 files changed, 90 insertions(+), 1 deletions(-)
 create mode 100644 examples/python/consolecallback.py

diff --git a/examples/python/Makefile.am b/examples/python/Makefile.am
index d782a28..b04d126 100644
--- a/examples/python/Makefile.am
+++ b/examples/python/Makefile.am
@@ -1,6 +1,7 @@
-## Copyright (C) 2005-2011 Red Hat, Inc.
+## Copyright (C) 2005-2012 Red Hat, Inc.
 ## See COPYING.LIB for the License of this software

 EXTRA_DIST=						\
 	README						\
+	consolecallback.py				\
 	dominfo.py domrestore.py domsave.py domstart.py esxlist.py
diff --git a/examples/python/consolecallback.py
b/examples/python/consolecallback.py
new file mode 100644
index 0000000..23316ce
--- /dev/null
+++ b/examples/python/consolecallback.py
@@ -0,0 +1,88 @@
+#!/usr/bin/env python
+# consolecallback - provide a persistent console that survives guest
reboots
+
+import sys, os, logging, libvirt, tty, termios, atexit
...

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120529/2d988bde/attachment-0001.sig>


More information about the libvir-list mailing list