示例#1
0
 def __init__(self,
              si,
              template_name,
              vm_name,
              vm_folder,
              datastore_name=None,
              cluster_name=None,
              resource_pool=None,
              power_on=True,
              snapshot=''):
     """
     Constructor of CloneVmParameters
     :param si:              pyvmomi 'ServiceInstance'
     :param template_name:   str: the name of the template/vm to clone
     :param vm_name:         str: the name that will be given to the cloned vm
     :param vm_folder:       str: the path to the location of the template/vm to clone
     :param datastore_name:  str: the name of the datastore
     :param cluster_name:    str: the name of the dcluster
     :param resource_pool:   str: the name of the resource pool
     :param power_on:        bool: turn on the cloned vm
     :param snapshot:        str: the name of the snapshot to clone from
     """
     self.si = si
     self.template_name = template_name
     self.vm_name = vm_name
     self.vm_folder = vm_folder
     self.datastore_name = datastore_name
     self.cluster_name = cluster_name
     self.resource_pool = resource_pool
     self.power_on = str2bool(power_on)
     self.snapshot = snapshot
 def __init__(self,
              si,
              template_name,
              vm_name,
              vm_folder,
              datastore_name=None,
              cluster_name=None,
              resource_pool=None,
              power_on=True,
              snapshot=''):
     """
     Constructor of CloneVmParameters
     :param si:              pyvmomi 'ServiceInstance'
     :param template_name:   str: the name of the template/vm to clone
     :param vm_name:         str: the name that will be given to the cloned vm
     :param vm_folder:       str: the path to the location of the template/vm to clone
     :param datastore_name:  str: the name of the datastore
     :param cluster_name:    str: the name of the dcluster
     :param resource_pool:   str: the name of the resource pool
     :param power_on:        bool: turn on the cloned vm
     :param snapshot:        str: the name of the snapshot to clone from
     """
     self.si = si
     self.template_name = template_name
     self.vm_name = vm_name
     self.vm_folder = vm_folder
     self.datastore_name = datastore_name
     self.cluster_name = cluster_name
     self.resource_pool = resource_pool
     self.power_on = str2bool(power_on)
     self.snapshot = snapshot
 def test_str2bool_False_as_string(self):
     result = str2bool('False')
     self.assertFalse(result)
 def test_str2bool_True_as_string(self):
     result = str2bool('True')
     self.assertTrue(result)
 def test_str2bool_False(self):
     result = str2bool(False)
     self.assertFalse(result)
 def test_str2bool_True(self):
     result = str2bool(True)
     self.assertTrue(result)