def __init__(self, connection=None, conn=None): conn = conn or connection if not isinstance(conn, libvirt.virConnect): raise ValueError(_("Connection must be a 'virConnect' instance.")) self._hyper_conn = conn # original guest name or uuid self._original_guest = None self._original_dom = None self._original_virtual_disks = [] self._original_xml = None self._guest = None # clone guest self._clone_name = None self._clone_devices = [] self._clone_virtual_disks = [] self._clone_bs = 1024 * 1024 * 10 self._clone_mac = [] self._clone_uuid = None self._clone_sparse = True self._clone_xml = None self._force_target = [] self._skip_target = [] self._preserve = True self._clone_running = False # Default clone policy for back compat: don't clone readonly, # shareable, or empty disks self._clone_policy = [self.CLONE_POLICY_NO_READONLY, self.CLONE_POLICY_NO_SHAREABLE, self.CLONE_POLICY_NO_EMPTYMEDIA] # Throwaway guest to use for easy validation self._valid_guest = Guest.Guest(conn=conn) # Generate a random UUID at the start self.clone_uuid = _util.generate_uuid(conn)
def __init__(self, conn, name, type, target_path=None, uuid=None): StorageObject.__init__(self, object_type=StorageObject.TYPE_POOL, \ name=name, conn=conn) if type not in self.get_pool_types(): raise ValueError(_("Unknown storage pool type: %s" % type)) self._type = type self._target_path = None self._host = None self._format = None self._source_path = None self._uuid = None if target_path is None: target_path = self._get_default_target_path() self.target_path = target_path if uuid: self.uuid = uuid # Initialize all optional properties self._host = None self._source_path = None self._random_uuid = _util.generate_uuid(self.conn)