Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit d5f31bd

Browse files
authored
Merge pull request #646 from gnawux/fix_xenbuild
Fix xen build
2 parents b761a8c + 442f737 commit d5f31bd

File tree

7 files changed

+38
-6
lines changed

7 files changed

+38
-6
lines changed

Makefile.am

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ else
55
XEN_BUILD_TAG=
66
endif
77

8+
if WITH_XEN490
9+
XEN490_BUILD_TAG=with_xen490
10+
else
11+
XEN490_BUILD_TAG=
12+
endif
13+
814
if WITH_LIBVIRT
915
LIBVIRT_BUILD_TAG=with_libvirt
1016
else
@@ -13,7 +19,7 @@ endif
1319

1420
COMMIT=`git describe --dirty --always --tags 2> /dev/null || true`
1521
GOLDFLAGS="-X main.gitCommit=${COMMIT} -X main.version=${VERSION}"
16-
HYPER_BULD_TAGS=$(XEN_BUILD_TAG) $(LIBVIRT_BUILD_TAG)
22+
HYPER_BULD_TAGS=$(XEN_BUILD_TAG) $(XEN490_BUILD_TAG) $(LIBVIRT_BUILD_TAG)
1723

1824
all-local: build-runv
1925
clean-local:

configure.ac

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,23 @@ if test "x$with_xen" != "xno" ; then
7070
fi
7171
fi
7272

73+
XEN_REQUIRED="4.5.0"
74+
XENPV_REQUIRED="4.9.0"
75+
76+
if test "$with_xen" = yes; then
77+
PKG_CHECK_MODULES([xenlight], [xenlight >= $XEN_REQUIRED], [with_xen=yes], [with_xen=no])
78+
PKG_CHECK_MODULES([xenlight], [xenlight >= $XENPV_REQUIRED], [with_xen490=yes], [with_xen490=no])
79+
fi
80+
7381
if test "x$with_xen" != "xno" ; then
74-
AC_DEFINE_UNQUOTED([WITH_XEN], 1, [run hyperd with xen])
82+
AC_DEFINE_UNQUOTED([WITH_XEN], 1, [run runv with xen])
83+
fi
84+
if test "x$with_xen490" = "xyes" ; then
85+
AC_DEFINE_UNQUOTED([WITH_XEN490], 1, [run runv with xen 4.9 or above])
7586
fi
7687

7788
AM_CONDITIONAL([WITH_XEN], [test "x$with_xen" == "xyes"])
89+
AM_CONDITIONAL([WITH_XEN490], [test "x$with_xen490" == "xyes"])
7890

7991
AC_CONFIG_FILES([Makefile])
8092

hypervisor/xen/xen.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ func (xc *XenContext) AddNic(ctx *hypervisor.VmContext, host *hypervisor.HostNic
255255
glog.V(1).Infof("add network for %d - ip: %s, br: %s, gw: %s, dev: %s, hw: %s", xc.domId, guest.Ipaddr,
256256
host.Bridge, host.Bridge, dev, hw.String())
257257

258-
res := HyperxlNicAdd(xc.driver.Ctx, (uint32)(xc.domId), guest.Ipaddr[0], host.Bridge, host.Bridge, dev, []byte(hw))
258+
res := HyperxlNicAdd(xc.driver.Ctx, (uint32)(xc.domId), guest.Ipaddr, host.Bridge, host.Bridge, dev, []byte(hw))
259259
if res != 0 {
260260
glog.V(1).Infof("nic %s insert succeeded [faked] ", guest.Device)
261261
result <- callback

hypervisor/xenpv/xenpv.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// +build linux,with_xen
1+
// +build linux,with_xen490
22

33
package xenpv
44

hypervisor/xenpv/xenpv_unsupported.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// +build !with_xen
1+
// +build !with_xen490
22

33
package xenpv
44

lib/runvxenlight/xenlight-runv.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// +build linux,with_xen
1+
// +build linux,with_xen490
22

33
/*
44
*
@@ -54,13 +54,25 @@ static int runvxl_domain_create_new(libxl_ctx *ctx, runvxl_domain_config *config
5454
libxl_domain_config_init(&d_config);
5555
5656
d_config.num_p9s = 1;
57+
#ifndef LIBXL_HAVE_P9S
58+
//this flag is introduce since tag 4.10.0-rc1, introduce a field rename
5759
d_config.p9 = malloc(sizeof(libxl_device_p9));
5860
if (d_config.p9 == NULL) {
5961
return -1;
6062
}
6163
d_config.p9->tag = config->p9_tag;
6264
d_config.p9->path = config->p9_path;
6365
d_config.p9->security_model = "none";
66+
#else //LIBXL_HAVE_P9S
67+
d_config.p9s = malloc(sizeof(libxl_device_p9));
68+
if (d_config.p9s == NULL) {
69+
return -1;
70+
}
71+
d_config.p9s->tag = config->p9_tag;
72+
d_config.p9s->path = config->p9_path;
73+
d_config.p9s->security_model = "none";
74+
#endif //LIBXL_HAVE_P9S
75+
6476
6577
d_config.num_channels = 2;
6678
d_config.channels = malloc(sizeof(libxl_device_channel) * 2);

lib/runvxenlight/xenlight.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// +build linux,with_xen490
2+
13
/*
24
* Copyright (C) 2016 George W. Dunlap, Citrix Systems UK Ltd
35
*

0 commit comments

Comments
 (0)