Source:
protected boolean canDoAction() { if (!super.canDoAction() || !initializeVds() || !checkStorageDomainNameLengthValid()) { return false; } if (isStorageWithSameNameExists()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NAME_ALREADY_EXIST); } if (getStorageDomain().getStorageDomainType() == StorageDomainType.ISO && !getStorageDomain().getStorageType().isFileDomain()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DOMAIN_TYPE_CAN_BE_CREATED_ONLY_ON_SPECIFIC_STORAGE_DOMAINS, String.format("$domainType %1$s", StorageConstants.ISO), String.format("$storageTypes %1$s", StorageConstants.FILE)); } if (getStorageDomain().getStorageDomainType() == StorageDomainType.ImportExport && (getStorageDomain().getStorageType() == StorageType.LOCALFS || getStorageDomain().getStorageType().isBlockDomain())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DOMAIN_TYPE_CAN_BE_CREATED_ONLY_ON_SPECIFIC_STORAGE_DOMAINS, String.format("$domainType %1$s", StorageConstants.EXPORT), String.format("$storageTypes %1$s", StorageConstants.SHARED + " " + StorageConstants.FILE)); } if (getStorageDomain().getStorageDomainType() == StorageDomainType.Master) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_ILLEGAL); } if (!Guid.isNullOrEmpty(getParameters().getStoragePoolId()) && getTargetStoragePool() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_EXIST); } ensureStorageFormatInitialized(); if (!isStorageFormatSupportedByStoragePool() || !isStorageFormatCompatibleWithDomain()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_FORMAT_ILLEGAL_HOST); getReturnValue().getCanDoActionMessages().add( String.format("$storageFormat %1$s", getStorageDomain().getStorageFormat())); return false; } return canAddDomain(); }

Target:
protected boolean canDoAction() { if (!super.canDoAction() || !initializeVds() || !checkStorageDomainNameLengthValid()) { return false; } if (isStorageWithSameNameExists()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NAME_ALREADY_EXIST); } if (getStorageDomain().getStorageDomainType() == StorageDomainType.ISO && !getStorageDomain().getStorageType().isFileDomain()) { addCanDoActionMessageVariable("domainType", StorageConstants.ISO); addCanDoActionMessageVariable("storageTypes", StorageConstants.FILE); return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DOMAIN_TYPE_CAN_BE_CREATED_ONLY_ON_SPECIFIC_STORAGE_DOMAINS); } if (getStorageDomain().getStorageDomainType() == StorageDomainType.ImportExport && (getStorageDomain().getStorageType() == StorageType.LOCALFS || getStorageDomain().getStorageType().isBlockDomain())) { addCanDoActionMessageVariable("domainType", StorageConstants.EXPORT); addCanDoActionMessageVariable("storageTypes", StorageConstants.SHARED + " " + StorageConstants.FILE); return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DOMAIN_TYPE_CAN_BE_CREATED_ONLY_ON_SPECIFIC_STORAGE_DOMAINS); } if (getStorageDomain().getStorageDomainType() == StorageDomainType.Master) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_ILLEGAL); } if (!Guid.isNullOrEmpty(getParameters().getStoragePoolId()) && getTargetStoragePool() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_EXIST); } ensureStorageFormatInitialized(); StorageDomainToPoolRelationValidator storageDomainToPoolRelationValidator = getAttachDomainValidator(); StorageDomainValidator sdValidator = getStorageDomainValidator(); if ( !validate(storageDomainToPoolRelationValidator.isStorageDomainFormatCorrectForDC()) || !validate(sdValidator.isStorageFormatCompatibleWithDomain()) ) { return false; } return canAddDomain(); }