Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM centos:7
MAINTAINER Hyper Developers <dev@hyper.sh>

RUN yum install -y patch gcc ncurses-devel make openssl-devel bc
RUN yum install -y patch gcc ncurses-devel make openssl-devel bc perl

ENV KERNEL_VERSION 4.4.28
ENV LOCALVERSION -hyper
Expand Down
Binary file modified build/kernel
Binary file not shown.
20 changes: 18 additions & 2 deletions build/kernel_config
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ CONFIG_NET_ACT_CONNMARK=m
CONFIG_NET_CLS_IND=y
CONFIG_NET_SCH_FIFO=y
CONFIG_DCB=y
# CONFIG_DNS_RESOLVER is not set
CONFIG_DNS_RESOLVER=m
# CONFIG_BATMAN_ADV is not set
CONFIG_OPENVSWITCH=m
CONFIG_OPENVSWITCH_GRE=m
Expand Down Expand Up @@ -2059,8 +2059,23 @@ CONFIG_TMPFS_XATTR=y
# CONFIG_CONFIGFS_FS is not set
# CONFIG_MISC_FILESYSTEMS is not set
CONFIG_NETWORK_FILESYSTEMS=y
# CONFIG_NFS_FS is not set
CONFIG_NFS_FS=m
CONFIG_NFS_V2=m
CONFIG_NFS_V3=m
# CONFIG_NFS_V3_ACL is not set
CONFIG_NFS_V4=m
# CONFIG_NFS_SWAP is not set
# CONFIG_NFS_V4_1 is not set
# CONFIG_NFS_USE_LEGACY_DNS is not set
CONFIG_NFS_USE_KERNEL_DNS=y
# CONFIG_NFSD is not set
CONFIG_GRACE_PERIOD=m
CONFIG_LOCKD=m
CONFIG_LOCKD_V4=y
CONFIG_NFS_COMMON=y
CONFIG_SUNRPC=m
CONFIG_SUNRPC_GSS=m
# CONFIG_SUNRPC_DEBUG is not set
# CONFIG_CEPH_FS is not set
# CONFIG_CIFS is not set
# CONFIG_NCP_FS is not set
Expand Down Expand Up @@ -2484,6 +2499,7 @@ CONFIG_NLATTR=y
CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
# CONFIG_CORDIC is not set
# CONFIG_DDR is not set
CONFIG_OID_REGISTRY=m
# CONFIG_SG_SPLIT is not set
CONFIG_ARCH_HAS_SG_CHAIN=y
CONFIG_ARCH_HAS_PMEM_API=y
Expand Down
1 change: 1 addition & 0 deletions build/make-initrd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ cp ../src/init /tmp/hyperstart-rootfs
cp busybox /tmp/hyperstart-rootfs
cp iptables /tmp/hyperstart-rootfs
cp libm.so.6 /tmp/hyperstart-rootfs/lib64/
cp mount.nfs /tmp/hyperstart-rootfs/sbin/mount.nfs4

if [ "$1"x = "aarch64"x ]; then
echo "build hyperstart for aarch64"
Expand Down
Binary file modified build/modules.tar
Binary file not shown.
Binary file added build/mount.nfs
Binary file not shown.
28 changes: 19 additions & 9 deletions src/container.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,23 +113,33 @@ static int container_setup_volume(struct hyper_container *container)
sprintf(path, "/tmp/%s", vol->mountpoint);
sprintf(mountpoint, "./%s", vol->mountpoint);

fprintf(stdout, "mount %s to %s, tmp path %s\n",
dev, vol->mountpoint, path);

if (hyper_mkdir(path, 0755) < 0) {
perror("create volume dir failed");
return -1;
}

if (!strncmp(vol->fstype, "xfs", strlen("xfs")))
options = "nouuid";
if (!strcmp(vol->fstype, "nfs")) {
fprintf(stdout, "mount nfs share %s to %s, tmp path %s\n",
vol->device, vol->mountpoint, path);

if (mount(dev, path, vol->fstype, 0, options) < 0) {
perror("mount volume device failed");
return -1;
if (hyper_mount_nfs(vol->device, path) < 0)
return -1;
/* nfs export has implicitly included _data part of the volume */
sprintf(volume, "/%s/", path);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this affect container_populate_volume?

Copy link
Member Author

@bergwolf bergwolf Jan 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update: yes it does. populate will be disabled with nfs volumes, mostly because if the client creates a _data directory, it will be visible to the server and violates the idea of importing volumes from server because _data directory is not really a volume mountpoint of the server.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine, this pr LGTM

} else {
fprintf(stdout, "mount %s to %s, tmp path %s\n",
dev, vol->mountpoint, path);

if (!strcmp(vol->fstype, "xfs"))
options = "nouuid";

if (mount(dev, path, vol->fstype, 0, options) < 0) {
perror("mount volume device failed");
return -1;
}
sprintf(volume, "/%s/_data", path);
}

sprintf(volume, "/%s/_data", path);
if (container_check_file_volume(volume, &filevolume) < 0)
return -1;

Expand Down
8 changes: 8 additions & 0 deletions src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -703,3 +703,11 @@ ssize_t nonblock_read(int fd, void *buf, size_t count)

return len > 0 ? len : ret;
}

int hyper_mount_nfs(char *server, char *mountpoint)
{
char cmd[512];
snprintf(cmd, sizeof(cmd), "mount.nfs4 -n %s %s", server, mountpoint);

return hyper_cmd(cmd);
}
1 change: 1 addition & 0 deletions src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ struct passwd *hyper_getpwnam(const char *name);
struct group *hyper_getgrnam(const char *name);
int hyper_getgrouplist(const char *user, gid_t group, gid_t *groups, int *ngroups);
ssize_t nonblock_read(int fd, void *buf, size_t count);
int hyper_mount_nfs(char *server, char *mountpoint);
#endif