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
hypervisor command to clean the files of a vm #26
Comments
Another possibility:extend the hypervisor command Yet another possibility:add a setting to indicate the vm instance should delete the files when deleted Hmm... they would require heavier internal modifications. But it could probably be adapted to make the prototype on the first post only clean it's own files... |
Regarding your concerns, I think there is little chance to delete unrelated files, so this would be ok but best to delete files created ONLY by Dynamips. For your second concern, I wouldn't implement it as this could create other unexpected security issues but also because I think this is not gonna be useful.
I wonder if I would add Finally, make sure files are moved to the new vm name when renaming a vm or all vm files created should include the vm id instead of its name, e.g. |
We can have the vm id in the names with the command line option The easiest way to implement is to delete all I investigated a bit more and the log and lock files remain open when the vm is stopped. Which means the current The other files are closed (and the filename forgotten) when the vm is stopped. Deleting them at that time is undesirable, since we would lose all changes just by rebooting with a stop+start... 😔 This means that doing ... Regarding crashes:
In short, the current behavior is appropriate. |
Actually the vm id in the names might be a problem if you have several hypervisors writing in the same working directory. How do you ensure uniqueness? Maybe by having an hypervisor client assigning an ID for each vm and be responsible to ensure they are unique? or is this going too far? ;) So we agree you should have the option to delete vm files when deleting a vm, either using Now the problem is for the rename command and the only solution I see is that we keep using the same files after we rename a vm. The files should therefore not contain the instance name which bring us back to the idea of assigning unique ids and use these ids to name the vm files... What do you think? I don't think the rename is a bad idea, of course this brings problems but this is gonna be way cleaner to rename than deleting and recreating a vm from scratch. |
Regarding the vm id uniqueness... Running in normal hypervisor mode or with the Running with the Regarding cleaning files... Regarding |
You are right the vm id is chosen by Dynagen and sent along with the I didn't know about the -N argument, why not make it the default when running in hypervisor mode? Also, I will probably check for lock files in the new design, thanks for the tip :) Regarding cleaning files, I agree to create For |
I'm still getting familiar with dynamips, so for now I'll keep |
vm rename works well and regarding the file names, I am using the -N1 by default in GNS3 so I don't really need anything else. |
Only noticed you comment now... well, it's already done so I'll leave it there. =~~ |
After making this post I realized that all the old files still remain after you rename a vm.
These files might interfere with a new vm that has the original name and the same platform, so there should be a way to clean them.
Hypervisor command:
vm clean_delete <instance_name>
Deletes the router instance and all the
<platform>_<instance_name>_*
/<platform_name>_i<instance_id>_*
files in the working directory.Prototype:vm clean <instance_name>
Deletes all<platform>_<instance_name>_*
files in the working directory.The vm must exist and be stopped.
My concerns:1. It can delete unrelated files with the same prefix - is this ok?2. I considered not requiring the vm to exist by providing an optional argument[<platform>]
, but this raises security concerns since it can build any path for files that have at least one underscore. (ex: platform/tmp/
and instance name/../file
produces the pattern/tmp/_/../file_*
)This can be minimized by traversing the working dir and comparing the filename prefixes, but it can still target any file that has two underscores.
What do you think @grossmj?The text was updated successfully, but these errors were encountered: