mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-05 13:05:45 +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"
|
||||
hypervisor="kvm"
|
||||
features_build=""
|
||||
|
||||
exported_device="/dev/kvm"
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
"-h"|"--help") { cmd_help; exit 1; } ;;
|
||||
@ -245,7 +245,9 @@ cmd_build() {
|
||||
if [[ "$hypervisor" != "kvm" ]]; then
|
||||
die "Hypervisor value must be kvm"
|
||||
fi
|
||||
|
||||
if [[ "$hypervisor" = "mshv" ]]; then
|
||||
exported_device="/dev/mshv"
|
||||
fi
|
||||
target="$(uname -m)-unknown-linux-${libc}"
|
||||
|
||||
cargo_args=("$@")
|
||||
@ -263,7 +265,7 @@ cmd_build() {
|
||||
--user "$(id -u):$(id -g)" \
|
||||
--workdir "$CTR_CLH_ROOT_DIR" \
|
||||
--rm \
|
||||
--volume /dev:/dev \
|
||||
--volume $exported_device \
|
||||
--volume "$CLH_ROOT_DIR:$CTR_CLH_ROOT_DIR" $exported_volumes \
|
||||
--env RUSTFLAGS="$rustflags" \
|
||||
"$CTR_IMAGE" \
|
||||
@ -300,6 +302,7 @@ cmd_tests() {
|
||||
libc="gnu"
|
||||
arg_vols=""
|
||||
hypervisor="kvm"
|
||||
exported_device="/dev/kvm"
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
"-h"|"--help") { cmd_help; exit 1; } ;;
|
||||
@ -333,6 +336,9 @@ cmd_tests() {
|
||||
if [[ "$hypervisor" != "kvm" ]]; then
|
||||
die "Hypervisor value must be kvm"
|
||||
fi
|
||||
if [[ "$hypervisor" = "mshv" ]]; then
|
||||
exported_device="/dev/mshv"
|
||||
fi
|
||||
set -- "$@" '--hypervisor' $hypervisor
|
||||
|
||||
ensure_build_dir
|
||||
@ -354,7 +360,7 @@ cmd_tests() {
|
||||
$DOCKER_RUNTIME run \
|
||||
--workdir "$CTR_CLH_ROOT_DIR" \
|
||||
--rm \
|
||||
--device /dev/kvm \
|
||||
--device $exported_device \
|
||||
--device /dev/net/tun \
|
||||
--cap-add net_admin \
|
||||
--volume "$CLH_ROOT_DIR:$CTR_CLH_ROOT_DIR" $exported_volumes \
|
||||
|
Loading…
Reference in New Issue
Block a user