-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix data being replicated on VM's metadata file in VR #10987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix data being replicated on VM's metadata file in VR #10987
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #10987 +/- ##
============================================
- Coverage 16.57% 16.57% -0.01%
+ Complexity 13870 13869 -1
============================================
Files 5719 5719
Lines 507200 507200
Branches 61574 61574
============================================
- Hits 84093 84075 -18
- Misses 413688 413711 +23
+ Partials 9419 9414 -5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
fh = open(metamanifest, "a+") | ||
self.__exflock(fh) | ||
fh.seek(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GutoVeronezi , I think your intention is
fh = open(metamanifest, "a+") | |
self.__exflock(fh) | |
fh.seek(0) | |
fh = open(metamanifest, “w+") | |
self.__exflock(fh) |
opeing with a+ will not truncate the previous version, but only overwrite data afaik.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a
is for appending; +
is for allow reading, however, the pointer must be set to 0 to the validation work properly. w
would overwrite the data. This is the same as #10254
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right, I missed the fh.read() on the next line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code lgtm
Not tested
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested in my existing VR with these changes, LGTM
Description
While creating VMs, ACS configures HTTPd on the VR to serve metadata files to be consumed by CloudInit. However, the file
/var/www/html/meta-data/<vm-ip>/metadata
is appended with the same content every time a VM is started through CloudStack, causing the file to have replicated lines; as VMs are created/started, this file grows ad infinitum, consuming the VR's storage.This PR intends to fix this metadata replication on the VRs.
Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
Without the changes:
With the changes: