mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-21 07:21:15 +00:00
scripts: Export devices(/dev/kvm or /dev/mshv) based on hypervisor
Signed-off-by: Muminul Islam <muislam@microsoft.com>
This commit is contained in:
parent
276c9a10fd
commit
b339aa6b88
@ -208,7 +208,7 @@ cmd_build() {
|
|||||||
libc="gnu"
|
libc="gnu"
|
||||||
hypervisor="kvm"
|
hypervisor="kvm"
|
||||||
features_build=""
|
features_build=""
|
||||||
|
exported_device="/dev/kvm"
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"-h"|"--help") { cmd_help; exit 1; } ;;
|
"-h"|"--help") { cmd_help; exit 1; } ;;
|
||||||
@ -245,7 +245,9 @@ cmd_build() {
|
|||||||
if [[ "$hypervisor" != "kvm" ]]; then
|
if [[ "$hypervisor" != "kvm" ]]; then
|
||||||
die "Hypervisor value must be kvm"
|
die "Hypervisor value must be kvm"
|
||||||
fi
|
fi
|
||||||
|
if [[ "$hypervisor" = "mshv" ]]; then
|
||||||
|
exported_device="/dev/mshv"
|
||||||
|
fi
|
||||||
target="$(uname -m)-unknown-linux-${libc}"
|
target="$(uname -m)-unknown-linux-${libc}"
|
||||||
|
|
||||||
cargo_args=("$@")
|
cargo_args=("$@")
|
||||||
@ -263,7 +265,7 @@ cmd_build() {
|
|||||||
--user "$(id -u):$(id -g)" \
|
--user "$(id -u):$(id -g)" \
|
||||||
--workdir "$CTR_CLH_ROOT_DIR" \
|
--workdir "$CTR_CLH_ROOT_DIR" \
|
||||||
--rm \
|
--rm \
|
||||||
--volume /dev:/dev \
|
--volume $exported_device \
|
||||||
--volume "$CLH_ROOT_DIR:$CTR_CLH_ROOT_DIR" $exported_volumes \
|
--volume "$CLH_ROOT_DIR:$CTR_CLH_ROOT_DIR" $exported_volumes \
|
||||||
--env RUSTFLAGS="$rustflags" \
|
--env RUSTFLAGS="$rustflags" \
|
||||||
"$CTR_IMAGE" \
|
"$CTR_IMAGE" \
|
||||||
@ -300,6 +302,7 @@ cmd_tests() {
|
|||||||
libc="gnu"
|
libc="gnu"
|
||||||
arg_vols=""
|
arg_vols=""
|
||||||
hypervisor="kvm"
|
hypervisor="kvm"
|
||||||
|
exported_device="/dev/kvm"
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"-h"|"--help") { cmd_help; exit 1; } ;;
|
"-h"|"--help") { cmd_help; exit 1; } ;;
|
||||||
@ -333,6 +336,9 @@ cmd_tests() {
|
|||||||
if [[ "$hypervisor" != "kvm" ]]; then
|
if [[ "$hypervisor" != "kvm" ]]; then
|
||||||
die "Hypervisor value must be kvm"
|
die "Hypervisor value must be kvm"
|
||||||
fi
|
fi
|
||||||
|
if [[ "$hypervisor" = "mshv" ]]; then
|
||||||
|
exported_device="/dev/mshv"
|
||||||
|
fi
|
||||||
set -- "$@" '--hypervisor' $hypervisor
|
set -- "$@" '--hypervisor' $hypervisor
|
||||||
|
|
||||||
ensure_build_dir
|
ensure_build_dir
|
||||||
@ -354,7 +360,7 @@ cmd_tests() {
|
|||||||
$DOCKER_RUNTIME run \
|
$DOCKER_RUNTIME run \
|
||||||
--workdir "$CTR_CLH_ROOT_DIR" \
|
--workdir "$CTR_CLH_ROOT_DIR" \
|
||||||
--rm \
|
--rm \
|
||||||
--device /dev/kvm \
|
--device $exported_device \
|
||||||
--device /dev/net/tun \
|
--device /dev/net/tun \
|
||||||
--cap-add net_admin \
|
--cap-add net_admin \
|
||||||
--volume "$CLH_ROOT_DIR:$CTR_CLH_ROOT_DIR" $exported_volumes \
|
--volume "$CLH_ROOT_DIR:$CTR_CLH_ROOT_DIR" $exported_volumes \
|
||||||
|
Loading…
Reference in New Issue
Block a user