Merge ~mitchdz/ubuntu/+source/ec2-hibinit-agent:add-IMDSv2-kinetic into ubuntu/+source/ec2-hibinit-agent:ubuntu/kinetic-devel
Proposed by
Mitchell Dzurick
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Robie Basak | ||||
Approved revision: | 339b2abca838267fce70588f796208a86e1ac015 | ||||
Merge reported by: | Mitchell Dzurick | ||||
Merged at revision: | 339b2abca838267fce70588f796208a86e1ac015 | ||||
Proposed branch: | ~mitchdz/ubuntu/+source/ec2-hibinit-agent:add-IMDSv2-kinetic | ||||
Merge into: | ubuntu/+source/ec2-hibinit-agent:ubuntu/kinetic-devel | ||||
Diff against target: |
190 lines (+168/-0) 3 files modified
debian/changelog (+7/-0) debian/patches/lp1941785-Add-support-for-IMDSv2.patch (+160/-0) debian/patches/series (+1/-0) |
||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Athos Ribeiro (community) | Approve | ||
Canonical Server Reporter | Pending | ||
Review via email: mp+443146@code.launchpad.net |
Description of the change
To post a comment you must log in.
This has been tested to work on Kinetic
us-west-2 was used as the region for aws (this is important because AMI will change)
# To test the failure b107ee (For Kinetic)
# This test case is written for Mantic but will apply to all distributions
1. Create an amazon EC2 instance with the following properties
- AMI - ami-03e20864bf1
- t2.micro
- encrypted 8GB EBS volume with default key
- Stop - Hibernate behavior: Enable
- Metadata accessible : Enable
- Metadata version Info : V2 only (token required)
2. Wait for instance to say "Running"
3. ssh into your instance
4. Create a test program
```
/bin/cat <<EOM >~/allocate_mem.py
#!/usr/bin/python3
import time
# Allocate 200MB chunk of memory
size = 200 * 1024 * 1024 # 200MB
memory_chunk = bytearray(size)
print("Allocated 200MB of memory.")
# Enter indefinite loop
while True:
time.sleep(1) # Wait for 1 second
# The script will never reach this point
EOM
```
5. Run a background process
```
python3 ~/allocate_mem.py &
```
6. Hibernate the instance
7. Wait for Instance to be in "Stopped" State
8. Start the intsance
9. ssh into instance
10. Check that the process is running
$ ps aux | grep allocate_mem | grep -v grep
$
# To test the fix b107ee (For Kinetic) ec2-hibinit- agent-add- imdsv2- support -y
1. Create an amazon EC2 instance with the following properties
- AMI - ami-03e20864bf1
- t2.micro
- encrypted 8GB EBS volume with default key
- Stop - Hibernate behavior: Enable
- Metadata accessible : Enable
- Metadata version Info : V2 only (token required)
2. Wait for instance to say "Running"
3. ssh into your instance
4. add PPA for updated package; apt update && apt upgrade
```
sudo add-apt-repository ppa:mitchdz/
sudo apt update -y && sudo apt upgrade -y
```
5. Create a test program
```
/bin/cat <<EOM >~/allocate_mem.py
#!/usr/bin/python3
import time
# Allocate 200MB chunk of memory
size = 200 * 1024 * 1024 # 200MB
memory_chunk = bytearray(size)
print("Allocated 200MB of memory.")
# Enter indefinite loop
while True:
time.sleep(1) # Wait for 1 second
# The script will never reach this point allocate_ mem.py
EOM
```
6. Run a background process
```
python3 ~/allocate_mem.py &
```
7. Hibernate the instance
8. Wait for Instance to be in "Stopped" State
9. Start the intsance
10. ssh into instance
11. Check that the process is running
$ ps aux | grep allocate_mem | grep -v grep
ubuntu 2532 1.1 23.0 221948 213248 pts/0 S 13:43 0:00 python3 /home/ubuntu/