|
16 | 16 | // under the License. |
17 | 17 | package com.cloud.storage; |
18 | 18 |
|
| 19 | +import java.math.BigDecimal; |
| 20 | +import java.net.URI; |
| 21 | +import java.net.URISyntaxException; |
| 22 | +import java.net.UnknownHostException; |
| 23 | +import java.sql.PreparedStatement; |
| 24 | +import java.sql.ResultSet; |
| 25 | +import java.util.ArrayList; |
| 26 | +import java.util.Collection; |
| 27 | +import java.util.Collections; |
| 28 | +import java.util.Date; |
| 29 | +import java.util.HashMap; |
| 30 | +import java.util.Iterator; |
| 31 | +import java.util.List; |
| 32 | +import java.util.Map; |
| 33 | +import java.util.Random; |
| 34 | +import java.util.Set; |
| 35 | +import java.util.concurrent.ExecutionException; |
| 36 | +import java.util.concurrent.Executors; |
| 37 | +import java.util.concurrent.ScheduledExecutorService; |
| 38 | +import java.util.concurrent.TimeUnit; |
| 39 | + |
| 40 | +import javax.ejb.Local; |
| 41 | +import javax.inject.Inject; |
| 42 | +import javax.naming.ConfigurationException; |
| 43 | + |
| 44 | +import org.apache.cloudstack.api.command.admin.storage.AddImageStoreCmd; |
| 45 | +import org.apache.cloudstack.api.command.admin.storage.CancelPrimaryStorageMaintenanceCmd; |
| 46 | +import org.apache.cloudstack.api.command.admin.storage.CreateSecondaryStagingStoreCmd; |
| 47 | +import org.apache.cloudstack.api.command.admin.storage.CreateStoragePoolCmd; |
| 48 | +import org.apache.cloudstack.api.command.admin.storage.DeleteImageStoreCmd; |
| 49 | +import org.apache.cloudstack.api.command.admin.storage.DeletePoolCmd; |
| 50 | +import org.apache.cloudstack.api.command.admin.storage.DeleteSecondaryStagingStoreCmd; |
| 51 | +import org.apache.cloudstack.api.command.admin.storage.UpdateStoragePoolCmd; |
| 52 | +import org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope; |
| 53 | +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; |
| 54 | +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreLifeCycle; |
| 55 | +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager; |
| 56 | +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider; |
| 57 | +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManager; |
| 58 | +import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector; |
| 59 | +import org.apache.cloudstack.engine.subsystem.api.storage.HostScope; |
| 60 | +import org.apache.cloudstack.engine.subsystem.api.storage.HypervisorHostListener; |
| 61 | +import org.apache.cloudstack.engine.subsystem.api.storage.ImageStoreProvider; |
| 62 | +import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo; |
| 63 | +import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory; |
| 64 | +import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; |
| 65 | +import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator; |
| 66 | +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateDataFactory; |
| 67 | +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateService; |
| 68 | +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory; |
| 69 | +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService; |
| 70 | +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService.VolumeApiResult; |
| 71 | +import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope; |
| 72 | +import org.apache.cloudstack.framework.async.AsyncCallFuture; |
| 73 | +import org.apache.cloudstack.storage.datastore.db.ImageStoreDao; |
| 74 | +import org.apache.cloudstack.storage.datastore.db.ImageStoreDetailsDao; |
| 75 | +import org.apache.cloudstack.storage.datastore.db.ImageStoreVO; |
| 76 | +import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; |
| 77 | +import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreDao; |
| 78 | +import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreVO; |
| 79 | +import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao; |
| 80 | +import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; |
| 81 | +import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao; |
| 82 | +import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO; |
| 83 | +import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreDao; |
| 84 | +import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreVO; |
| 85 | +import org.apache.cloudstack.storage.image.datastore.ImageStoreEntity; |
| 86 | +import org.apache.log4j.Logger; |
| 87 | +import org.springframework.stereotype.Component; |
| 88 | + |
19 | 89 | import com.cloud.agent.AgentManager; |
20 | 90 | import com.cloud.agent.api.Answer; |
21 | 91 | import com.cloud.agent.api.Command; |
|
105 | 175 | import com.cloud.vm.VirtualMachineProfile; |
106 | 176 | import com.cloud.vm.VirtualMachineProfileImpl; |
107 | 177 | import com.cloud.vm.dao.VMInstanceDao; |
108 | | -import org.apache.cloudstack.api.command.admin.storage.AddImageStoreCmd; |
109 | | -import org.apache.cloudstack.api.command.admin.storage.CancelPrimaryStorageMaintenanceCmd; |
110 | | -import org.apache.cloudstack.api.command.admin.storage.CreateSecondaryStagingStoreCmd; |
111 | | -import org.apache.cloudstack.api.command.admin.storage.CreateStoragePoolCmd; |
112 | | -import org.apache.cloudstack.api.command.admin.storage.DeleteImageStoreCmd; |
113 | | -import org.apache.cloudstack.api.command.admin.storage.DeletePoolCmd; |
114 | | -import org.apache.cloudstack.api.command.admin.storage.DeleteSecondaryStagingStoreCmd; |
115 | | -import org.apache.cloudstack.api.command.admin.storage.UpdateStoragePoolCmd; |
116 | | -import org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope; |
117 | | -import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; |
118 | | -import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreLifeCycle; |
119 | | -import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager; |
120 | | -import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider; |
121 | | -import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManager; |
122 | | -import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector; |
123 | | -import org.apache.cloudstack.engine.subsystem.api.storage.HostScope; |
124 | | -import org.apache.cloudstack.engine.subsystem.api.storage.HypervisorHostListener; |
125 | | -import org.apache.cloudstack.engine.subsystem.api.storage.ImageStoreProvider; |
126 | | -import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo; |
127 | | -import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory; |
128 | | -import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; |
129 | | -import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator; |
130 | | -import org.apache.cloudstack.engine.subsystem.api.storage.TemplateDataFactory; |
131 | | -import org.apache.cloudstack.engine.subsystem.api.storage.TemplateService; |
132 | | -import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory; |
133 | | -import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService; |
134 | | -import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService.VolumeApiResult; |
135 | | -import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope; |
136 | | -import org.apache.cloudstack.framework.async.AsyncCallFuture; |
137 | | -import org.apache.cloudstack.storage.datastore.db.ImageStoreDao; |
138 | | -import org.apache.cloudstack.storage.datastore.db.ImageStoreDetailsDao; |
139 | | -import org.apache.cloudstack.storage.datastore.db.ImageStoreVO; |
140 | | -import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; |
141 | | -import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreDao; |
142 | | -import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreVO; |
143 | | -import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; |
144 | | -import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao; |
145 | | -import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao; |
146 | | -import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO; |
147 | | -import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreDao; |
148 | | -import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreVO; |
149 | | -import org.apache.cloudstack.storage.image.datastore.ImageStoreEntity; |
150 | | -import org.apache.log4j.Logger; |
151 | | -import org.springframework.stereotype.Component; |
152 | | - |
153 | | -import javax.ejb.Local; |
154 | | -import javax.inject.Inject; |
155 | | -import javax.naming.ConfigurationException; |
156 | | -import java.math.BigDecimal; |
157 | | -import java.net.URI; |
158 | | -import java.net.URISyntaxException; |
159 | | -import java.net.UnknownHostException; |
160 | | -import java.sql.PreparedStatement; |
161 | | -import java.sql.ResultSet; |
162 | | -import java.util.ArrayList; |
163 | | -import java.util.Collection; |
164 | | -import java.util.Collections; |
165 | | -import java.util.Date; |
166 | | -import java.util.HashMap; |
167 | | -import java.util.Iterator; |
168 | | -import java.util.List; |
169 | | -import java.util.Map; |
170 | | -import java.util.Random; |
171 | | -import java.util.Set; |
172 | | -import java.util.concurrent.ExecutionException; |
173 | | -import java.util.concurrent.Executors; |
174 | | -import java.util.concurrent.ScheduledExecutorService; |
175 | | -import java.util.concurrent.TimeUnit; |
176 | 178 |
|
177 | 179 | @Component |
178 | 180 | @Local(value = { StorageManager.class, StorageService.class }) |
@@ -629,6 +631,14 @@ public DataStore createLocalStorage(Host host, StoragePoolInfo pInfo) throws Con |
629 | 631 | pool = _storagePoolDao.findPoolByHostPath(host.getDataCenterId(), host.getPodId(), pInfo.getHost(), "", pInfo.getUuid()); |
630 | 632 | } |
631 | 633 | } |
| 634 | + if (pool == null) { |
| 635 | + //the path can be different, but if they have the same uuid, assume they are the same storage |
| 636 | + pool = _storagePoolDao.findPoolByHostPath(host.getDataCenterId(), host.getPodId(), pInfo.getHost(), null, |
| 637 | + pInfo.getUuid()); |
| 638 | + if (pool != null) { |
| 639 | + s_logger.debug("Found a storage pool: " + pInfo.getUuid() + ", but with different hostpath " + pInfo.getHostPath() + ", still treat it as the same pool"); |
| 640 | + } |
| 641 | + } |
632 | 642 | DataStoreProvider provider = this.dataStoreProviderMgr.getDefaultPrimaryDataStoreProvider(); |
633 | 643 | DataStoreLifeCycle lifeCycle = provider.getDataStoreLifeCycle(); |
634 | 644 | if (pool == null) { |
|
0 commit comments