|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + * or more contributor license agreements. See the NOTICE file |
| 4 | + * distributed with this work for additional information |
| 5 | + * regarding copyright ownership. The ASF licenses this file |
| 6 | + * to you under the Apache License, Version 2.0 (the |
| 7 | + * "License"); you may not use this file except in compliance |
| 8 | + * with the License. You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, |
| 13 | + * software distributed under the License is distributed on an |
| 14 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + * KIND, either express or implied. See the License for the |
| 16 | + * specific language governing permissions and limitations |
| 17 | + * under the License. |
| 18 | + */ |
| 19 | +package org.apache.cloudstack.storage.driver; |
| 20 | + |
| 21 | +import com.cloud.agent.api.to.DataStoreTO; |
| 22 | +import com.cloud.agent.api.to.DataTO; |
| 23 | +import com.cloud.host.Host; |
| 24 | +import com.cloud.storage.Storage; |
| 25 | +import com.cloud.storage.StoragePool; |
| 26 | +import com.cloud.storage.Volume; |
| 27 | +import com.cloud.utils.Pair; |
| 28 | +import org.apache.cloudstack.engine.subsystem.api.storage.ChapInfo; |
| 29 | +import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult; |
| 30 | +import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult; |
| 31 | +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; |
| 32 | +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; |
| 33 | +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreCapabilities; |
| 34 | +import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver; |
| 35 | +import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; |
| 36 | +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo; |
| 37 | +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; |
| 38 | +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; |
| 39 | +import org.apache.cloudstack.storage.command.CommandResult; |
| 40 | +import org.apache.logging.log4j.LogManager; |
| 41 | +import org.apache.logging.log4j.Logger; |
| 42 | +import org.springframework.stereotype.Component; |
| 43 | + |
| 44 | +import java.util.HashMap; |
| 45 | +import java.util.Map; |
| 46 | + |
| 47 | +@Component |
| 48 | +public class OntapPrimaryDatastoreDriver implements PrimaryDataStoreDriver { |
| 49 | + |
| 50 | + private static final Logger s_logger = (Logger)LogManager.getLogger(OntapPrimaryDatastoreDriver.class); |
| 51 | + @Override |
| 52 | + public Map<String, String> getCapabilities() { |
| 53 | + s_logger.trace("OntapPrimaryDatastoreDriver: getCapabilities: Called"); |
| 54 | + Map<String, String> mapCapabilities = new HashMap<>(); |
| 55 | + |
| 56 | + mapCapabilities.put(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString(), Boolean.TRUE.toString()); |
| 57 | + mapCapabilities.put(DataStoreCapabilities.CAN_CREATE_VOLUME_FROM_SNAPSHOT.toString(), Boolean.TRUE.toString()); |
| 58 | + |
| 59 | + return mapCapabilities; |
| 60 | + } |
| 61 | + |
| 62 | + @Override |
| 63 | + public DataTO getTO(DataObject data) { |
| 64 | + return null; |
| 65 | + } |
| 66 | + |
| 67 | + @Override |
| 68 | + public DataStoreTO getStoreTO(DataStore store) { |
| 69 | + return null; |
| 70 | + } |
| 71 | + |
| 72 | + @Override |
| 73 | + public void createAsync(DataStore store, DataObject data, AsyncCompletionCallback<CreateCmdResult> callback) { |
| 74 | + |
| 75 | + s_logger.trace("OntapPrimaryDatastoreDriver: createAsync: Store: "+store+", data: "+data); |
| 76 | + } |
| 77 | + |
| 78 | + @Override |
| 79 | + public void deleteAsync(DataStore store, DataObject data, AsyncCompletionCallback<CommandResult> callback) { |
| 80 | + |
| 81 | + } |
| 82 | + |
| 83 | + @Override |
| 84 | + public void copyAsync(DataObject srcData, DataObject destData, AsyncCompletionCallback<CopyCommandResult> callback) { |
| 85 | + |
| 86 | + } |
| 87 | + |
| 88 | + @Override |
| 89 | + public void copyAsync(DataObject srcData, DataObject destData, Host destHost, AsyncCompletionCallback<CopyCommandResult> callback) { |
| 90 | + |
| 91 | + } |
| 92 | + |
| 93 | + @Override |
| 94 | + public boolean canCopy(DataObject srcData, DataObject destData) { |
| 95 | + return false; |
| 96 | + } |
| 97 | + |
| 98 | + @Override |
| 99 | + public void resize(DataObject data, AsyncCompletionCallback<CreateCmdResult> callback) { |
| 100 | + |
| 101 | + } |
| 102 | + |
| 103 | + @Override |
| 104 | + public ChapInfo getChapInfo(DataObject dataObject) { |
| 105 | + return null; |
| 106 | + } |
| 107 | + |
| 108 | + @Override |
| 109 | + public boolean grantAccess(DataObject dataObject, Host host, DataStore dataStore) { |
| 110 | + return true; |
| 111 | + } |
| 112 | + |
| 113 | + @Override |
| 114 | + public void revokeAccess(DataObject dataObject, Host host, DataStore dataStore) { |
| 115 | + |
| 116 | + } |
| 117 | + |
| 118 | + @Override |
| 119 | + public long getDataObjectSizeIncludingHypervisorSnapshotReserve(DataObject dataObject, StoragePool storagePool) { |
| 120 | + return 0; |
| 121 | + } |
| 122 | + |
| 123 | + @Override |
| 124 | + public long getBytesRequiredForTemplate(TemplateInfo templateInfo, StoragePool storagePool) { |
| 125 | + return 0; |
| 126 | + } |
| 127 | + |
| 128 | + @Override |
| 129 | + public long getUsedBytes(StoragePool storagePool) { |
| 130 | + return 0; |
| 131 | + } |
| 132 | + |
| 133 | + @Override |
| 134 | + public long getUsedIops(StoragePool storagePool) { |
| 135 | + return 0; |
| 136 | + } |
| 137 | + |
| 138 | + @Override |
| 139 | + public void takeSnapshot(SnapshotInfo snapshot, AsyncCompletionCallback<CreateCmdResult> callback) { |
| 140 | + |
| 141 | + } |
| 142 | + |
| 143 | + @Override |
| 144 | + public void revertSnapshot(SnapshotInfo snapshotOnImageStore, SnapshotInfo snapshotOnPrimaryStore, AsyncCompletionCallback<CommandResult> callback) { |
| 145 | + |
| 146 | + } |
| 147 | + |
| 148 | + @Override |
| 149 | + public void handleQualityOfServiceForVolumeMigration(VolumeInfo volumeInfo, QualityOfServiceState qualityOfServiceState) { |
| 150 | + |
| 151 | + } |
| 152 | + |
| 153 | + @Override |
| 154 | + public boolean canProvideStorageStats() { |
| 155 | + return true; |
| 156 | + } |
| 157 | + |
| 158 | + @Override |
| 159 | + public Pair<Long, Long> getStorageStats(StoragePool storagePool) { |
| 160 | + return null; |
| 161 | + } |
| 162 | + |
| 163 | + @Override |
| 164 | + public boolean canProvideVolumeStats() { |
| 165 | + return true; |
| 166 | + } |
| 167 | + |
| 168 | + @Override |
| 169 | + public Pair<Long, Long> getVolumeStats(StoragePool storagePool, String volumeId) { |
| 170 | + return null; |
| 171 | + } |
| 172 | + |
| 173 | + @Override |
| 174 | + public boolean canHostAccessStoragePool(Host host, StoragePool pool) { |
| 175 | + return true; |
| 176 | + } |
| 177 | + |
| 178 | + @Override |
| 179 | + public boolean isVmInfoNeeded() { |
| 180 | + return true; |
| 181 | + } |
| 182 | + |
| 183 | + @Override |
| 184 | + public void provideVmInfo(long vmId, long volumeId) { |
| 185 | + |
| 186 | + } |
| 187 | + |
| 188 | + @Override |
| 189 | + public boolean isVmTagsNeeded(String tagKey) { |
| 190 | + return true; |
| 191 | + } |
| 192 | + |
| 193 | + @Override |
| 194 | + public void provideVmTags(long vmId, long volumeId, String tagValue) { |
| 195 | + |
| 196 | + } |
| 197 | + |
| 198 | + @Override |
| 199 | + public boolean isStorageSupportHA(Storage.StoragePoolType type) { |
| 200 | + return true; |
| 201 | + } |
| 202 | + |
| 203 | + @Override |
| 204 | + public void detachVolumeFromAllStorageNodes(Volume volume) { |
| 205 | + |
| 206 | + } |
| 207 | +} |
0 commit comments