source: trunk/packages/invirt-database/invirt-database-tables @ 2757

Last change on this file since 2757 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
Line 
1#!/usr/bin/env python
2
3from invirt import database
4import sys
5
6def usage():
7    print >>sys.stderr, "Usage: %s [create|drop]" %(sys.argv[0],)
8    sys.exit(-1)
9
10if len(sys.argv) == 1:
11    usage()
12
13def create():
14    database.meta.create_all()
15    session = database.session()
16    session.begin()
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'))
23    session.commit()
24
25database.connect()
26
27if sys.argv[1] == "create":
28    create()
29elif sys.argv[1] == "drop":
30    database.meta.drop_all()
31else:
32    usage()
Note: See TracBrowser for help on using the repository browser.