disk

package
v0.9.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttachableQuantity

type AttachableQuantity struct {
	// Specifies the number of SCSI disks that can be attached to an ECS.
	FreeSCSI int `json:"free_scsi"`
	// Specifies the number of virtio_blk disks that can be attached to an ECS.
	FreeBLK int `json:"free_blk"`
	// Specifies the total number of disks that can be attached to an ECS.
	FreeDisk int `json:"free_disk"`
}

AttachableQuantity describes how many additional disks can be attached.

type Attachments

type Attachments struct {
	// Specifies the disks attached to an ECS.
	VolumeAttachments []Volume `json:"volumeAttachments"`
	// Specifies the number of disks that can be attached to an ECS.
	AttachableQuantity *AttachableQuantity `json:"attachableQuantity"`
}

func GetAttachments

func GetAttachments(client *golangsdk.ServiceClient, serverID string) (*Attachments, error)

type CreateOpts

type CreateOpts struct {
	// ID of the ECS to which the disk will be attached.
	ServerID string `json:"-"`
	// Specifies the ECS attachment information.
	VolumeAttachment *VolumeAttachment `json:"volumeAttachment" required:"true"`
	// Specifies whether to check the request without actually attaching the disk.
	// If set to true, only a pre-check is performed and no disk is attached.
	// If set to false or omitted, the disk is attached after the check passes.
	DryRun *bool `json:"dry_run,omitempty"`
}

type JobResponse

type JobResponse struct {
	// ID of the task.
	JobID string `json:"job_id"`
}

func Attach

func Attach(client *golangsdk.ServiceClient, opts CreateOpts) (*JobResponse, error)

func Detach

func Detach(client *golangsdk.ServiceClient, serverID, volumeID string, deleteFlag int) (*JobResponse, error)

type Volume

type Volume struct {
	// Specifies the ECS ID in UUID format.
	ServerID string `json:"serverId"`
	// Specifies the EVS disk ID in UUID format.
	VolumeID string `json:"volumeId"`
	// Specifies the mount ID, which is the same as the EVS disk ID.
	// The value is in UUID format.
	ID string `json:"id"`
	// Specifies the EVS disk size in GB.
	Size int `json:"size"`
	// Specifies the drive letter of the EVS disk, displayed as the
	// device name on the console, for example /dev/vda or /dev/vdb.
	Device string `json:"device"`
	// Specifies the PCI address.
	PCIAddress string `json:"pciAddress"`
	// Specifies the EVS disk boot sequence.
	// 0 indicates the system disk; a non-zero value indicates a data disk.
	BootIndex int `json:"bootIndex"`
	// Specifies the disk bus type.
	// Options: virtio and scsi.
	Bus string `json:"bus"`
}

type VolumeAttachment

type VolumeAttachment struct {
	// ID of the disk to be attached. The value is in UUID format.
	VolumeID string `json:"volumeId" required:"true"`
	// Disk device name, such as /dev/sda or /dev/vdb.
	Device string `json:"device,omitempty"`
	// Disk type, for example SSD.
	VolumeType string `json:"volume_type,omitempty"`
	// Number of disks to attach.
	Count int `json:"count,omitempty"`
	// Indicates whether to attach the disk in passthrough (SCSI) mode.
	// If set to "true", the disk device type is SCSI.
	// If set to "false", the disk device type is VBD.
	HwPassthrough string `json:"hw:passthrough,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL