add storage motion interface

This commit is contained in:
Edison Su 2012-11-14 17:47:09 -08:00
parent b38d9b82b6
commit cad75e7220
10 changed files with 90 additions and 20 deletions

View File

@ -92,6 +92,5 @@ public interface VirtualMachineTemplate extends ControlledEntity {
Long getSourceTemplateId(); Long getSourceTemplateId();
String getTemplateTag(); String getTemplateTag();
Map getDetails(); Map getDetails();
} }

View File

@ -23,5 +23,5 @@ import org.apache.cloudstack.engine.entity.api.CloudStackEntity;
import com.cloud.template.VirtualMachineTemplate; import com.cloud.template.VirtualMachineTemplate;
public interface TemplateEntity extends CloudStackEntity, VirtualMachineTemplate { public interface TemplateEntity extends CloudStackEntity, VirtualMachineTemplate {
} }

View File

@ -348,7 +348,7 @@ public class StorageOrchestratorImpl implements StorageOrchestrator {
PrimaryDataStore pd = primaryStorageMgr.getPrimaryDataStore(dataStoreId); PrimaryDataStore pd = primaryStorageMgr.getPrimaryDataStore(dataStoreId);
boolean existsOnPrimaryStorage = pd.templateExists(template.getId()); boolean existsOnPrimaryStorage = pd.templateExists(template.getId());
if (!existsOnPrimaryStorage) { if (!existsOnPrimaryStorage) {
pd.installTemplate(template);
} }
return false; return false;
} }

View File

@ -14,6 +14,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.disktype.VolumeDiskTyp
import org.apache.cloudstack.storage.HypervisorHostEndPoint; import org.apache.cloudstack.storage.HypervisorHostEndPoint;
import org.apache.cloudstack.storage.datastore.db.DataStoreVO; import org.apache.cloudstack.storage.datastore.db.DataStoreVO;
import org.apache.cloudstack.storage.datastore.driver.PrimaryDataStoreDriver; import org.apache.cloudstack.storage.datastore.driver.PrimaryDataStoreDriver;
import org.apache.cloudstack.storage.image.TemplateInfo;
import org.apache.cloudstack.storage.volume.VolumeEntityImpl; import org.apache.cloudstack.storage.volume.VolumeEntityImpl;
import org.apache.cloudstack.storage.volume.VolumeEvent; import org.apache.cloudstack.storage.volume.VolumeEvent;
@ -63,13 +64,6 @@ public class DefaultPrimaryDataStoreImpl implements PrimaryDataStore {
public boolean deleteVolume(long id) { public boolean deleteVolume(long id) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return false; return false;
}
@Override
public VolumeInfo createVolume(VolumeInfo vol, VolumeDiskType diskType) {
} }
@Override @Override
@ -141,4 +135,16 @@ public class DefaultPrimaryDataStoreImpl implements PrimaryDataStore {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return false; return false;
} }
@Override
public boolean templateExists(long templateId) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean createTemplate(TemplateObject template) {
// TODO Auto-generated method stub
return false;
}
} }

View File

@ -25,6 +25,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo; import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
import org.apache.cloudstack.engine.subsystem.api.storage.disktype.VolumeDiskType; import org.apache.cloudstack.engine.subsystem.api.storage.disktype.VolumeDiskType;
import org.apache.cloudstack.storage.image.TemplateObject;
import org.apache.cloudstack.storage.volume.VolumeObject; import org.apache.cloudstack.storage.volume.VolumeObject;
@ -37,4 +38,5 @@ public interface PrimaryDataStore extends PrimaryDataStoreInfo {
PrimaryDataStoreInfo getDataStoreInfo(); PrimaryDataStoreInfo getDataStoreInfo();
boolean exists(VolumeInfo vi); boolean exists(VolumeInfo vi);
boolean templateExists(long templateId); boolean templateExists(long templateId);
boolean installTemplate(TemplateObject template);
} }

View File

@ -18,6 +18,14 @@
*/ */
package org.apache.cloudstack.storage.image; package org.apache.cloudstack.storage.image;
import org.apache.cloudstack.storage.image.store.ImageDataStoreInfo;
public class TemplateObject implements TemplateInfo { public class TemplateObject implements TemplateInfo {
@Override
public ImageDataStoreInfo getImageDataStore() {
// TODO Auto-generated method stub
return null;
}
} }

View File

@ -0,0 +1,23 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.cloudstack.storage.image.motion;
public class DefaultImageMotionProvider implements ImageMotionProvider {
}

View File

@ -0,0 +1,26 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.cloudstack.storage.image.motion;
import org.apache.cloudstack.engine.cloud.entity.api.TemplateEntity;
import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
public interface ImageMotionProvider {
public boolean canHandle(TemplateEntity template, PrimaryDataStore dataStoe);
}

View File

@ -16,9 +16,12 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.apache.cloudstack.storage.image; package org.apache.cloudstack.storage.image.motion;
import org.apache.cloudstack.engine.cloud.entity.api.TemplateEntity;
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
public interface ImageMotionService { public interface ImageMotionService {
boolean copyTemplate(String templateUri, String destTemplateUri); boolean copyTemplate(TemplateEntity template, PrimaryDataStoreInfo dataStore);
boolean copyIso(String isoUri, String destIsoUri); boolean copyIso(String isoUri, String destIsoUri);
} }

View File

@ -16,20 +16,23 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.apache.cloudstack.storage.image; package org.apache.cloudstack.storage.image.motion;
import org.apache.cloudstack.engine.cloud.entity.api.TemplateEntity;
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
public class ImageMotionServiceImpl implements ImageMotionService { public class ImageMotionServiceImpl implements ImageMotionService {
@Override
public boolean copyTemplate(String templateUri, String destTemplateUri) {
// TODO Auto-generated method stub
return false;
}
@Override @Override
public boolean copyIso(String isoUri, String destIsoUri) { public boolean copyIso(String isoUri, String destIsoUri) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return false; return false;
} }
@Override
public boolean copyTemplate(TemplateEntity template, PrimaryDataStore dataStore) {
// TODO Auto-generated method stub
return false;
}
} }