[PATCH 0/1] Rewrite virt-host-validate in Go & Go packaging complication

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

 



This series contains code I mostly wrote some 6 months ago
as an experiment. I've tidied it up and attempted to integrate
it into the libvirt build system.

Overall I much prefer the new impl of virt-host-validate, as
explained in the commit message, I've wanted todo it this way
for a long time, but was put off by C's XML handling verbosity.

The main problem I've hit in integrating this work is the RPM
build process integration.

When building interactively, Go will dynamically download the
3rd party deps from git, similar to how we dynamically pull
down gnulib. The difference is that this must happen for end
users using tarballs too, not just devs usingn git.

We could bundle the deps with our tarball the same way we do
with gnulib, but Fedora would not accept using this, as it
wants unbundled Go deps.

I've done some things in the spec which makes this work
against unbundled sources, but this still fails in mock as
we don't get the build-id set in the resulting binary. I
have attempted to fix that by passing extra flags to go
build, but it still fails, so I've got some bug there. The
resulting spec rules are very very very unpleasant, having
to hardcode a bunch of build flags we should never touch.

I've spoken with Nichlos Mailhot who is the Fedora Go
packaging expert, who has basically confirmed my experiance
that there is no nice solution to what I'm trying todo with
the build process. He strongly recommends that we do *not*
try to integrate Go into our existing build process, and that
we instead keep any Go code as a completely seperate git repo
that we build & install separately. This would make the
RPM packaging much much simpler to deal with.

Given what I've tried here, I'm inclined to agree with his
recommendation.

In the case of virt-host-validate, this is actually quite
a straightforward thing to deal with, as the new impl of
virt-host-validate has no direct dep wrt existing lkibvirt
code in either direction. So we can trivially put it in a
separate git repo. We would merely need an RPM dep from
libvirt.spec.in to make the sure the external  project
gets pulled in on install of libvirt-daemon.

Thus this patch is *NOT* something I'm proposing to merge
as is. The code itself is fine, but it will need to go into
a new git repo of its own.

Daniel P. Berrangé (1):
  tools: rewrite virt-host-validate in Go to be data driven

 configure.ac                                 |   1 +
 libvirt.spec.in                              |  23 +
 m4/virt-golang.m4                            |  46 ++
 m4/virt-host-validate.m4                     |   8 +-
 po/POTFILES                                  |   5 -
 tools/Makefile.am                            |  59 +-
 tools/host-validate/go.mod                   |   8 +
 tools/host-validate/go.sum                   |   4 +
 tools/host-validate/main.go                  |  98 +++
 tools/host-validate/pkg/engine.go            | 469 +++++++++++
 tools/host-validate/pkg/facts.go             | 784 +++++++++++++++++++
 tools/host-validate/pkg/facts_test.go        |  67 ++
 tools/host-validate/pkg/xml_utils.go         | 287 +++++++
 tools/host-validate/rules/acpi.xml           |  29 +
 tools/host-validate/rules/builtin.xml        |  33 +
 tools/host-validate/rules/cgroups.xml        | 403 ++++++++++
 tools/host-validate/rules/cpu.xml            | 148 ++++
 tools/host-validate/rules/devices.xml        |  54 ++
 tools/host-validate/rules/freebsd-kernel.xml |  14 +
 tools/host-validate/rules/iommu.xml          |  93 +++
 tools/host-validate/rules/namespaces.xml     |  94 +++
 tools/host-validate/rules/pci.xml            |   9 +
 tools/virt-host-validate-bhyve.c             |  77 --
 tools/virt-host-validate-bhyve.h             |  24 -
 tools/virt-host-validate-common.c            | 419 ----------
 tools/virt-host-validate-common.h            |  85 --
 tools/virt-host-validate-lxc.c               |  87 --
 tools/virt-host-validate-lxc.h               |  24 -
 tools/virt-host-validate-qemu.c              | 116 ---
 tools/virt-host-validate-qemu.h              |  24 -
 tools/virt-host-validate.c                   | 152 ----
 tools/virt-host-validate.pod                 |  12 +-
 32 files changed, 2693 insertions(+), 1063 deletions(-)
 create mode 100644 m4/virt-golang.m4
 create mode 100644 tools/host-validate/go.mod
 create mode 100644 tools/host-validate/go.sum
 create mode 100644 tools/host-validate/main.go
 create mode 100644 tools/host-validate/pkg/engine.go
 create mode 100644 tools/host-validate/pkg/facts.go
 create mode 100644 tools/host-validate/pkg/facts_test.go
 create mode 100644 tools/host-validate/pkg/xml_utils.go
 create mode 100644 tools/host-validate/rules/acpi.xml
 create mode 100644 tools/host-validate/rules/builtin.xml
 create mode 100644 tools/host-validate/rules/cgroups.xml
 create mode 100644 tools/host-validate/rules/cpu.xml
 create mode 100644 tools/host-validate/rules/devices.xml
 create mode 100644 tools/host-validate/rules/freebsd-kernel.xml
 create mode 100644 tools/host-validate/rules/iommu.xml
 create mode 100644 tools/host-validate/rules/namespaces.xml
 create mode 100644 tools/host-validate/rules/pci.xml
 delete mode 100644 tools/virt-host-validate-bhyve.c
 delete mode 100644 tools/virt-host-validate-bhyve.h
 delete mode 100644 tools/virt-host-validate-common.c
 delete mode 100644 tools/virt-host-validate-common.h
 delete mode 100644 tools/virt-host-validate-lxc.c
 delete mode 100644 tools/virt-host-validate-lxc.h
 delete mode 100644 tools/virt-host-validate-qemu.c
 delete mode 100644 tools/virt-host-validate-qemu.h
 delete mode 100644 tools/virt-host-validate.c

-- 
2.21.0

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

  Powered by Linux