Пример #1
0
    def _setup_allowed_devices(self):
        if all((self._device_prefix, self._allowed_devices)):
            return

        block_config = self._config.plugins[self.full_name]
        majors = block_config.device_letters

        self._device_prefix = native_device_prefix(
            block_config.device_prefixes)

        context = self._config.context

        if "partition" in context.ami:
            device_format = '/dev/{0}{1}'

            self._allowed_devices = [
                device_format.format(self._device_prefix, major)
                for major in majors
            ]
            self.partition = context.ami['partition']

        else:
            device_format = '/dev/{0}{1}{2}'

            self._allowed_devices = [
                device_format.format(self._device_prefix, major, minor)
                for major in majors for minor in string.lowercase
            ]
Пример #2
0
    def configure(self, config, parser):
        super(LinuxBlockDevicePlugin, self).configure(config, parser)

        block_config = self._config.plugins[self.full_name]

        if self._config.lock_dir.startswith(('/', '~')):
            self._lock_dir = os.path.expanduser(self._config.lock_dir)
        else:
            self._lock_dir = os.path.join(self._config.aminator_root, self._config.lock_dir)

        self._lock_file = self.__class__.__name__

        majors = block_config.device_letters
        self._device_prefix = native_device_prefix(block_config.device_prefixes)
        device_format = '/dev/{0}{1}'

        self._allowed_devices = [device_format.format(self._device_prefix, major)
                                 for major in majors]
Пример #3
0
    def configure(self, config, parser):
        super(VirtioBlockDevicePlugin, self).configure(config, parser)

        block_config = self._config.plugins[self.full_name]

        if self._config.lock_dir.startswith(('/', '~')):
            self._lock_dir = os.path.expanduser(self._config.lock_dir)
        else:
            self._lock_dir = os.path.join(self._config.aminator_root, self._config.lock_dir)

        self._lock_file = self.__class__.__name__

        majors = block_config.device_letters
        self._device_prefix = native_device_prefix(block_config.device_prefixes)
        device_format = '/dev/{0}{1}'

        self._allowed_devices = [device_format.format(self._device_prefix, major)
                                 for major in majors]
    def _setup_allowed_devices(self):
        if all((self._device_prefix, self._allowed_devices)):
            return

        block_config = self._config.plugins[self.full_name]
        majors = block_config.device_letters

        self._device_prefix = native_device_prefix(block_config.device_prefixes)

        context = self._config.context

        if 'partition' in context.ami:
            block_config.use_minor_device_numbers = False
            self.partition = context.ami.partition

        if block_config.use_minor_device_numbers:
            device_format = '/dev/{0}{1}{2}'
            self._allowed_devices = [device_format.format(self._device_prefix, major, minor)
                                     for major in majors
                                     for minor in xrange(1, 16)]
        else:
            device_format = '/dev/{0}{1}'
            self._allowed_devices = [device_format.format(self._device_prefix, major)
                                     for major in majors]
Пример #5
0
    def _setup_allowed_devices(self):
        if all((self._device_prefix, self._allowed_devices)):
            return

        block_config = self._config.plugins[self.full_name]
        majors = block_config.device_letters

        self._device_prefix = native_device_prefix(block_config.device_prefixes)

        context = self._config.context

        if "partition" in context.ami:
            device_format = '/dev/{0}{1}'

            self._allowed_devices = [device_format.format(self._device_prefix, major)
                                     for major in majors]
            self.partition = context.ami['partition']

        else:
            device_format = '/dev/{0}{1}{2}'

            self._allowed_devices = [device_format.format(self._device_prefix, major, minor)
                                     for major in majors
                                     for minor in string.lowercase]