com.abiquo.server.core.infrastructure.storage.DiskManagementDto Maven / Gradle / Ivy
/**
* Copyright (C) 2008 Abiquo Holdings S.L.
*
* Licensed 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 com.abiquo.server.core.infrastructure.storage;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import com.abiquo.model.enumerator.DiskControllerType;
import com.abiquo.model.transport.SingleResourceTransportDto;
import com.abiquo.server.core.appslibrary.DiskFormatTypeDto;
import com.abiquo.server.core.cloud.DiskAllocationTypeDto;
/**
* represents hard disks on the hypervisor datastore that users can attach to VMs. Hard disks are
* not persistent, which means that when you remove a hard disk from a VM or undeploy a VM, the
* auxiliary hard disk(s) are destroyed.
*/
@XmlRootElement(name = "disk")
@XmlType(propOrder = {"id", "label", "sequence", "sizeInMb", "diskFormatType", "path",
"diskFileSize", "diskControllerType", "diskController", "bus", "unit", "bootable", "uuid",
"allocation"})
public class DiskManagementDto extends SingleResourceTransportDto
{
private static final long serialVersionUID = -5756558871221831849L;
public static final String TYPE = "application/vnd.abiquo.harddisk";
public static final String MEDIA_TYPE = TYPE + "+" + JSON;
public static final String SHORT_MEDIA_TYPE_JSON = MEDIA_TYPE;
public static final String SHORT_MEDIA_TYPE_XML = TYPE + "+" + XML;
public static final String MEDIA_TYPE_XML = TYPE + "+" + XML + VERSION_PARAM + API_VERSION;
public static final String MEDIA_TYPE_JSON = MEDIA_TYPE + VERSION_PARAM + API_VERSION;
public static final String REL_PREFIX = "disk";
public static final String DATASTORE_TIER_REL_PREFIX = "datastoretier";
/** Identifier of the entity */
private Integer id;
/** Disk size in megabytes */
private Long sizeInMb;
/** Sequence number (boot order) of the disk in a virtual machine */
private Integer sequence;
/** Disk format. {@link DiskFormatTypeDto} */
private String diskFormatType;
/** Friendly name of the hard disk */
private String label;
/** Path on the datastore */
private String path;
/** Size of deployed disk in the repository. In megabytes */
private Long diskFileSize;
/** Disk controller */
private DiskControllerType diskControllerType;
/** Controller of the disk when attaching to a SCSI controller */
private String diskController;
/**
* Bus identifier for hard disk attachment. It cannot be specified in the request, it can only
* be read after the VM is deployed in the hypervisor
*/
private Integer bus;
/**
* Unit identifier on the bus for hard disk attachment. It cannot be specified in the request,
* it can only be read after the virtualmachine is deployed in the hypervisor
*/
private Integer unit;
/**
* If true, the disk is suitable to boot (meaning it's possible to define it in a VM with
* sequence 0 - (disk0 link))
*/
private boolean bootable;
/**
* Unique universal identifier of the hard disk. This is the name of the disk in the target
* storage device that can be presented as the serial number in the guest OS
*/
private String uuid;
/** Allocation type of the disk {@link DiskAllocationTypeDto} */
private String allocation;
public String getDiskController()
{
return diskController;
}
public DiskControllerType getDiskControllerType()
{
return diskControllerType;
}
public Integer getBus()
{
return bus;
}
public Integer getUnit()
{
return unit;
}
public Long getDiskFileSize()
{
return diskFileSize;
}
public String getDiskFormatType()
{
return diskFormatType;
}
public Integer getId()
{
return id;
}
public String getLabel()
{
return label;
}
public String getPath()
{
return path;
}
public Integer getSequence()
{
return sequence;
}
public Long getSizeInMb()
{
return this.sizeInMb;
}
public String getUuid()
{
return uuid;
}
public String getAllocation()
{
return allocation;
}
public void setDiskController(final String diskController)
{
this.diskController = diskController;
}
public void setDiskControllerType(final DiskControllerType diskControllerType)
{
this.diskControllerType = diskControllerType;
}
public void setDiskFileSize(final Long diskFileSize)
{
this.diskFileSize = diskFileSize;
}
public void setDiskFormatType(final String diskFormatType)
{
this.diskFormatType = diskFormatType;
}
public void setBus(final Integer bus)
{
this.bus = bus;
}
public void setUnit(final Integer unit)
{
this.unit = unit;
}
public void setId(final Integer id)
{
this.id = id;
}
public void setLabel(final String label)
{
this.label = label;
}
public void setPath(final String path)
{
this.path = path;
}
public void setSequence(final Integer sequence)
{
this.sequence = sequence;
}
public void setSizeInMb(final Long sizeInMb)
{
this.sizeInMb = sizeInMb;
}
public boolean isBootable()
{
return bootable;
}
public void setBootable(final boolean bootable)
{
this.bootable = bootable;
}
public void setUuid(final String uuid)
{
this.uuid = uuid;
}
public void setAllocation(final String allocation)
{
this.allocation = allocation;
}
@Override
public String getBaseMediaType()
{
return MEDIA_TYPE;
}
@Override
public String getMediaType()
{
return MEDIA_TYPE_JSON;
}
}