diff --git a/Makefile.am b/Makefile.am index 14429e85..552cb232 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,6 +5,12 @@ else XEN_BUILD_TAG= endif +if WITH_XEN490 +XEN490_BUILD_TAG=with_xen490 +else +XEN490_BUILD_TAG= +endif + if WITH_LIBVIRT LIBVIRT_BUILD_TAG=with_libvirt else @@ -13,7 +19,7 @@ endif COMMIT=`git describe --dirty --always --tags 2> /dev/null || true` GOLDFLAGS="-X main.gitCommit=${COMMIT} -X main.version=${VERSION}" -HYPER_BULD_TAGS=$(XEN_BUILD_TAG) $(LIBVIRT_BUILD_TAG) +HYPER_BULD_TAGS=$(XEN_BUILD_TAG) $(XEN490_BUILD_TAG) $(LIBVIRT_BUILD_TAG) all-local: build-runv clean-local: diff --git a/configure.ac b/configure.ac index 4df07fdc..80d80643 100644 --- a/configure.ac +++ b/configure.ac @@ -70,11 +70,23 @@ if test "x$with_xen" != "xno" ; then fi fi +XEN_REQUIRED="4.5.0" +XENPV_REQUIRED="4.9.0" + +if test "$with_xen" = yes; then + PKG_CHECK_MODULES([xen_4_5], [xenlight >= $XEN_REQUIRED], [with_xen=yes], [with_xen=no]) + PKG_CHECK_MODULES([xen_4_9], [xenlight >= $XENPV_REQUIRED], [with_xen490=yes], [with_xen490=no]) +fi + if test "x$with_xen" != "xno" ; then - AC_DEFINE_UNQUOTED([WITH_XEN], 1, [run hyperd with xen]) + AC_DEFINE_UNQUOTED([WITH_XEN], 1, [run runv with xen]) +fi +if test "x$with_xen490" = "xyes" ; then + AC_DEFINE_UNQUOTED([WITH_XEN490], 1, [run runv with xen 4.9 or above]) fi AM_CONDITIONAL([WITH_XEN], [test "x$with_xen" == "xyes"]) +AM_CONDITIONAL([WITH_XEN490], [test "x$with_xen490" == "xyes"]) AC_CONFIG_FILES([Makefile]) diff --git a/hypervisor/xen/xen.go b/hypervisor/xen/xen.go index 88c06ad5..fef58382 100644 --- a/hypervisor/xen/xen.go +++ b/hypervisor/xen/xen.go @@ -255,7 +255,7 @@ func (xc *XenContext) AddNic(ctx *hypervisor.VmContext, host *hypervisor.HostNic glog.V(1).Infof("add network for %d - ip: %s, br: %s, gw: %s, dev: %s, hw: %s", xc.domId, guest.Ipaddr, host.Bridge, host.Bridge, dev, hw.String()) - res := HyperxlNicAdd(xc.driver.Ctx, (uint32)(xc.domId), guest.Ipaddr[0], host.Bridge, host.Bridge, dev, []byte(hw)) + res := HyperxlNicAdd(xc.driver.Ctx, (uint32)(xc.domId), guest.Ipaddr, host.Bridge, host.Bridge, dev, []byte(hw)) if res != 0 { glog.V(1).Infof("nic %s insert succeeded [faked] ", guest.Device) result <- callback diff --git a/hypervisor/xenpv/xenpv.go b/hypervisor/xenpv/xenpv.go index e9590520..048ced6f 100644 --- a/hypervisor/xenpv/xenpv.go +++ b/hypervisor/xenpv/xenpv.go @@ -1,4 +1,4 @@ -// +build linux,with_xen +// +build linux,with_xen490 package xenpv diff --git a/hypervisor/xenpv/xenpv_unsupported.go b/hypervisor/xenpv/xenpv_unsupported.go index e4fd67a2..75127e53 100644 --- a/hypervisor/xenpv/xenpv_unsupported.go +++ b/hypervisor/xenpv/xenpv_unsupported.go @@ -1,4 +1,4 @@ -// +build !with_xen +// +build !with_xen490 package xenpv diff --git a/lib/runvxenlight/xenlight-runv.go b/lib/runvxenlight/xenlight-runv.go index 1c8db959..bd541e43 100644 --- a/lib/runvxenlight/xenlight-runv.go +++ b/lib/runvxenlight/xenlight-runv.go @@ -1,4 +1,4 @@ -// +build linux,with_xen +// +build linux,with_xen490 /* * @@ -54,6 +54,8 @@ static int runvxl_domain_create_new(libxl_ctx *ctx, runvxl_domain_config *config libxl_domain_config_init(&d_config); d_config.num_p9s = 1; +#ifndef LIBXL_HAVE_P9S +//this flag is introduce since tag 4.10.0-rc1, introduce a field rename d_config.p9 = malloc(sizeof(libxl_device_p9)); if (d_config.p9 == NULL) { return -1; @@ -61,6 +63,16 @@ static int runvxl_domain_create_new(libxl_ctx *ctx, runvxl_domain_config *config d_config.p9->tag = config->p9_tag; d_config.p9->path = config->p9_path; d_config.p9->security_model = "none"; +#else //LIBXL_HAVE_P9S + d_config.p9s = malloc(sizeof(libxl_device_p9)); + if (d_config.p9s == NULL) { + return -1; + } + d_config.p9s->tag = config->p9_tag; + d_config.p9s->path = config->p9_path; + d_config.p9s->security_model = "none"; +#endif //LIBXL_HAVE_P9S + d_config.num_channels = 2; d_config.channels = malloc(sizeof(libxl_device_channel) * 2); diff --git a/lib/runvxenlight/xenlight.go b/lib/runvxenlight/xenlight.go index 9c37e59e..f98bd812 100644 --- a/lib/runvxenlight/xenlight.go +++ b/lib/runvxenlight/xenlight.go @@ -1,3 +1,5 @@ +// +build linux,with_xen490 + /* * Copyright (C) 2016 George W. Dunlap, Citrix Systems UK Ltd *