def __init__(self, vzId='', vzName='', vzType='VZsolo', vzSize='5g', vzIp='', vzGw='', vzLimits='enovance-nolimit.tpl', vzTemplate='enovance-debian-6.0-amd64', workdir = '.', fix_network = True, vm = None, **kwds): self.boxname = vzName self.basedir = os.path.join('/home/vz/up/', self.boxname, 'DATA/root') self.vz = str(vzId) Vm.__init__(self, root_vm_dir = self.basedir, vm = vm, **kwds) self.vzName = vzName self.vzType = vzType self.vzSize = vzSize self.vzIp = vzIp self.vzGw = vzGw self.vzLimits = vzLimits self.vzTemplate = vzTemplate self.can_snap = False self.fix_network = fix_network self.name = self.boxname # self.name = 'VZ ' + self.boxname self.property_run = self.boxname + '_RUN' self.property_exists = 'VZ_INSTALLED' self.add_to_post_start_hook(self._fix_net)
def __init__(self, boxname='', vm=None, **kwargs): self.boxname = boxname self.vm = vm self.is_vm = False Vm.__init__(self, vm = vm, **kwargs) self.can_snap = True self.property_exists = self.name + '_EXI' self.property_run = self.name + '_RUN' # The root VM should snap if self.run_on_vm: self.can_snap = False
def __init__(self, #: where the vm directory is basedir = '', #: the name used by vagrant init, when the box is on #: the slave. boxname = None, #: the url where the vagrant box is. boxurl = None, #: the url where the vagrant definition is. Only support Git. vagrant_src = None, #: in multivm, we need the machine's name machine = None, #: The name of the vagrantfile vagrantfile = 'Vagrantfile', #: running on a vm? vm = None, **kwargs): self.boxname = boxname self.basedir = os.path.expanduser(basedir) self.vagrantfile = path.join(self.basedir, vagrantfile) self.machine = machine if self.boxname == None and self.machine: self.boxname = self.machine # TODO: improve the logic. box_m = re.match("^[-\w_\d.]+$", self.boxname) if not box_m: raise VmError("The name of the box (%s) can only contain [-\w_\d.]+" % self.boxname) self.vagrant_src = vagrant_src # MRO should kick in both Vm, and Base, and I should use new style class: # http://www.python.org/doc/newstyle/ Vm.__init__(self, root_vm_dir = self.basedir, vm = vm, **kwargs) self.boxurl = boxurl self.can_snap = True #: determine if the "package" steps are executed. self.property_exists = self.name + '_EXI' #: determine if the "install" and "run" steps are executed. self.property_run = self.name + '_RUN' # The root VM should snap if self.run_on_vm: self.can_snap = False