Last change
on this file since 2326 was
2218,
checked in by broder, 16 years ago
|
Merge invirt-database-server into invirt-database.
I...think this works, but I'm not making any promises.
|
-
Property svn:executable set to
*
|
File size:
843 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() |
---|
[2054] | 17 | if not database.Type.query.get('linux-hvm'): |
---|
| 18 | session.save(database.Type(type_id='linux-hvm', description='HVM', |
---|
| 19 | hvm='t', apic='t', acpi='t', pae='t')) |
---|
| 20 | if not database.Type.query.get('linux'): |
---|
| 21 | session.save(database.Type(type_id='linux', description='ParaVM', |
---|
| 22 | hvm='f', apic='f', acpi='f', pae='f')) |
---|
[2053] | 23 | session.commit() |
---|
| 24 | |
---|
[836] | 25 | database.connect() |
---|
[77] | 26 | |
---|
| 27 | if sys.argv[1] == "create": |
---|
[2053] | 28 | create() |
---|
[241] | 29 | elif sys.argv[1] == "drop": |
---|
[836] | 30 | database.meta.drop_all() |
---|
[77] | 31 | else: |
---|
[241] | 32 | usage() |
---|
Note: See
TracBrowser
for help on using the repository browser.