Example #1
0
    def __init__(self, conn, name, type, target_path=None, uuid=None):
        # pylint: disable=W0622
        # Redefining built-in 'type', but it matches the XML so keep it

        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)
Example #2
0
 def _get_default_uuid(self):
     if self._random_uuid is None:
         self._random_uuid = util.generate_uuid(self.conn)
     return self._random_uuid