Skip to content
This repository has been archived by the owner on Jul 16, 2020. It is now read-only.

Commit

Permalink
ciao-controller: Remove duplicated size from BlockData
Browse files Browse the repository at this point in the history
storage.BlockDevice is embedded in types.BlockData and already contains
a Size member. Now that BlockDevice.Size is being populated by the
storage backend when the BlockDevice is created this member and its
users can be removed.

Signed-off-by: Rob Bradford <[email protected]>
  • Loading branch information
rbradford committed Jan 6, 2017
1 parent 776334d commit 4ad3fc2
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 22 deletions.
1 change: 0 additions & 1 deletion ciao-controller/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ func addBlockDevice(c *controller, tenant string, instanceID string, device stor
// a block device is bootable.
data := types.BlockData{
BlockDevice: device,
Size: s.Size,
CreateTime: time.Now(),
TenantID: tenant,
Name: fmt.Sprintf("Storage for instance: %s", instanceID),
Expand Down
15 changes: 0 additions & 15 deletions ciao-controller/internal/datastore/datastore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1346,7 +1346,6 @@ func TestAttachVolumeFailure(t *testing.T) {

data := types.BlockData{
BlockDevice: blockDevice,
Size: 0,
State: types.Available,
TenantID: newTenant.ID,
CreateTime: time.Now(),
Expand Down Expand Up @@ -1403,7 +1402,6 @@ func TestDetachVolumeFailure(t *testing.T) {

data := types.BlockData{
BlockDevice: blockDevice,
Size: 0,
State: types.Available,
TenantID: newTenant.ID,
CreateTime: time.Now(),
Expand Down Expand Up @@ -1495,7 +1493,6 @@ func TestAddBlockDevice(t *testing.T) {

data := types.BlockData{
BlockDevice: blockDevice,
Size: 0,
State: types.Available,
TenantID: newTenant.ID,
CreateTime: time.Now(),
Expand Down Expand Up @@ -1537,7 +1534,6 @@ func TestDeleteBlockDevice(t *testing.T) {

data := types.BlockData{
BlockDevice: blockDevice,
Size: 0,
State: types.Available,
TenantID: newTenant.ID,
CreateTime: time.Now(),
Expand Down Expand Up @@ -1585,7 +1581,6 @@ func TestUpdateBlockDevice(t *testing.T) {

data := types.BlockData{
BlockDevice: blockDevice,
Size: 0,
State: types.Available,
TenantID: newTenant.ID,
CreateTime: time.Now(),
Expand Down Expand Up @@ -1649,7 +1644,6 @@ func TestUpdateBlockDeviceErr(t *testing.T) {

data := types.BlockData{
BlockDevice: blockDevice,
Size: 0,
State: types.Available,
TenantID: newTenant.ID,
CreateTime: time.Now(),
Expand All @@ -1674,7 +1668,6 @@ func TestCreateStorageAttachment(t *testing.T) {

data := types.BlockData{
BlockDevice: blockDevice,
Size: 0,
State: types.Available,
TenantID: tenant.ID,
CreateTime: time.Now(),
Expand Down Expand Up @@ -1736,7 +1729,6 @@ func TestUpdateStorageAttachmentExisting(t *testing.T) {

data := types.BlockData{
BlockDevice: blockDevice,
Size: 0,
State: types.Available,
TenantID: tenant.ID,
CreateTime: time.Now(),
Expand Down Expand Up @@ -1804,7 +1796,6 @@ func TestUpdateStorageAttachmentNotExisting(t *testing.T) {

data := types.BlockData{
BlockDevice: blockDevice,
Size: 0,
State: types.Available,
TenantID: tenant.ID,
CreateTime: time.Now(),
Expand Down Expand Up @@ -1848,7 +1839,6 @@ func TestUpdateStorageAttachmentDeleted(t *testing.T) {

data := types.BlockData{
BlockDevice: blockDevice,
Size: 0,
State: types.Available,
TenantID: tenant.ID,
CreateTime: time.Now(),
Expand Down Expand Up @@ -1903,7 +1893,6 @@ func TestGetStorageAttachment(t *testing.T) {

data := types.BlockData{
BlockDevice: blockDevice,
Size: 0,
State: types.Available,
TenantID: tenant.ID,
CreateTime: time.Now(),
Expand Down Expand Up @@ -1960,7 +1949,6 @@ func TestGetStorageAttachmentError(t *testing.T) {

data := types.BlockData{
BlockDevice: blockDevice,
Size: 0,
State: types.Available,
TenantID: tenant.ID,
CreateTime: time.Now(),
Expand Down Expand Up @@ -2003,7 +1991,6 @@ func TestDeleteStorageAttachment(t *testing.T) {

data := types.BlockData{
BlockDevice: blockDevice,
Size: 0,
State: types.Available,
TenantID: tenant.ID,
CreateTime: time.Now(),
Expand Down Expand Up @@ -2070,7 +2057,6 @@ func TestDeleteStorageAttachmentError(t *testing.T) {

data := types.BlockData{
BlockDevice: blockDevice,
Size: 0,
State: types.Available,
TenantID: tenant.ID,
CreateTime: time.Now(),
Expand Down Expand Up @@ -2142,7 +2128,6 @@ func TestGetVolumeAttachments(t *testing.T) {

data := types.BlockData{
BlockDevice: blockDevice,
Size: 0,
State: types.Available,
TenantID: tenant.ID,
CreateTime: time.Now(),
Expand Down
4 changes: 0 additions & 4 deletions ciao-controller/internal/datastore/sqlite3db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ func TestSQLiteDBGetTenantDevices(t *testing.T) {

data := types.BlockData{
BlockDevice: blockDevice,
Size: 0,
State: types.Available,
TenantID: uuid.Generate().String(),
CreateTime: time.Now(),
Expand Down Expand Up @@ -114,7 +113,6 @@ func TestSQLiteDBGetTenantWithStorage(t *testing.T) {

data := types.BlockData{
BlockDevice: blockDevice,
Size: 0,
State: types.Available,
TenantID: tenantID,
CreateTime: time.Now(),
Expand Down Expand Up @@ -155,7 +153,6 @@ func TestSQLiteDBGetAllBlockData(t *testing.T) {

data := types.BlockData{
BlockDevice: blockDevice,
Size: 0,
State: types.Available,
TenantID: uuid.Generate().String(),
CreateTime: time.Now(),
Expand Down Expand Up @@ -191,7 +188,6 @@ func TestSQLiteDBDeleteBlockData(t *testing.T) {

data := types.BlockData{
BlockDevice: blockDevice,
Size: 0,
State: types.Available,
TenantID: uuid.Generate().String(),
CreateTime: time.Now(),
Expand Down
1 change: 0 additions & 1 deletion ciao-controller/openstack_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ func (c *controller) CreateVolume(tenant string, req block.RequestedVolume) (blo
// you should modify BlockData to include a "bootable" flag.
data := types.BlockData{
BlockDevice: bd,
Size: req.Size,
CreateTime: time.Now(),
TenantID: tenant,
State: types.Available,
Expand Down
1 change: 0 additions & 1 deletion ciao-controller/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ const (
type BlockData struct {
storage.BlockDevice
TenantID string // the tenant who owns this volume
Size int // size in GB
State BlockState // status of
CreateTime time.Time // when we created the volume
Name string // a human readable name for this volume
Expand Down

0 comments on commit 4ad3fc2

Please sign in to comment.