[libvirt] [PATCH v3 02/11] virt-admin: Introduce first working skeleton
Martin Kletzander
mkletzan at redhat.com
Mon Nov 16 16:44:37 UTC 2015
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20151116/45b0884f/attachment-0001.sig>
More information about the libvir-list
mailing list