~citrix-openstack/nova/xenapi

« back to all changes in this revision

Viewing changes to nova/tests/__init__.py

  • Committer: rlane at wikimedia
  • Date: 2011-03-03 23:04:11 UTC
  • mfrom: (408.9.363 nova)
  • mto: (408.9.366 nova)
  • mto: This revision was merged to the branch mainline in revision 449.
  • Revision ID: rlane@wikimedia.org-20110303230411-qx4qndimfyr1w1fx
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
 
38
38
 
39
39
def setup():
 
40
    import os
 
41
    import shutil
 
42
 
 
43
    from nova import context
 
44
    from nova import flags
40
45
    from nova.db import migration
 
46
    from nova.network import manager as network_manager
 
47
    from nova.tests import fake_flags
 
48
 
 
49
    FLAGS = flags.FLAGS
 
50
 
 
51
    testdb = os.path.join(FLAGS.state_path, FLAGS.sqlite_db)
 
52
    if os.path.exists(testdb):
 
53
        os.unlink(testdb)
41
54
    migration.db_sync()
 
55
    ctxt = context.get_admin_context()
 
56
    network_manager.VlanManager().create_networks(ctxt,
 
57
                                                  FLAGS.fixed_range,
 
58
                                                  FLAGS.num_networks,
 
59
                                                  FLAGS.network_size,
 
60
                                                  FLAGS.fixed_range_v6,
 
61
                                                  FLAGS.vlan_start,
 
62
                                                  FLAGS.vpn_start,
 
63
                                                  )
 
64
 
 
65
    cleandb = os.path.join(FLAGS.state_path, FLAGS.sqlite_clean_db)
 
66
    shutil.copyfile(testdb, cleandb)