Re: [PATCH v3 02/11] virt-admin: Introduce first working skeleton

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

 



On Fri, Nov 06, 2015 at 12:46:17PM +0100, Erik Skultety wrote:
This patch introduces virt-admin client which is based on virsh client,
but had to reimplement several methods to meet virt-admin specific needs
or remove unnecessary virsh specific logic.
---
.gitignore         |   1 +
po/POTFILES.in     |   1 +
tools/Makefile.am  |  26 ++-
tools/virt-admin.c | 556 +++++++++++++++++++++++++++++++++++++++++++++++++++++
tools/virt-admin.h |  46 +++++
5 files changed, 628 insertions(+), 2 deletions(-)
create mode 100644 tools/virt-admin.c
create mode 100644 tools/virt-admin.h

diff --git a/tools/virt-admin.c b/tools/virt-admin.c
new file mode 100644
index 0000000..ddfba91
--- /dev/null
+++ b/tools/virt-admin.c
[...]
+static bool
+vshAdmInit(vshControl *ctl)
+{
+    vshAdmControlPtr priv = ctl->privData;
+
+    /* Since we have the commandline arguments parsed, we need to
+     * reload our initial settings to make debugging and readline
+     * work properly */
+    vshInitReload(ctl);
+
+    if (priv->conn)
+        return false;
+
+    /* set up the library error handler */
+    virSetErrorFunc(NULL, vshErrorHandler);
+
+    if (virEventRegisterDefaultImpl() < 0)
+        return false;
+
+    if (virThreadCreate(&ctl->eventLoop, true, vshEventLoop, ctl) < 0)
+        return false;
+    ctl->eventLoopStarted = true;
+
+    if ((ctl->eventTimerId = virEventAddTimeout(-1, vshEventTimeout, ctl,

I forgot to mention that you could allow virEventAddTimeout() to allow
NULL callback and then get rid of the vshEventTimeout here.  It
confuses readers.

Martin

Attachment: signature.asc
Description: PGP signature

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