Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion core/src/com/cloud/agent/api/StartupRoutingCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class StartupRoutingCommand extends StartupCommand {
long memory;
long dom0MinMemory;
boolean poolSync;

private boolean supportsClonedVolumes;

String caps;
String pool;
Expand Down Expand Up @@ -180,4 +180,12 @@ public HashMap<String, HashMap<String, VgpuTypesInfo>> getGpuGroupDetails() {
public void setGpuGroupDetails(HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails) {
this.groupDetails = groupDetails;
}

public boolean getSupportsClonedVolumes() {
return supportsClonedVolumes;
}

public void setSupportsClonedVolumes(boolean supportsClonedVolumes) {
this.supportsClonedVolumes = supportsClonedVolumes;
}
}
37 changes: 23 additions & 14 deletions core/src/com/cloud/agent/api/storage/ResizeVolumeCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,34 @@
public class ResizeVolumeCommand extends Command {
private String path;
private StorageFilerTO pool;
private String vmInstance;
private Long newSize;
private Long currentSize;
private Long newSize;
private boolean shrinkOk;
private String vmInstance;

protected ResizeVolumeCommand() {
/* For managed storage */
private boolean managed;
private String iScsiName;

protected ResizeVolumeCommand() {
}

public ResizeVolumeCommand(String path, StorageFilerTO pool, Long currentSize, Long newSize, boolean shrinkOk, String vmInstance) {
this.path = path;
this.pool = pool;
this.vmInstance = vmInstance;
this.currentSize = currentSize;
this.newSize = newSize;
this.shrinkOk = shrinkOk;
this.vmInstance = vmInstance;
this.managed = false;
}

public ResizeVolumeCommand(String path, StorageFilerTO pool, Long currentSize, Long newSize, boolean shrinkOk, String vmInstance,
boolean isManaged, String iScsiName) {
this(path, pool, currentSize, newSize, shrinkOk, vmInstance);

this.iScsiName = iScsiName;
this.managed = isManaged;
}

public String getPath() {
Expand All @@ -55,28 +67,25 @@ public StorageFilerTO getPool() {
return pool;
}

public long getNewSize() {
return newSize;
}
public long getCurrentSize() { return currentSize; }

public long getCurrentSize() {
return currentSize;
}
public long getNewSize() { return newSize; }

public boolean getShrinkOk() {
return shrinkOk;
}
public boolean getShrinkOk() { return shrinkOk; }

public String getInstanceName() {
return vmInstance;
}

public boolean isManaged() { return managed; }

public String get_iScsiName() {return iScsiName; }

/**
* {@inheritDoc}
*/
@Override
public boolean executeInSequence() {
return false;
}

}
3 changes: 3 additions & 0 deletions core/src/com/cloud/storage/resource/StorageProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.apache.cloudstack.storage.command.DettachCommand;
import org.apache.cloudstack.storage.command.ForgetObjectCmd;
import org.apache.cloudstack.storage.command.IntroduceObjectCmd;
import org.apache.cloudstack.storage.command.ResignatureCommand;
import org.apache.cloudstack.storage.command.SnapshotAndCopyCommand;

import com.cloud.agent.api.Answer;
Expand Down Expand Up @@ -68,4 +69,6 @@ public interface StorageProcessor {
public Answer forgetObject(ForgetObjectCmd cmd);

public Answer snapshotAndCopy(SnapshotAndCopyCommand cmd);

public Answer resignature(ResignatureCommand cmd);
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.apache.cloudstack.storage.command.DeleteCommand;
import org.apache.cloudstack.storage.command.DettachCommand;
import org.apache.cloudstack.storage.command.IntroduceObjectCmd;
import org.apache.cloudstack.storage.command.ResignatureCommand;
import org.apache.cloudstack.storage.command.SnapshotAndCopyCommand;
import org.apache.cloudstack.storage.command.StorageSubSystemCommand;

Expand Down Expand Up @@ -64,6 +65,8 @@ public Answer handleStorageCommands(StorageSubSystemCommand command) {
return processor.introduceObject((IntroduceObjectCmd)command);
} else if (command instanceof SnapshotAndCopyCommand) {
return processor.snapshotAndCopy((SnapshotAndCopyCommand)command);
} else if (command instanceof ResignatureCommand) {
return processor.resignature((ResignatureCommand)command);
}

return new Answer((Command)command, false, "not implemented yet");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
//
// 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.command;

import com.cloud.agent.api.Answer;
import com.cloud.storage.Storage.ImageFormat;

public class ResignatureAnswer extends Answer {
private long size;
private String path;
private ImageFormat format;

public ResignatureAnswer() {
}

public ResignatureAnswer(String errMsg) {
super(null, false, errMsg);
}

public void setSize(long size) {
this.size = size;
}

public long getSize() {
return size;
}

public void setPath(String path) {
this.path = path;
}

public String getPath() {
return path;
}

public void setFormat(ImageFormat format) {
this.format = format;
}

public ImageFormat getFormat() {
return format;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//
// 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.command;

import com.cloud.utils.Utils;

import java.util.Map;

public final class ResignatureCommand extends StorageSubSystemCommand {
private final Map<String, String> details;

private boolean executeInSequence = true;

public ResignatureCommand(final Map<String, String> details) {
this.details = Utils.getImmutableMap(details);
}

public Map<String, String> getDetails() {
return details;
}

@Override
public void setExecuteInSequence(final boolean executeInSequence) {
this.executeInSequence = executeInSequence;
}

@Override
public boolean executeInSequence() {
return executeInSequence;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class PrimaryDataStoreTO implements DataStoreTO {
public static final String CHAP_INITIATOR_SECRET = PrimaryDataStore.CHAP_INITIATOR_SECRET;
public static final String CHAP_TARGET_USERNAME = PrimaryDataStore.CHAP_TARGET_USERNAME;
public static final String CHAP_TARGET_SECRET = PrimaryDataStore.CHAP_TARGET_SECRET;
public static final String REMOVE_AFTER_COPY = PrimaryDataStore.REMOVE_AFTER_COPY;
public static final String VOLUME_SIZE = PrimaryDataStore.VOLUME_SIZE;

private final String uuid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,23 @@
*/
package org.apache.cloudstack.engine.subsystem.api.storage;

/**
* enumerates different capabilities storage drivers may have
*/
public enum DataStoreCapabilities {
VOLUME_SNAPSHOT_QUIESCEVM,
STORAGE_SYSTEM_SNAPSHOT // indicates to the StorageSystemSnapshotStrategy that this driver takes snapshots on its own system
/**
* indicates that this driver takes CloudStack volume snapshots on its own system (as either back-end snapshots or back-end clones)
*/
STORAGE_SYSTEM_SNAPSHOT,
/**
* indicates that this driver supports the "cloneOfSnapshot" property of cloud.snapshot_details (for creating a back-end volume
* from a back-end snapshot or a back-end clone) and that it supports the invocation of the createAsync method where a SnapshotInfo is passed in while using
* the "tempVolume" property of snapshot_details
*/
CAN_CREATE_VOLUME_FROM_SNAPSHOT,
/**
* indicates that this driver supports the "cloneOfSnapshot" property of cloud.snapshot_details (for creating a volume from a volume)
*/
CAN_CREATE_VOLUME_FROM_VOLUME
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat;

public interface PrimaryDataStore extends DataStore, PrimaryDataStoreInfo {
DataObject create(DataObject dataObject, boolean createEntryInTempSpoolRef);

VolumeInfo getVolume(long id);

List<VolumeInfo> getVolumes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,38 @@

import com.cloud.host.Host;
import com.cloud.storage.StoragePool;
import com.cloud.storage.Volume;

public interface PrimaryDataStoreDriver extends DataStoreDriver {
ChapInfo getChapInfo(VolumeInfo volumeInfo);
ChapInfo getChapInfo(DataObject dataObject);

boolean grantAccess(DataObject dataObject, Host host, DataStore dataStore);

void revokeAccess(DataObject dataObject, Host host, DataStore dataStore);

// intended for managed storage (cloud.storage_pool.managed = true)
// if not managed, return volume.getSize()
long getVolumeSizeIncludingHypervisorSnapshotReserve(Volume volume, StoragePool storagePool);

// intended for managed storage (cloud.storage_pool.managed = true)
// if managed storage, return the total number of bytes currently in use for the storage pool in question
// if not managed storage, return 0
/**
* intended for managed storage (cloud.storage_pool.managed = true)
* if not managed, return volume.getSize()
*/
long getDataObjectSizeIncludingHypervisorSnapshotReserve(DataObject dataObject, StoragePool storagePool);

/**
* intended for zone-wide primary storage that is capable of storing a template once and using it in multiple clusters
* if not this kind of storage, return 0
*/
long getBytesRequiredForTemplate(TemplateInfo templateInfo, StoragePool storagePool);

/**
* intended for managed storage (cloud.storage_pool.managed = true)
* if managed storage, return the total number of bytes currently in use for the storage pool in question
* if not managed storage, return 0
*/
long getUsedBytes(StoragePool storagePool);

// intended for managed storage (cloud.storage_pool.managed = true)
// if managed storage, return the total number of IOPS currently in use for the storage pool in question
// if not managed storage, return 0
/**
* intended for managed storage (cloud.storage_pool.managed = true)
* if managed storage, return the total number of IOPS currently in use for the storage pool in question
* if not managed storage, return 0
*/
long getUsedIops(StoragePool storagePool);

void takeSnapshot(SnapshotInfo snapshot, AsyncCompletionCallback<CreateCmdResult> callback);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public interface PrimaryDataStoreInfo extends StoragePool {
static final String CHAP_INITIATOR_SECRET = "chapInitiatorSecret";
static final String CHAP_TARGET_USERNAME = "chapTargetUsername";
static final String CHAP_TARGET_SECRET = "chapTargetSecret";
static final String REMOVE_AFTER_COPY = "removeAfterCopy";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not lethal but these strings seem to warrant an enum as well, do they?

static final String VOLUME_SIZE = "volumeSize";

boolean isHypervisorSupported(HypervisorType hypervisor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class TemplateApiResult extends CommandResult {

public TemplateApiResult(TemplateInfo template) {
super();

this.template = template;
}

Expand All @@ -52,6 +53,8 @@ public TemplateInfo getTemplate() {

AsyncCallFuture<TemplateApiResult> prepareTemplateOnPrimary(TemplateInfo srcTemplate, StoragePool pool);

AsyncCallFuture<TemplateApiResult> deleteTemplateOnPrimary(TemplateInfo template, StoragePool pool);

void syncTemplateToRegionStore(long templateId, DataStore store);

void handleSysTemplateDownload(HypervisorType hostHyper, Long dcId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public VolumeInfo getVolume() {
}
}

ChapInfo getChapInfo(VolumeInfo volumeInfo, DataStore dataStore);
ChapInfo getChapInfo(DataObject dataObject, DataStore dataStore);

boolean grantAccess(DataObject dataObject, Host host, DataStore dataStore);

Expand Down Expand Up @@ -81,7 +81,7 @@ public VolumeInfo getVolume() {

VolumeEntity getVolumeEntity(long volumeId);

AsyncCallFuture<VolumeApiResult> createManagedStorageAndVolumeFromTemplateAsync(VolumeInfo volumeInfo, long destDataStoreId,
AsyncCallFuture<VolumeApiResult> createManagedStorageVolumeFromTemplateAsync(VolumeInfo volumeInfo, long destDataStoreId,
TemplateInfo srcTemplateInfo, long destHostId);

AsyncCallFuture<VolumeApiResult> createVolumeFromTemplateAsync(VolumeInfo volume, long dataStoreId,
Expand Down
Loading