bootstrap-vz/tests/integration/tools/images.py

26 lines
684 B
Python
Raw Normal View History

2014-12-14 15:41:04 +01:00
import virtualbox
2014-11-30 00:33:42 +01:00
class Image(object):
def __init__(self, manifest):
self.manifest = manifest
def destroy(self):
pass
class VirtualBoxImage(Image):
def __init__(self, manifest, image_path):
super(VirtualBoxImage, self).__init__(manifest)
self.image_path = image_path
2014-12-14 15:41:04 +01:00
self.vbox = virtualbox.VirtualBox()
self.medium = self.vbox.open_medium(self.image_path, # location
virtualbox.library.DeviceType.hard_disk, # decive_type
virtualbox.library.AccessMode.read_only, # access_mode
False) # force_new_uuid
2014-11-30 00:33:42 +01:00
def destroy(self):
2014-12-14 15:41:04 +01:00
self.medium.close()