Last change
on this file since 2053 was
2053,
checked in by price, 16 years ago
|
invirt-database-tables: populate types table
|
-
Property svn:executable set to
*
|
File size:
733 bytes
|
Rev | Line | |
---|
[77] | 1 | #!/usr/bin/env python |
---|
| 2 | |
---|
[836] | 3 | from invirt import database |
---|
[77] | 4 | import sys |
---|
| 5 | |
---|
| 6 | def usage(): |
---|
| 7 | print >>sys.stderr, "Usage: %s [create|drop]" %(sys.argv[0],) |
---|
| 8 | sys.exit(-1) |
---|
| 9 | |
---|
| 10 | if len(sys.argv) == 1: |
---|
| 11 | usage() |
---|
| 12 | |
---|
[2053] | 13 | def create(): |
---|
| 14 | database.meta.create_all() |
---|
| 15 | session = database.session() |
---|
| 16 | session.begin() |
---|
| 17 | session.save(database.Type(type_id='linux-hvm', description='HVM', |
---|
| 18 | hvm='t', apic='t', acpi='t', pae='t')) |
---|
| 19 | session.save(database.Type(type_id='linux', description='ParaVM', |
---|
| 20 | hvm='f', apic='f', acpi='f', pae='f')) |
---|
| 21 | session.commit() |
---|
| 22 | |
---|
[836] | 23 | database.connect() |
---|
[77] | 24 | |
---|
| 25 | if sys.argv[1] == "create": |
---|
[2053] | 26 | create() |
---|
[241] | 27 | elif sys.argv[1] == "drop": |
---|
[836] | 28 | database.meta.drop_all() |
---|
[77] | 29 | else: |
---|
[241] | 30 | usage() |
---|
Note: See
TracBrowser
for help on using the repository browser.