Updated on 2024-09-04 GMT+08:00

Updating Disk Information

Function

This API is used to update the disk information of a source server. After you call this API successfully, the new disk information will take effect, and the original disk information will be deleted.

Calling Method

For details, see Calling APIs.

URI

PUT /v3/sources/{source_id}/diskinfo

Table 1 Path parameter

Parameter

Mandatory

Type

Description

source_id

Yes

String

The source server ID.

Minimum length: 0 characters

Maximum length: 255 characters

Request

Table 2 Request header parameter

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

The user token. It can be obtained by calling the IAM API (value of X-Subject-Token in the response header).

Minimum length: 1 character

Maximum length: 16,384 characters

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

disks

No

Array of ServerDisk objects

The updated disk information.

Array length: 0 to 65,535 characters

volumegroups

No

Array of VolumeGroups objects

The updated volume information.

Array length: 0 to 65,535 characters

btrfs_list

No

Array of BtrfsFileSystem objects

The updated Btrfs information.

Array length: 0 to 65,535 characters

Table 4 ServerDisk field description

Parameter

Mandatory

Type

Description

name

Yes

String

The disk name.

Minimum length: 0 characters

Maximum length: 255 characters

partition_style

No

String

The disk partition type. This parameter is mandatory for source server registration.

The value can be:

  • MBR

  • GPT

device_use

Yes

String

The disk function.

The value can be:

  • BOOT

  • OS

size

Yes

Long

The disk size, in bytes.

Minimum value: 0

Maximum value: 9223372036854775807

used_size

Yes

Long

The used disk space, in bytes.

Minimum value: 0

Maximum value: 9223372036854775807

physical_volumes

Yes

Array of PhysicalVolume objects

The physical partition information of the disk.

Array length: 0 to 65,535 characters

os_disk

No

Boolean

Specifies whether the disk is the system disk.

relation_name

No

String

The name of the corresponding disk on the target server running Linux.

Minimum length: 0 characters

Maximum length: 255 characters

inode_size

No

Integer

The number of inodes.

Minimum value: 0

Maximum value: 2147483647

Table 5 PhysicalVolume

Parameter

Mandatory

Type

Description

device_use

No

String

The partition function. The value can be NORMAL, BOOT, or OS.

Minimum length: 0 characters

Maximum length: 255 characters

file_system

No

String

The file system type.

Minimum length: 0 characters

Maximum length: 255 characters

index

No

Integer

The serial number of the volume.

Minimum value: 0

Maximum value: 2147483647

mount_point

No

String

The mount point.

Minimum length: 0 characters

Maximum length: 255 characters

name

No

String

The volume name. In Windows, it indicates the drive letter, and in Linux, it indicates the device ID.

Minimum length: 0 characters

Maximum length: 255 characters

size

No

Long

The size.

Minimum value: 0

Maximum value: 9223372036854775807

used_size

No

Long

The used space.

Minimum value: 0

Maximum value: 9223372036854775807

inode_size

No

Integer

The number of inodes.

Minimum value: 0

Maximum value: 2147483647

inode_nums

No

Long

The number of inodes.

Minimum value: 0

Maximum value: 9223372036854775807

uuid

No

String

The GUID, which can be obtained from the source server.

Minimum length: 0 characters

Maximum length: 255 characters

size_per_cluster

No

Integer

The size of each cluster.

Minimum value: 0

Maximum value: 2147483647

Table 6 VolumeGroups field description

Parameter

Mandatory

Type

Description

components

No

String

The physical volume information.

Minimum length: 0 characters

Maximum length: 255 characters

free_size

No

Long

The available space.

Minimum value: 0

Maximum value: 9223372036854775807

logical_volumes

No

Array of LogicalVolumes objects

The logical volume information.

Array length: 0 to 255 characters

name

No

String

The name.

Minimum length: 0 characters

Maximum length: 255 characters

size

No

Long

The size.

Minimum value: 0

Maximum value: 9223372036854775807

Table 7 LogicalVolumes field description

Parameter

Mandatory

Type

Description

block_count

No

Integer

The number of blocks.

Minimum value: 0

Maximum value: 2147483647

Default value: 0

block_size

No

Long

The block size.

Minimum value: 0

Maximum value: 1048576

Default value: 0

file_system

Yes

String

The file system.

Minimum length: 0 characters

Maximum length: 255 characters

inode_size

Yes

Integer

The number of inodes.

Minimum value: 0

Maximum value: 2147483647

inode_nums

No

Long

The number of inodes.

Minimum value: 0

Maximum value: 9223372036854775807

device_use

No

String

The partition function. The value can be NORMAL, BOOT, or OS.

Minimum length: 0 characters

Maximum length: 255 characters

mount_point

Yes

String

The mount point.

Minimum length: 0 characters

Maximum length: 256 characters

name

Yes

String

The name.

Minimum length: 0 characters

Maximum length: 1,024 characters

size

Yes

Long

The size.

Minimum value: 0

Maximum value: 9223372036854775807

used_size

Yes

Long

The used space.

Minimum value: 0

Maximum value: 9223372036854775807

free_size

Yes

Long

The available space.

Minimum value: 0

Maximum value: 9223372036854775807

Table 8 BtrfsFileSystem field description

Parameter

Mandatory

Type

Description

name

Yes

String

The file system name.

Minimum length: 0 characters

Maximum length: 255 characters

label

Yes

String

The file system tag. If no tag exists, the value is an empty string.

Minimum length: 0 characters

Maximum length: 255 characters

The UUID.

Yes

String

The UUID of the file system.

Minimum length: 0 characters

Maximum length: 255 characters

device

Yes

String

The device name in the Btrfs.

Minimum length: 0 characters

Maximum length: 255 characters

size

Yes

Long

The space occupied by the file system.

Minimum value: 0

Maximum value: 9223372036854775807

nodesize

Yes

Long

The size of the Btrfs node.

Minimum value: 0

Maximum value: 9223372036854775807

sectorsize

Yes

Integer

The sector size.

Minimum value: 0

Maximum value: 2147483647

data_profile

Yes

String

The data profile (RAD).

Minimum length: 0 characters

Maximum length: 255 characters

system_profile

Yes

String

The file system profile (RAD).

Minimum length: 0 characters

Maximum length: 255 characters

metadata_profile

Yes

String

The metadata profile (RAD).

Minimum length: 0 characters

Maximum length: 255 characters

global_reserve1

Yes

String

The Btrfs file system information.

Minimum length: 0 characters

Maximum length: 255 characters

g_vol_used_size

Yes

Long

The used space of the Btrfs volume.

Minimum value: 0

Maximum value: 9223372036854775807

default_subvolid

Yes

String

The ID of the default subvolume.

Minimum length: 0 characters

Maximum length: 255 characters

default_subvol_name

Yes

String

The name of the default subvolume.

Minimum length: 0 characters

Maximum length: 255 characters

default_subvol_mountpath

Yes

String

The mount path of the default subvolume or Btrfs file system.

Minimum length: 0 characters

Maximum length: 255 characters

subvolume

Yes

Array of BtrfsSubvolumn objects

The subvolume information.

Array length: 0 to 65,535 characters

Table 9 BtrfsSubvolumn field description

Parameter

Mandatory

Type

Description

The UUID.

Yes

String

The UUID of the parent volume.

Minimum length: 0 characters

Maximum length: 255 characters

is_snapshot

Yes

String

Specifies whether the subvolume is a snapshot.

Minimum length: 0 characters

Maximum length: 255 characters

subvol_id

Yes

String

The subvolume ID.

Minimum length: 0 characters

Maximum length: 255 characters

parent_id

Yes

String

The parent volume ID.

Minimum length: 0 characters

Maximum length: 255 characters

subvol_name

Yes

String

The subvolume name.

Minimum length: 0 characters

Maximum length: 255 characters

subvol_mount_path

Yes

String

The mount path of the subvolume.

Minimum length: 0 characters

Maximum length: 255 characters

Response

None

Example Request

This example updates the original disk information of the server to the new disk information. The new disk name is /dev/vda, the disk function is BOOT, and the disk size is 42949672960 bytes.

PUT https://{endpoint}/v3/sources/{source_id}/diskinfo

{
  "disks" : [ {
    "name" : "/dev/vda",
    "device_use" : "BOOT",
    "size" : 42949672960,
    "partition_style" : "MBR",
    "used_size" : 42948624384,
    "physical_volumes" : [ {
      "name" : "/dev/vda1",
      "size" : 2153775104,
      "device_use" : "NORMAL",
      "used_size" : 2153775104,
      "inode_size" : 0,
      "file_system" : "swap",
      "mount_point" : ""
    }, {
      "name" : "/dev/vda2",
      "size" : 16862150656,
      "device_use" : "BTRFS",
      "used_size" : 16862150656,
      "inode_size" : 0,
      "file_system" : "btrfs",
      "mount_point" : ""
    }, {
      "name" : "/dev/vda3",
      "size" : 23932698624,
      "device_use" : "NORMAL",
      "used_size" : 33988608,
      "inode_size" : 0,
      "file_system" : "xfs",
      "mount_point" : "/home"
    } ]
  }, {
    "name" : "/dev/vdb",
    "device_use" : "NORMAL",
    "size" : 21474836480,
    "partition_style" : "MBR",
    "used_size" : 21473787904,
    "physical_volumes" : [ {
      "name" : "/dev/vdb1",
      "size" : 21473787904,
      "device_use" : "VOLUME_GROUP",
      "used_size" : 21473787904,
      "inode_size" : 0,
      "file_system" : "LVM2_member",
      "mount_point" : ""
    } ]
  }, {
    "name" : "/dev/vdc",
    "device_use" : "VOLUME_GROUP",
    "size" : 21474836480,
    "partition_style" : "MBR",
    "used_size" : 0,
    "physical_volumes" : [ ]
  } ],
  "volumegroups" : [ {
    "name" : "vg1",
    "size" : 42948624384,
    "components" : "/dev/vdb1;/dev/vdc",
    "logical_volumes" : [ {
      "name" : "/dev/mapper/vg1-lv1",
      "device_use" : "NORMAL",
      "size" : 10737418240,
      "free_size" : 10713837568,
      "used_size" : 23580672,
      "file_system" : "ext4",
      "mount_point" : "/mnt/lv1",
      "inode_size" : 256
    } ]
  } ],
  "btrfs_list" : [ {
    "name" : "/dev/vda2",
    "label" : "none",
    "uuid" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
    "device" : "/dev/vda2",
    "size" : "3.30GiB",
    "nodesize" : 16384,
    "sectorsize" : 4096,
    "data_profile" : "single",
    "system_profile" : "single",
    "metadata_profile" : "single",
    "global_reserve1" : "single",
    "g_vol_used_size" : 3894038528,
    "default_subvolid" : 259,
    "default_subvol_name" : "@/.snapshots/1/snapshot",
    "default_subvol_mountpath" : "/",
    "subvolumn" : [ {
      "uuid" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "is_snapshot" : false,
      "subvol_id" : 257,
      "parent_id" : 5,
      "subvol_name" : "@",
      "subvol_mount_path" : null
    }, {
      "uuid" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "is_snapshot" : false,
      "subvol_id" : 258,
      "parent_id" : 257,
      "subvol_name" : "@/.snapshots",
      "subvol_mount_path" : "/.snapshots"
    }, {
      "uuid" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "is_snapshot" : true,
      "subvol_id" : 259,
      "parent_id" : 258,
      "subvol_name" : "@/.snapshots/1/snapshot",
      "subvol_mount_path" : "/"
    }, {
      "uuid" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "is_snapshot" : false,
      "subvol_id" : 260,
      "parent_id" : 257,
      "subvol_name" : "@/boot/grub2/i386-pc",
      "subvol_mount_path" : "/boot/grub2/i386-pc"
    }, {
      "uuid" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "is_snapshot" : false,
      "subvol_id" : 261,
      "parent_id" : 257,
      "subvol_name" : "@/boot/grub2/x86_64-efi",
      "subvol_mount_path" : "/boot/grub2/x86_64-efi"
    }, {
      "uuid" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "is_snapshot" : false,
      "subvol_id" : 262,
      "parent_id" : 257,
      "subvol_name" : "@/opt",
      "subvol_mount_path" : "/opt"
    }, {
      "uuid" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "is_snapshot" : false,
      "subvol_id" : 263,
      "parent_id" : 257,
      "subvol_name" : "@/srv",
      "subvol_mount_path" : "/srv"
    }, {
      "uuid" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "is_snapshot" : false,
      "subvol_id" : 264,
      "parent_id" : 257,
      "subvol_name" : "@/tmp",
      "subvol_mount_path" : "/tmp"
    }, {
      "uuid" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "is_snapshot" : false,
      "subvol_id" : 265,
      "parent_id" : 257,
      "subvol_name" : "@/usr/local",
      "subvol_mount_path" : "/usr/local"
    }, {
      "uuid" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "is_snapshot" : false,
      "subvol_id" : 266,
      "parent_id" : 257,
      "subvol_name" : "@/var/cache",
      "subvol_mount_path" : "/var/cache"
    }, {
      "uuid" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "is_snapshot" : false,
      "subvol_id" : 267,
      "parent_id" : 257,
      "subvol_name" : "@/var/crash",
      "subvol_mount_path" : "/var/crash"
    }, {
      "uuid" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "is_snapshot" : false,
      "subvol_id" : 268,
      "parent_id" : 257,
      "subvol_name" : "@/var/lib/libvirt/images",
      "subvol_mount_path" : "/var/lib/libvirt/images"
    }, {
      "uuid" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "is_snapshot" : false,
      "subvol_id" : 269,
      "parent_id" : 257,
      "subvol_name" : "@/var/lib/machines",
      "subvol_mount_path" : "/var/lib/machines"
    }, {
      "uuid" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "is_snapshot" : false,
      "subvol_id" : 270,
      "parent_id" : 257,
      "subvol_name" : "@/var/lib/mailman",
      "subvol_mount_path" : "/var/lib/mailman"
    }, {
      "uuid" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "is_snapshot" : false,
      "subvol_id" : 271,
      "parent_id" : 257,
      "subvol_name" : "@/var/lib/mariadb",
      "subvol_mount_path" : "/var/lib/mariadb"
    }, {
      "uuid" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "is_snapshot" : false,
      "subvol_id" : 272,
      "parent_id" : 257,
      "subvol_name" : "@/var/lib/mysql",
      "subvol_mount_path" : "/var/lib/mysql"
    }, {
      "uuid" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "is_snapshot" : false,
      "subvol_id" : 273,
      "parent_id" : 257,
      "subvol_name" : "@/var/lib/named",
      "subvol_mount_path" : "/var/lib/named"
    }, {
      "uuid" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "is_snapshot" : false,
      "subvol_id" : 274,
      "parent_id" : 257,
      "subvol_name" : "@/var/lib/pgsql",
      "subvol_mount_path" : "/var/lib/pgsql"
    }, {
      "uuid" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "is_snapshot" : false,
      "subvol_id" : 275,
      "parent_id" : 257,
      "subvol_name" : "@/var/log",
      "subvol_mount_path" : "/var/log"
    }, {
      "uuid" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "is_snapshot" : false,
      "subvol_id" : 276,
      "parent_id" : 257,
      "subvol_name" : "@/var/opt",
      "subvol_mount_path" : "/var/opt"
    }, {
      "uuid" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "is_snapshot" : false,
      "subvol_id" : 277,
      "parent_id" : 257,
      "subvol_name" : "@/var/spool",
      "subvol_mount_path" : "/var/spool"
    }, {
      "uuid" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "is_snapshot" : false,
      "subvol_id" : 278,
      "parent_id" : 257,
      "subvol_name" : "@/var/tmp",
      "subvol_mount_path" : "/var/tmp"
    }, {
      "uuid" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "is_snapshot" : true,
      "subvol_id" : 282,
      "parent_id" : 258,
      "subvol_name" : "@/.snapshots/2/snapshot",
      "subvol_mount_path" : null
    } ]
  } ]
}

Example Response

None

Status Codes

Status Code

Description

200

Response returned.

Error Codes

For details, see Error Codes.