4.6.0
This commit is contained in:
@@ -10,7 +10,6 @@ import (
|
||||
|
||||
func flattenDisk(d *schema.ResourceData, disk *disks.RecordDisk) {
|
||||
diskAcl, _ := json.Marshal(disk.ACL)
|
||||
|
||||
d.Set("account_id", disk.AccountID)
|
||||
d.Set("account_name", disk.AccountName)
|
||||
d.Set("acl", string(diskAcl))
|
||||
@@ -41,6 +40,7 @@ func flattenDisk(d *schema.ResourceData, disk *disks.RecordDisk) {
|
||||
d.Set("purge_attempts", disk.PurgeAttempts)
|
||||
d.Set("present_to", disk.PresentTo)
|
||||
d.Set("purge_time", disk.PurgeTime)
|
||||
d.Set("replication", flattenDiskReplication(disk.Replication))
|
||||
d.Set("reality_device_number", disk.RealityDeviceNumber)
|
||||
d.Set("reference_id", disk.ReferenceID)
|
||||
d.Set("res_id", disk.ResID)
|
||||
@@ -58,6 +58,71 @@ func flattenDisk(d *schema.ResourceData, disk *disks.RecordDisk) {
|
||||
d.Set("vmid", disk.VMID)
|
||||
}
|
||||
|
||||
func flattenDiskReplica(d *schema.ResourceData, disk *disks.RecordDisk, statusReplication string) {
|
||||
diskAcl, _ := json.Marshal(disk.ACL)
|
||||
d.Set("account_id", disk.AccountID)
|
||||
d.Set("account_name", disk.AccountName)
|
||||
d.Set("acl", string(diskAcl))
|
||||
d.Set("boot_partition", disk.BootPartition)
|
||||
d.Set("computes", flattenDiskComputes(disk.Computes))
|
||||
d.Set("created_time", disk.CreatedTime)
|
||||
d.Set("deleted_time", disk.DeletedTime)
|
||||
d.Set("desc", disk.Description)
|
||||
d.Set("destruction_time", disk.DestructionTime)
|
||||
d.Set("devicename", disk.DeviceName)
|
||||
d.Set("disk_path", disk.DiskPath)
|
||||
d.Set("gid", disk.GID)
|
||||
d.Set("guid", disk.GUID)
|
||||
d.Set("replica_disk_id", disk.ID)
|
||||
d.Set("image_id", disk.ImageID)
|
||||
d.Set("images", disk.Images)
|
||||
d.Set("iotune", flattenIOTune(disk.IOTune))
|
||||
d.Set("iqn", disk.IQN)
|
||||
d.Set("login", disk.Login)
|
||||
d.Set("milestones", disk.Milestones)
|
||||
d.Set("disk_name", disk.Name)
|
||||
d.Set("order", disk.Order)
|
||||
d.Set("params", disk.Params)
|
||||
d.Set("parent_id", disk.ParentID)
|
||||
d.Set("passwd", disk.Password)
|
||||
d.Set("pci_slot", disk.PCISlot)
|
||||
d.Set("pool", disk.Pool)
|
||||
d.Set("purge_attempts", disk.PurgeAttempts)
|
||||
d.Set("present_to", disk.PresentTo)
|
||||
d.Set("purge_time", disk.PurgeTime)
|
||||
d.Set("replication", flattenDiskReplication(disk.Replication))
|
||||
d.Set("reality_device_number", disk.RealityDeviceNumber)
|
||||
d.Set("reference_id", disk.ReferenceID)
|
||||
d.Set("res_id", disk.ResID)
|
||||
d.Set("res_name", disk.ResName)
|
||||
d.Set("role", disk.Role)
|
||||
d.Set("sep_id", disk.SEPID)
|
||||
d.Set("sep_type", disk.SEPType)
|
||||
d.Set("shareable", disk.Shareable)
|
||||
d.Set("size_max", disk.SizeMax)
|
||||
d.Set("size_used", disk.SizeUsed)
|
||||
d.Set("snapshots", flattendDiskSnapshotList(disk.Snapshots))
|
||||
d.Set("status", disk.Status)
|
||||
d.Set("status_replication", statusReplication)
|
||||
d.Set("tech_status", disk.TechStatus)
|
||||
d.Set("type", disk.Type)
|
||||
d.Set("vmid", disk.VMID)
|
||||
}
|
||||
|
||||
func flattenDiskReplication(rep disks.ItemReplication) []map[string]interface{} {
|
||||
res := []map[string]interface{}{
|
||||
{
|
||||
"disk_id": rep.DiskID,
|
||||
"pool_id": rep.PoolID,
|
||||
"role": rep.Role,
|
||||
"self_volume_id": rep.SelfVolumeID,
|
||||
"storage_id": rep.StorageID,
|
||||
"volume_id": rep.VolumeID,
|
||||
},
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenDiskSnapshot(d *schema.ResourceData, snapshot disks.ItemSnapshot) {
|
||||
d.Set("timestamp", snapshot.Timestamp)
|
||||
d.Set("guid", snapshot.GUID)
|
||||
@@ -137,6 +202,7 @@ func flattenDiskList(dl *disks.ListDisks) []map[string]interface{} {
|
||||
"pool": disk.Pool,
|
||||
"purge_attempts": disk.PurgeAttempts,
|
||||
"purge_time": disk.PurgeTime,
|
||||
"replication": flattenDiskReplication(disk.Replication),
|
||||
"reality_device_number": disk.RealityDeviceNumber,
|
||||
"reference_id": disk.ReferenceID,
|
||||
"res_id": disk.ResID,
|
||||
|
||||
Reference in New Issue
Block a user