Skip to content

Commit

Permalink
perf: enable accelerated networking
Browse files Browse the repository at this point in the history
  • Loading branch information
Zachary Bailey committed Apr 22, 2024
1 parent 3c6e29f commit 2285606
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 0 deletions.
38 changes: 38 additions & 0 deletions vhdbuilder/packer/vhd-image-builder-arm64-gen2.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,44 @@
}
],
"provisioners": [
{
"type": "shell",
"inline": [
"PACKER_HOSTNAME=$(hostname)",
"echo The value of PACKER_HOSTNAME is $PACKER_HOSTNAME",
"echo $PACKER_HOSTNAME > /tmp/hostname.txt"
]
},
{
"type": "file",
"source": "/tmp/hostname.txt",
"destination": "/tmp/hostname.txt",
"direction": "download"
},
{
"type": "shell-local",
"inline": [
"PACKER_HOSTNAME=$(cat /tmp/hostname.txt)",

"nic=$(echo $PACKER_HOSTNAME | sed 's/vm/ni/')",

"temp_pkr_rg_name=\"pkr-Resource-Group-$(echo $PACKER_HOSTNAME | awk '{gsub(\"pkrvm\",\"\"); print}')\"",

"az network nic update -g ${temp_pkr_rg_name} -n ${nic} --accelerated-networking true"
]
},
{
"type": "shell-local",
"inline": [
"rm /tmp/hostname.txt"
]
},
{
"type": "shell",
"inline": [
"rm /tmp/hostname.txt"
]
},
{
"type": "shell",
"inline": [
Expand Down
38 changes: 38 additions & 0 deletions vhdbuilder/packer/vhd-image-builder-base.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,44 @@
}
],
"provisioners": [
{
"type": "shell",
"inline": [
"PACKER_HOSTNAME=$(hostname)",
"echo The value of PACKER_HOSTNAME is $PACKER_HOSTNAME",
"echo $PACKER_HOSTNAME > /tmp/hostname.txt"
]
},
{
"type": "file",
"source": "/tmp/hostname.txt",
"destination": "/tmp/hostname.txt",
"direction": "download"
},
{
"type": "shell-local",
"inline": [
"PACKER_HOSTNAME=$(cat /tmp/hostname.txt)",

"nic=$(echo $PACKER_HOSTNAME | sed 's/vm/ni/')",

"temp_pkr_rg_name=\"pkr-Resource-Group-$(echo $PACKER_HOSTNAME | awk '{gsub(\"pkrvm\",\"\"); print}')\"",

"az network nic update -g ${temp_pkr_rg_name} -n ${nic} --accelerated-networking true"
]
},
{
"type": "shell-local",
"inline": [
"rm /tmp/hostname.txt"
]
},
{
"type": "shell",
"inline": [
"rm /tmp/hostname.txt"
]
},
{
"type": "shell",
"inline": [
Expand Down
38 changes: 38 additions & 0 deletions vhdbuilder/packer/vhd-image-builder-mariner-arm64.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,44 @@
}
],
"provisioners": [
{
"type": "shell",
"inline": [
"PACKER_HOSTNAME=$(hostname)",
"echo The value of PACKER_HOSTNAME is $PACKER_HOSTNAME",
"echo $PACKER_HOSTNAME > /tmp/hostname.txt"
]
},
{
"type": "file",
"source": "/tmp/hostname.txt",
"destination": "/tmp/hostname.txt",
"direction": "download"
},
{
"type": "shell-local",
"inline": [
"PACKER_HOSTNAME=$(cat /tmp/hostname.txt)",

"nic=$(echo $PACKER_HOSTNAME | sed 's/vm/ni/')",

"temp_pkr_rg_name=\"pkr-Resource-Group-$(echo $PACKER_HOSTNAME | awk '{gsub(\"pkrvm\",\"\"); print}')\"",

"az network nic update -g ${temp_pkr_rg_name} -n ${nic} --accelerated-networking true"
]
},
{
"type": "shell-local",
"inline": [
"rm /tmp/hostname.txt"
]
},
{
"type": "shell",
"inline": [
"rm /tmp/hostname.txt"
]
},
{
"type": "shell",
"inline": [
Expand Down
38 changes: 38 additions & 0 deletions vhdbuilder/packer/vhd-image-builder-mariner.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,44 @@
}
],
"provisioners": [
{
"type": "shell",
"inline": [
"PACKER_HOSTNAME=$(hostname)",
"echo The value of PACKER_HOSTNAME is $PACKER_HOSTNAME",
"echo $PACKER_HOSTNAME > /tmp/hostname.txt"
]
},
{
"type": "file",
"source": "/tmp/hostname.txt",
"destination": "/tmp/hostname.txt",
"direction": "download"
},
{
"type": "shell-local",
"inline": [
"PACKER_HOSTNAME=$(cat /tmp/hostname.txt)",

"nic=$(echo $PACKER_HOSTNAME | sed 's/vm/ni/')",

"temp_pkr_rg_name=\"pkr-Resource-Group-$(echo $PACKER_HOSTNAME | awk '{gsub(\"pkrvm\",\"\"); print}')\"",

"az network nic update -g ${temp_pkr_rg_name} -n ${nic} --accelerated-networking true"
]
},
{
"type": "shell-local",
"inline": [
"rm /tmp/hostname.txt"
]
},
{
"type": "shell",
"inline": [
"rm /tmp/hostname.txt"
]
},
{
"type": "shell",
"inline": [
Expand Down

0 comments on commit 2285606

Please sign in to comment.