[libvirt] [PATCH 1/N] qemu driver FreeBSD support: fix compilation

Daniel P. Berrange berrange at redhat.com
Tue Dec 11 19:56:52 UTC 2012


On Tue, Dec 11, 2012 at 01:33:33PM -0600, Doug Goldstein wrote:
> On Tue, Dec 11, 2012 at 1:08 PM, Roman Bogorodskiy
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index ab04599..5d355eb 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -27,7 +27,12 @@
>  #include <sys/stat.h>
>  #include <sys/time.h>
>  #include <sys/resource.h>
> +#if defined(__linux__)
>  #include <linux/capability.h>
> +#elif defined(__FreeBSD__)
> +#include <sys/param.h>
> +#include <sys/cpuset.h>
> +#endif
> 
>  #include "qemu_process.h"
>  #include "qemu_domain.h"
> @@ -3707,7 +3712,12 @@ int qemuProcessStart(virConnectPtr conn,
>      /* in case a certain disk is desirous of CAP_SYS_RAWIO, add this */
>      for (i = 0; i < vm->def->ndisks; i++) {
>          if (vm->def->disks[i]->rawio == 1)
> +#ifdef CAP_SYS_RAWIO
>              virCommandAllowCap(cmd, CAP_SYS_RAWIO);
> +#else
> +            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                           _("Raw I/O is not supported on this platform"));
> +#endif
>      }
> 
> It probably would be better to not allow VMs to be defined with rawio
> enabled if this the case. You'll want to make these changes in
> src/conf/domain_conf.c

No, the XML parser should not apply semantic checks while
parsing. We've been down that route before and it wasn't
pretty. Using VIR_ERR_CONFIG_UNSUPPORTED is the correct
approach here.

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




More information about the libvir-list mailing list