/** * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. * * This software is licensed under the GNU General Public License v3 or later. * * It is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ package com.cloud.vm; import com.cloud.storage.Volume; /** * DiskCharacteristics describes a disk and what functionality is required from it. * This object is generated by the management server and passed to the allocators * and resources to allocate and create disks. There object is immutable once * it has been created. */ public class DiskCharacteristics { private long size; private String[] tags; private Volume.VolumeType type; private String name; private boolean useLocalStorage; private boolean recreatable; private long diskOfferingId; private Long templateId; protected DiskCharacteristics() { } public DiskCharacteristics(Volume.VolumeType type, String name, long diskOfferingId, long size, String[] tags, boolean useLocalStorage, boolean recreatable, Long templateId) { this.type = type; this.name = name; this.size = size; this.tags = tags; this.useLocalStorage = useLocalStorage; this.recreatable = recreatable; this.diskOfferingId = diskOfferingId; this.templateId = templateId; } /** * @return size of the disk requested in bytes. */ public long getSize() { return size; } /** * @return Unique name for the disk. */ public String getName() { return name; } /** * @return tags for the disk. This can be used to match it to different storage pools. */ public String[] getTags() { return tags; } /** * @return type of volume. */ public Volume.VolumeType getType() { return type; } /** * @return Does this volume require local storage? */ public boolean useLocalStorage() { return useLocalStorage; } /** * @return Is this volume recreatable? A volume is recreatable if the disk's content can be * reconstructed from the template. */ public boolean isRecreatable() { return recreatable; } /** * @return template id the disk is based on. Can be null if it is not based on any templates. */ public Long getTemplateId() { return templateId; } /** * @return disk offering id that the disk is based on. */ public long getDiskOfferingId() { return diskOfferingId; } @Override public String toString() { return new StringBuilder("DskChr[").append(type).append("|").append(size).append("|").append("]").toString(); } }