block_devices

package
v0.0.0-...-63319d1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MPL-2.0, Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Attach

func Attach(c *golangsdk.ServiceClient, opts AttachOpts) (*jobs.Job, error)

Attach is a method to mount a disk to a specified cloud server.

func Detach

func Detach(c *golangsdk.ServiceClient, volumeId string, opts DetachOpts) (*jobs.Job, error)

Detach is a method to unmount a disk from a specified cloud server.

Types

type AttachOpts

type AttachOpts struct {
	// Indicates the disk device name.
	// NOTE:
	//   The new disk device name cannot be the same as an existing one.
	//   This parameter is mandatory for Xen ECSs. Set the parameter value to /dev/sda for the system disks of such ECSs
	//   and to /dev/sdx for data disks, where x is a letter in alphabetical order. For example, if there are two data
	//   disks, set the device names of the two data disks to /dev/sdb and /dev/sdc, respectively. If you set a device
	//   name starting with /dev/vd, the system uses /dev/sd by default.
	//   For KVM ECSs, set the parameter value to /dev/vda for system disks. The device names for data disks of KVM ECSs
	//   are optional. If the device names of data disks are required, set them in alphabetical order. For example, if
	//   there are two data disks, set the device names of the two data disks to /dev/vdb and /dev/vdc, respectively.
	//   If you set a device name starting with /dev/sd, the system uses /dev/vd by default.
	Device string `json:"device"`
	// Specifies the ID of the disk to be attached. The value is in UUID format.
	VolumeId string `json:"volumeId" required:"true"`
	// Specifies the ID of the ECS to which the disk will be attached.
	ServerId string `json:"-" required:"true"`
}

AttachOpts is the structure required by the Attach method to mount the disk.

type DetachOpts

type DetachOpts struct {
	// Indicates whether to forcibly detach a data disk.
	//   If yes, set it to 1.
	//   If no, set it to 0.
	// Defaults to 0.
	DeleteFlag int `q:"delete_flag"`
	// Specifies the ID of the ECS to which the disk will be detached.
	ServerId string `json:"-" required:"true"`
}

DetachOpts is the structure required by the Detach method to unmount a disk from the cloud server.

type Error

type Error struct {
	// Error code.
	Code string `json:"code"`
	// Error message.
	Message string `json:"message"`
}

type ErrorResponse

type ErrorResponse struct {
	// Response error.
	Error Error `json:"error"`
}

type GetResult

type GetResult struct {
	golangsdk.Result
}

func Get

func Get(c *golangsdk.ServiceClient, server_id string, volume_id string) (r GetResult)

Get is a method to obtain the detail of volume attachment for specified cloud server.

func (GetResult) Extract

func (r GetResult) Extract() (*VolumeAttachment, error)

func (GetResult) ExtractInto

func (r GetResult) ExtractInto(v interface{}) error

type VolumeAttachment

type VolumeAttachment 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 drive letter of the EVS disk, which is the device name of the EVS disk.
	Device string `json:"device"`
	// Specifies the PCI address.
	PciAddress string `json:"pciAddress"`
	// Specifies the EVS disk size in GB.
	Size int `json:"size"`
	// Specifies the EVS disk boot sequence.
	// 0 indicates the system disk.
	// Non-0 indicates a data disk.
	BootIndex int `json:"bootIndex"`
	// Specifies the disk bus type.
	// Options: virtio and scsi
	BusType string `json:"bus"`
}

VolumeAttachment is the structure of the detail of disk mounting.

func List

func List(c *golangsdk.ServiceClient, serverId string) ([]VolumeAttachment, error)

List is a method to obtain the list of volume attachment details for specified cloud server.

func (*VolumeAttachment) UnmarshalJSON

func (r *VolumeAttachment) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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