| Jeremy Mordkoff | 6f07e6f | 2016-09-07 18:56:51 -0400 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
| 2 | |
| 3 | # |
| 4 | # Copyright 2016 RIFT.IO Inc |
| 5 | # |
| 6 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | # you may not use this file except in compliance with the License. |
| 8 | # You may obtain a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, software |
| 13 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | # See the License for the specific language governing permissions and |
| 16 | # limitations under the License. |
| 17 | # |
| 18 | |
| 19 | |
| 20 | import logging |
| 21 | import os |
| 22 | |
| 23 | import rift.rwcal.cloudsim.lxc as lxc |
| 24 | import rift.rwcal.cloudsim.lvm as lvm |
| 25 | |
| 26 | |
| 27 | logger = logging.getLogger('rwcal-test') |
| 28 | |
| 29 | |
| 30 | def main(): |
| 31 | template = os.path.realpath("../rift/cal/lxc-fedora-rift.lxctemplate") |
| 32 | tarfile = "/net/strange/localdisk/jdowner/lxc.tar.gz" |
| 33 | volume = 'rift-test' |
| 34 | |
| 35 | lvm.create(volume, '/lvm/rift-test.img') |
| 36 | |
| 37 | master = lxc.create_container('test-master', template, volume, tarfile) |
| 38 | |
| 39 | snapshots = [] |
| 40 | for index in range(5): |
| 41 | snapshots.append(master.snapshot('test-snap-{}'.format(index + 1))) |
| 42 | |
| 43 | for snapshot in snapshots: |
| 44 | snapshot.destroy() |
| 45 | |
| 46 | master.destroy() |
| 47 | |
| 48 | lvm.destroy(volume) |
| 49 | |
| 50 | |
| 51 | |
| 52 | if __name__ == "__main__": |
| 53 | logging.basicConfig(level=logging.DEBUG) |
| 54 | main() |