Skip to content
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

Course Removal Script #52

Closed
sahiilll opened this issue Dec 10, 2019 · 5 comments
Closed

Course Removal Script #52

sahiilll opened this issue Dec 10, 2019 · 5 comments
Assignees

Comments

@sahiilll
Copy link
Contributor

Current State of Course Removal Script: RemoveCourse.py in "/home/vital/vital2.0/source/virtual_lab/vital_site/vital/management/commands" folder manages the tasks. Following are some functions handled by the script ( basically only handles data cleaning; that too partially )

  1. Takes Course ID
  2. Created Course object variable and inherently assigns all the values related to vital_course table in databse
  3. delete() function is called on Registered_Courses object, user_nets ( list of net object) net here refers to any entry related to course in network configuration in table, Virtual_machine object
delete() : Performs an SQL delete query on all rows in the QuerySet and returns the number of objects deleted and a dictionary with the number of deletions per object type.

Requirements:

  1. Remove entries from database ( partially being handled by the current script)
  2. Remove vlans and interfaces
  3. Remove dhcp files
  4. Remove iptable rules
  5. Remove qcow and conf files from vlab-datastore
@sahiilll sahiilll self-assigned this Dec 10, 2019
@sahiilll
Copy link
Contributor Author

The following code handles the deletion of all the entries in the database tables.

image

@sahiilll
Copy link
Contributor Author

The following code handles teh deletion of the files from teh vlab-datastore:
image

It searches for the filenames which contains course_id in the middle position and if found, removes it from the gluster. It takes care of any files created for a vital user for that course and deletes it before removing the course.

The second part deletes the course files from clean folder in the same way.

@sahiilll
Copy link
Contributor Author

sahiilll commented Jan 17, 2020

The following code handles the network configuartio files and vlan interfaces and removes it:
image

@sahiilll
Copy link
Contributor Author

sahiilll commented Jan 17, 2020

The following takes care of iptables:

image

@sahiilll
Copy link
Contributor Author

Added print Statements

@sahiilll sahiilll transferred this issue from vital2/ansible Jan 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant