[libvirt] [PATCH 0/4] A series of FreeBSD fixes

This is a series of a few fixes to FreeBSD build in general and to the bhyve driver in general. Pushed that under the build breaker and trivial rule. However, for the first two fixes I'm not sure that's the best fix possible, so I'm open for feedback. Roman Bogorodskiy (4): nodeinfo: fix build on non-Linux hostcpu: fix build on FreeBSD bhyve: add missing virhost(cpu|mem).h headers bhyve: fix bhyvexml2arg test src/bhyve/bhyve_driver.c | 2 ++ src/nodeinfo.c | 2 ++ src/util/virhostcpu.c | 4 ++-- tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder.xml | 2 +- tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder1.xml | 2 +- tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder3.xml | 2 +- tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder4.xml | 2 +- tests/bhyvexml2argvdata/bhyvexml2argv-grub-bootorder.xml | 4 ++-- tests/bhyvexml2argvdata/bhyvexml2argv-grub-bootorder2.xml | 4 ++-- 9 files changed, 14 insertions(+), 10 deletions(-) -- 2.7.4

SYSFS_SYSTEM_PATH is only defined for Linux, however it's used outside of #ifdef __linux__ code, e.g. as the first argument to nodeCapsInitNUMAFake(). But as this argument's value is used on Linux only, it's safe to define SYSFS_SYSTEM_PATH to "fake" to get things built on FreeBSD. --- src/nodeinfo.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/nodeinfo.c b/src/nodeinfo.c index 4e344bb..b02c294 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -129,6 +129,8 @@ virNodeGetSiblingsListLinux(const char *dir, int cpu_id) VIR_FREE(path); return ret; } +#else +# define SYSFS_SYSTEM_PATH "fake" #endif -- 2.7.4

On Sun, Jun 12, 2016 at 11:10:37AM +0300, Roman Bogorodskiy wrote:
SYSFS_SYSTEM_PATH is only defined for Linux, however it's used outside of #ifdef __linux__ code, e.g. as the first argument to nodeCapsInitNUMAFake().
But as this argument's value is used on Linux only, it's safe to define SYSFS_SYSTEM_PATH to "fake" to get things built on FreeBSD. --- src/nodeinfo.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/src/nodeinfo.c b/src/nodeinfo.c index 4e344bb..b02c294 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -129,6 +129,8 @@ virNodeGetSiblingsListLinux(const char *dir, int cpu_id) VIR_FREE(path); return ret; } +#else +# define SYSFS_SYSTEM_PATH "fake" #endif
ACK Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

* Fix misspelt function name: s/virHostCPUGetStatsFreebsd/virHostCPUGetStatsFreeBSD/ * Mark the first argument to virHostCPUGetInfo with ATTRIBUTE_UNUSED as it's not actually used on non-Linux --- src/util/virhostcpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c index 72ea943..00c09cd 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -88,7 +88,7 @@ virHostCPUGetCountAppleFreeBSD(void) # define TICK_TO_NSEC (1000ull * 1000ull * 1000ull / (stathz ? stathz : hz)) static int -virHostCPUGetStatsFreebsd(int cpuNum, +virHostCPUGetStatsFreeBSD(int cpuNum, virNodeCPUStatsPtr params, int *nparams) { @@ -962,7 +962,7 @@ virHostCPUParseMapLinux(int max_cpuid, const char *path) int -virHostCPUGetInfo(virArch hostarch, +virHostCPUGetInfo(virArch hostarch ATTRIBUTE_UNUSED, unsigned int *cpus, unsigned int *mhz, unsigned int *nodes, -- 2.7.4

On Sun, Jun 12, 2016 at 11:10:38AM +0300, Roman Bogorodskiy wrote:
* Fix misspelt function name: s/virHostCPUGetStatsFreebsd/virHostCPUGetStatsFreeBSD/ * Mark the first argument to virHostCPUGetInfo with ATTRIBUTE_UNUSED as it's not actually used on non-Linux --- src/util/virhostcpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c index 72ea943..00c09cd 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -88,7 +88,7 @@ virHostCPUGetCountAppleFreeBSD(void) # define TICK_TO_NSEC (1000ull * 1000ull * 1000ull / (stathz ? stathz : hz))
static int -virHostCPUGetStatsFreebsd(int cpuNum, +virHostCPUGetStatsFreeBSD(int cpuNum, virNodeCPUStatsPtr params, int *nparams) { @@ -962,7 +962,7 @@ virHostCPUParseMapLinux(int max_cpuid, const char *path)
int -virHostCPUGetInfo(virArch hostarch, +virHostCPUGetInfo(virArch hostarch ATTRIBUTE_UNUSED, unsigned int *cpus, unsigned int *mhz, unsigned int *nodes,
ACK Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

--- src/bhyve/bhyve_driver.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index 6d21c2e..4ed5702 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -51,6 +51,8 @@ #include "cpu/cpu.h" #include "viraccessapicheck.h" #include "nodeinfo.h" +#include "virhostcpu.h" +#include "virhostmem.h" #include "bhyve_device.h" #include "bhyve_driver.h" -- 2.7.4

On Sun, Jun 12, 2016 at 11:10:39AM +0300, Roman Bogorodskiy wrote:
--- src/bhyve/bhyve_driver.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index 6d21c2e..4ed5702 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -51,6 +51,8 @@ #include "cpu/cpu.h" #include "viraccessapicheck.h" #include "nodeinfo.h" +#include "virhostcpu.h" +#include "virhostmem.h"
#include "bhyve_device.h" #include "bhyve_driver.h"
ACK Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

Don't use duplicating target dev names. --- tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder.xml | 2 +- tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder1.xml | 2 +- tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder3.xml | 2 +- tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder4.xml | 2 +- tests/bhyvexml2argvdata/bhyvexml2argv-grub-bootorder.xml | 4 ++-- tests/bhyvexml2argvdata/bhyvexml2argv-grub-bootorder2.xml | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder.xml index e58c5f1..c96e79f 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder.xml +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder.xml @@ -17,7 +17,7 @@ <disk type='file' device='cdrom'> <driver name='file' type='raw'/> <source file='/tmp/cdrom.iso'/> - <target dev='hda' bus='sata'/> + <target dev='hdb' bus='sata'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </disk> <interface type='bridge'> diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder1.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder1.xml index 6ea4631..28cfa05 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder1.xml +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder1.xml @@ -17,7 +17,7 @@ <disk type='file' device='cdrom'> <driver name='file' type='raw'/> <source file='/tmp/cdrom.iso'/> - <target dev='hda' bus='sata'/> + <target dev='hdb' bus='sata'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </disk> <interface type='bridge'> diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder3.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder3.xml index 96a8e5a..69a9d28 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder3.xml +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder3.xml @@ -16,7 +16,7 @@ <disk type='file' device='cdrom'> <driver name='file' type='raw'/> <source file='/tmp/cdrom.iso'/> - <target dev='hda' bus='sata'/> + <target dev='hdc' bus='sata'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> <boot order='1'/> </disk> diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder4.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder4.xml index 4680358..b854e74 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder4.xml +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder4.xml @@ -17,7 +17,7 @@ <disk type='file' device='cdrom'> <driver name='file' type='raw'/> <source file='/tmp/cdrom.iso'/> - <target dev='hda' bus='sata'/> + <target dev='hdb' bus='sata'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> <boot order='1'/> </disk> diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-grub-bootorder.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-grub-bootorder.xml index e372024..9906cac 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-grub-bootorder.xml +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-grub-bootorder.xml @@ -17,13 +17,13 @@ <disk type='file'> <driver name='file' type='raw'/> <source file='/tmp/freebsd2.img'/> - <target dev='hda' bus='sata'/> + <target dev='hdb' bus='sata'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </disk> <disk type='file'> <driver name='file' type='raw'/> <source file='/tmp/freebsd3.img'/> - <target dev='hda' bus='sata'/> + <target dev='hdc' bus='sata'/> <boot order='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </disk> diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-grub-bootorder2.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-grub-bootorder2.xml index 8742a30..65943f9 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-grub-bootorder2.xml +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-grub-bootorder2.xml @@ -18,14 +18,14 @@ <disk type='file'> <driver name='file' type='raw'/> <source file='/tmp/freebsd2.img'/> - <target dev='hda' bus='sata'/> + <target dev='hdb' bus='sata'/> <boot order='22'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </disk> <disk type='file'> <driver name='file' type='raw'/> <source file='/tmp/freebsd3.img'/> - <target dev='hda' bus='sata'/> + <target dev='hdc' bus='sata'/> <boot order='3'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </disk> -- 2.7.4

On Sun, Jun 12, 2016 at 11:10:40AM +0300, Roman Bogorodskiy wrote:
Don't use duplicating target dev names. --- tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder.xml | 2 +- tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder1.xml | 2 +- tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder3.xml | 2 +- tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-bootorder4.xml | 2 +- tests/bhyvexml2argvdata/bhyvexml2argv-grub-bootorder.xml | 4 ++-- tests/bhyvexml2argvdata/bhyvexml2argv-grub-bootorder2.xml | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-)
ACK Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
participants (2)
-
Daniel P. Berrange
-
Roman Bogorodskiy