Skip to content

Commit 32cbd95

Browse files
authored
Merge pull request #370 from Azure/gpu_gen2
support and test Gen2 images
2 parents 8221147 + b977fe2 commit 32cbd95

File tree

5 files changed

+37
-3
lines changed

5 files changed

+37
-3
lines changed

examples/image/pipeline.yml

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ variables:
2828
# Uncomment and set values below, or leave commented and thru pipeline variables
2929
# azhpc.variables.location: westeurope
3030
# azhpc.variables.image_name: foo
31+
azhpc.variables_matrix: examples/image/test_matrix.json
3132

3233
# <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
3334

examples/image/test_matrix.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"Gen1":
3+
{
4+
"azhpc.variables.hpc_image": "OpenLogic:CentOS-HPC:7.7:latest"
5+
},
6+
"Gen2":
7+
{
8+
"azhpc.variables.image": "OpenLogic:CentOS-HPC:7_7-gen2:latest"
9+
}
10+
}

examples/nvidia/pipeline.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ variables:
2929

3030
# Add the variables needed in your configuration file
3131
# Uncomment and set values below, or leave commented and thru pipeline variables
32-
# azhpc.variables.location: eastus
32+
azhpc.variables.location: southcentralus
3333
#azhpc.variables.vm_type: Standard_NC12s_v3
34-
34+
azhpc.variables_matrix: examples/nvidia/test_matrix.json
3535
# <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
3636

3737
jobs:

examples/nvidia/test_matrix.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"Gen1":
3+
{
4+
"azhpc.variables.vm_type": "Standard_NV12s_v3",
5+
"azhpc.variables.image": "OpenLogic:CentOS:7.7:latest"
6+
},
7+
"Gen2":
8+
{
9+
"azhpc.variables.vm_type": "Standard_ND40rs_v2",
10+
"azhpc.variables.image": "OpenLogic:CentOS:7_7-gen2:latest"
11+
}
12+
}

scripts/create_image.sh

+12-1
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,24 @@ rg=$1
33
vm_name=$2
44
image_name=$3
55
image_rg=$4
6-
hyperv=${5-v1}
6+
#hyperv=${5-v1}
77

88
# Create the Image
99
echo "Deallocate $vm_name"
1010
az vm deallocate -g $rg -n $vm_name
1111
echo "Generalize $vm_name"
1212
az vm generalize -g $rg -n $vm_name
13+
14+
# Retrieve the hyperv generation of the image used to create the VM as it needs to be specified when capturing the VM
15+
imgref=$(az vm show --name $vm_name -g $rg --query "storageProfile.imageReference")
16+
echo $imgref
17+
offer=$(echo $imgref | jq -r '.offer')
18+
publisher=$(echo $imgref | jq -r '.publisher')
19+
sku=$(echo $imgref | jq -r '.sku')
20+
version=$(echo $imgref | jq -r '.version')
21+
hyperv=$(az vm image show --urn $publisher:$offer:$sku:$version --query "hyperVgeneration" -o tsv)
22+
echo "hyper-v generation is $hyperv"
23+
1324
echo "Create Image $image_name from VM $vm_name"
1425
if [ "$rg" == "$image_rg" ]; then
1526
az image create -g $rg -n $image_name --source $vm_name --hyper-v-generation $hyperv --output table

0 commit comments

Comments
 (0)