Exemplo n.º 1
0
    def verify(self, oldname, newname):
        be = FindClone(oldname)
        if not be:
            raise VerifyException(
                errno.ENOENT, 'Boot environment {0} not found'.format(oldname))

        return ['system']
Exemplo n.º 2
0
    def run(self, id, updated_params):
        boot_pool_name = self.configstore.get('system.boot_pool_name')
        new_id = updated_params.get('id', id)
        be = FindClone(id)
        if not be:
            raise TaskException(errno.ENOENT,
                                'Boot environment {0} not found'.format(id))

        if not include(updated_params, 'id', 'keep', 'active'):
            return

        def doit():
            if 'id' in updated_params:
                if not RenameClone(id, updated_params['id']):
                    raise TaskException(
                        errno.EIO,
                        'Cannot rename the {0} boot evironment'.format(id))

            if 'keep' in updated_params:
                self.run_subtask_sync(
                    'zfs.update', f'{boot_pool_name}/ROOT/{be["realname"]}',
                    {'beadm:keep': {
                        'value': str(updated_params['keep'])
                    }})

            if updated_params.get('active'):
                if not ActivateClone(id):
                    raise TaskException(
                        errno.EIO,
                        'Cannot activate the {0} boot environment'.format(id))

        self.dispatcher.exec_and_wait_for_event(
            'boot.environment.changed',
            lambda args: args['operation'] == 'update' and
            (id in args['ids'] or new_id in args['ids']), doit, 600)
Exemplo n.º 3
0
    def run(self, id, updated_params):
        new_id = updated_params.get('id', id)
        be = FindClone(id)
        if not be:
            raise TaskException(errno.ENOENT,
                                'Boot environment {0} not found'.format(id))

        if not include(updated_params, 'id', 'keep', 'active'):
            return

        def doit():
            if 'id' in updated_params:
                if not RenameClone(id, updated_params['id']):
                    raise TaskException(
                        errno.EIO,
                        'Cannot rename the {0} boot evironment'.format(id))

            if 'keep' in updated_params:
                if not CloneSetAttr(be, keep=updated_params['keep']):
                    raise TaskException(
                        errno.EIO,
                        'Cannot set keep flag on boot environment {0}'.format(
                            id))

            if updated_params.get('active'):
                if not ActivateClone(id):
                    raise TaskException(
                        errno.EIO,
                        'Cannot activate the {0} boot environment'.format(id))

        self.dispatcher.exec_and_wait_for_event(
            'boot.environment.changed',
            lambda args: args['operation'] == 'update' and
            (id in args['ids'] or new_id in args['ids']), doit, 600)
Exemplo n.º 4
0
    def run(self, name):
        be = FindClone(name)
        if not be:
            raise TaskException(errno.ENOENT, 'Boot environment {0} not found'.format(name))

        if not ActivateClone(name):
            raise TaskException(errno.EIO, 'Cannot activate the {0} boot environment'.format(name))
Exemplo n.º 5
0
    def verify(self, names):
        for n in names:
            be = FindClone(n)
            if not be:
                raise VerifyException(
                    errno.ENOENT, 'Boot environment {0} not found'.format(n))

        return ['system']
Exemplo n.º 6
0
    def run(self, id):
        be = FindClone(id)
        if not be:
            raise TaskException(errno.ENOENT, 'Boot environment {0} not found'.format(id))

        def doit():
            if not DeleteClone(id):
                raise TaskException(errno.EIO, 'Cannot delete the {0} boot environment'.format(id))

        self.dispatcher.exec_and_wait_for_event(
            'boot.environment.changed',
            lambda args: args['operation'] == 'delete' and id in args['ids'],
            doit,
            600
        )