@@ -0,0 +1,2445 @@
+package org.zstack.storage.primary.iscsi;%0D%0A%0D%0Aimport org.springframework.beans.factory.annotation.Autowired;%0D%0Aimport org.zstack.core.db.DatabaseFacade;%0D%0Aimport org.zstack.core.db.SimpleQuery;%0D%0Aimport org.zstack.core.db.SimpleQuery.Op;%0D%0Aimport org.zstack.core.errorcode.ErrorFacade;%0D%0Aimport org.zstack.header.apimediator.ApiMessageInterceptionException;%0D%0Aimport org.zstack.header.apimediator.ApiMessageInterceptor;%0D%0Aimport org.zstack.header.message.APIMessage;%0D%0A%0D%0A/**%0D%0A * Created by frank on 4/27/2015.%0D%0A */%0D%0Apublic class IscsiFileSystemPrimaryStorageApiInterceptor implements ApiMessageInterceptor %7B%0D%0A    @Autowired%0D%0A    private DatabaseFacade dbf;%0D%0A    @Autowired%0D%0A    private ErrorFacade errf;%0D%0A%0D%0A    @Override%0D%0A    public APIMessage intercept(APIMessage msg) throws ApiMessageInterceptionException %7B%0D%0A        if (msg instanceof APIAddIscsiFileSystemBackendPrimaryStorageMsg) %7B%0D%0A            validate((APIAddIscsiFileSystemBackendPrimaryStorageMsg)msg);%0D%0A        %7D%0D%0A        return msg;%0D%0A    %7D%0D%0A%0D%0A    private void validate(APIAddIscsiFileSystemBackendPrimaryStorageMsg msg) %7B%0D%0A        if (msg.getFilesystemType() == null) %7B%0D%0A            msg.setFilesystemType(IscsiBtrfsPrimaryStorageConstants.BTRFS_TYPE);%0D%0A        %7D%0D%0A%0D%0A        SimpleQuery%3CIscsiFileSystemBackendPrimaryStorageVO%3E q = dbf.createQuery(IscsiFileSystemBackendPrimaryStorageVO.class);%0D%0A        q.add(IscsiFileSystemBackendPrimaryStorageVO_.hostname, Op.EQ, msg.getHostname());%0D%0A        if (q.isExists()) %7B%0D%0A            throw new ApiMessageInterceptionException(%0D%0A                    errf.stringToInvalidArgumentError(String.format(%22there is already a IscsiFileSystemBackendPrimaryStorageV with hostname%5B%25s%5D%22, msg.getHostname()))%0D%0A            );%0D%0A        %7D%0D%0A%0D%0A        if ((msg.getChapUsername() == null && msg.getChapPassword() != null) %7C%7C%0D%0A                (msg.getChapUsername() != null && msg.getChapPassword() == null)) %7B%0D%0A            throw new ApiMessageInterceptionException(%0D%0A                    errf.stringToInvalidArgumentError(%22chapUsername and chapPassword must be all null or all not null%22)%0D%0A            );%0D%0A        %7D%0D%0A%0D%0A        if (!IscsiBtrfsPrimaryStorageConstants.BTRFS_TYPE.equals(msg.getFilesystemType())) %7B%0D%0A            throw new ApiMessageInterceptionException(errf.stringToInvalidArgumentError(%0D%0A                    String.format(%22in this version, the filesystemType must be %25s%22, IscsiBtrfsPrimaryStorageConstants.BTRFS_TYPE)%0D%0A            ));%0D%0A        %7D%0D%0A    %7D%0D%0A%7D%0D%0A

add missing file