示例#1
0
    def create(self, params):
        if not params.get('dev_name'):
            raise MissingParameter("GINDASDPAR0005E")
        dev_name = params['dev_name']

        if 'size' not in params:
            raise MissingParameter("GINDASDPAR0006E")

        if params['size']:
            if type(params['size']) != int:
                raise InvalidParameter("GINDASDPAR0013E")
        size = params['size']

        devs = dasd_utils.get_dasd_devs()
        for dev in devs:
            if dev['size'] != 'Unknown':
                if size > dev['size']:
                    raise InvalidParameter("GINDASDPAR0015E")
        try:
            dasd_utils._create_dasd_part(dev_name, size)
        except OperationFailed as e:
            raise OperationFailed("GINDASDPAR0007E", {
                'name': dev_name,
                'err': e.message
            })
        return dev_name
示例#2
0
    def create(self, params):
        if 'dev_name' not in params:
            raise MissingParameter("GINDASDPAR0005E")
        dev_name = params['dev_name']

        if 'size' not in params:
            raise MissingParameter("GINDASDPAR0006E")
        size = params['size']

        try:
            dasd_utils._create_dasd_part(dev_name, size)
        except OperationFailed as e:
            wok_log.error("Creation of partition failed")
            raise OperationFailed("GINDASDPAR0007E",
                                  {'dev_name': dev_name, 'err': e})
        return dev_name
示例#3
0
    def create(self, params):
        if not params.get('dev_name'):
            raise MissingParameter("GINDASDPAR0005E")
        dev_name = params['dev_name']

        if 'size' not in params:
            raise MissingParameter("GINDASDPAR0006E")

        if params['size']:
            if type(params['size']) != int:
                raise InvalidParameter("GINDASDPAR0013E")
        size = params['size']

        try:
            dasd_utils._create_dasd_part(dev_name, size)
        except OperationFailed as e:
            raise OperationFailed("GINDASDPAR0007E",
                                  {'name': dev_name, 'err': e.message})
        return dev_name