File tree 6 files changed +49
-3
lines changed
6 files changed +49
-3
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+
3
+ - name : " Download the QEMU package with Azure's SNP patches"
4
+ get_url :
5
+ url : " https://github.com/jepio/AMDSEV/releases/download/v2024.02.24/snp-qemu_2024.10.28-0_amd64.deb"
6
+ dest : " /tmp/snp-qemu.deb"
7
+ mode : ' 0644'
8
+
9
+ - name : " Install the new QEMU package"
10
+ become : true
11
+ apt :
12
+ deb : " /tmp/snp-qemu.deb"
13
+ state : present
14
+
Original file line number Diff line number Diff line change 9
9
# reboot)
10
10
- include_tasks : tasks/docker.yaml
11
11
- include_tasks : tasks/update_host_kernel.yaml
12
+ - include_tasks : tasks/qemu.yaml
12
13
- include_tasks : tasks/rust.yaml
13
14
- include_tasks : tasks/code.yaml
14
15
- include_tasks : tasks/pull_images.yaml
Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ THIS_DIR=$(dirname $(readlink -f $0))
6
6
PROJ_ROOT=${THIS_DIR} /..
7
7
VENV_PATH=" ${PROJ_ROOT} /venv"
8
8
9
- PYTHON=python3.10
10
9
PIP=${VENV_PATH} /bin/pip3
11
10
12
11
function pip_cmd {
@@ -16,7 +15,7 @@ function pip_cmd {
16
15
pushd ${PROJ_ROOT} >> /dev/null
17
16
18
17
if [ ! -d ${VENV_PATH} ]; then
19
- ${PYTHON} -m venv ${VENV_PATH}
18
+ python3 -m venv ${VENV_PATH}
20
19
fi
21
20
22
21
pip_cmd install -U pip setuptools wheel
Original file line number Diff line number Diff line change 49
49
echo " sc2-deploy: WARN: neither SNP nor TDX is enabled"
50
50
fi
51
51
52
+ if [ " $( sudo dmidecode -s system-manufacturer 2> /dev/null) " == " Microsoft Corporation" ]; then
53
+ export SC2_ON_AZURE=" yes"
54
+ else
55
+ export SC2_ON_AZURE=" no"
56
+ fi
57
+
52
58
# ----------------------------------
53
59
# VM cache config
54
60
# ----------------------------------
@@ -71,11 +77,17 @@ export PS1="(sc2-deploy) $PS1"
71
77
# Splash
72
78
# -----------------------------
73
79
80
+ if [ " $SC2_ON_AZURE " == " yes" ]; then
81
+ tee_str=" ${TEE} -azure"
82
+ else
83
+ tee_str=" ${TEE} "
84
+ fi
85
+
74
86
echo " "
75
87
echo " ----------------------------------"
76
88
echo " CLI for SC2 Deployment Scripts"
77
89
echo " CoCo Version: ${COCO_VERSION} "
78
- echo " TEE: ${TEE } "
90
+ echo " TEE: ${tee_str } "
79
91
echo " ----------------------------------"
80
92
echo " "
81
93
Original file line number Diff line number Diff line change 25
25
install as operator_install ,
26
26
install_cc_runtime as operator_install_cc_runtime ,
27
27
)
28
+ from tasks .util .azure import on_azure
28
29
from tasks .util .containerd import restart_containerd
29
30
from tasks .util .env import (
30
31
COCO_ROOT ,
@@ -142,6 +143,17 @@ def install_sc2_runtime(debug=False):
142
143
)
143
144
update_toml (dst_conf_path , updated_toml_str )
144
145
146
+ # If running on Azure, point QEMU to the system-wide qemu
147
+ if on_azure ():
148
+ qemu_path = "/usr/local/bin/qemu-system-x86_64"
149
+ updated_toml_str = """
150
+ [hypervisor.qemu]
151
+ path = "{qemu_path}"
152
+ valid_hypervisor_paths = [ "{qemu_path}" ]
153
+ """ .format (qemu_path = qemu_path )
154
+
155
+ update_toml (dst_conf_path , updated_toml_str )
156
+
145
157
# Update containerd to point the SC2 runtime to the right config
146
158
updated_toml_str = """
147
159
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.kata-{runtime_name}.options]
Original file line number Diff line number Diff line change
1
+ from os import environ
2
+
3
+
4
+ def on_azure ():
5
+ if "SC2_ON_AZURE" not in environ :
6
+ return False
7
+
8
+ return environ ["SC2_ON_AZURE" ] == "yes"
You can’t perform that action at this time.
0 commit comments