[lxc-devel] [lxd/master] shared/api: split storage in separate files for pools and volumes

albertodonato on Github lxc-bot at linuxcontainers.org
Fri Oct 6 10:56:25 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20171006/8b25ef42/attachment.bin>
-------------- next part --------------
From 52163f788f2a267003679108a8a17076792e2bb4 Mon Sep 17 00:00:00 2001
From: Alberto Donato <alberto.donato at canonical.com>
Date: Fri, 6 Oct 2017 12:55:44 +0200
Subject: [PATCH] shared/api: split storage in separate files for pools and
 volumes

Signed-off-by: Alberto Donato <alberto.donato at canonical.com>
---
 shared/api/storage_pools.go                   | 38 +++++++++++++++++++++++++++
 shared/api/{storage.go => storage_volumes.go} | 37 --------------------------
 2 files changed, 38 insertions(+), 37 deletions(-)
 create mode 100644 shared/api/storage_pools.go
 rename shared/api/{storage.go => storage_volumes.go} (51%)

diff --git a/shared/api/storage_pools.go b/shared/api/storage_pools.go
new file mode 100644
index 000000000..157d2d275
--- /dev/null
+++ b/shared/api/storage_pools.go
@@ -0,0 +1,38 @@
+package api
+
+// StoragePoolsPost represents the fields of a new LXD storage pool
+//
+// API extension: storage
+type StoragePoolsPost struct {
+	StoragePoolPut `yaml:",inline"`
+
+	Name   string `json:"name" yaml:"name"`
+	Driver string `json:"driver" yaml:"driver"`
+}
+
+// StoragePool represents the fields of a LXD storage pool.
+//
+// API extension: storage
+type StoragePool struct {
+	StoragePoolPut `yaml:",inline"`
+
+	Name   string   `json:"name" yaml:"name"`
+	Driver string   `json:"driver" yaml:"driver"`
+	UsedBy []string `json:"used_by" yaml:"used_by"`
+}
+
+// StoragePoolPut represents the modifiable fields of a LXD storage pool.
+//
+// API extension: storage
+type StoragePoolPut struct {
+	Config map[string]string `json:"config" yaml:"config"`
+
+	// API extension: entity_description
+	Description string `json:"description" yaml:"description"`
+}
+
+// Writable converts a full StoragePool struct into a StoragePoolPut struct
+// (filters read-only fields).
+func (storagePool *StoragePool) Writable() StoragePoolPut {
+	return storagePool.StoragePoolPut
+}
diff --git a/shared/api/storage.go b/shared/api/storage_volumes.go
similarity index 51%
rename from shared/api/storage.go
rename to shared/api/storage_volumes.go
index f598ae8b0..d887d6490 100644
--- a/shared/api/storage.go
+++ b/shared/api/storage_volumes.go
@@ -1,36 +1,5 @@
 package api
 
-// StoragePoolsPost represents the fields of a new LXD storage pool
-//
-// API extension: storage
-type StoragePoolsPost struct {
-	StoragePoolPut `yaml:",inline"`
-
-	Name   string `json:"name" yaml:"name"`
-	Driver string `json:"driver" yaml:"driver"`
-}
-
-// StoragePool represents the fields of a LXD storage pool.
-//
-// API extension: storage
-type StoragePool struct {
-	StoragePoolPut `yaml:",inline"`
-
-	Name   string   `json:"name" yaml:"name"`
-	Driver string   `json:"driver" yaml:"driver"`
-	UsedBy []string `json:"used_by" yaml:"used_by"`
-}
-
-// StoragePoolPut represents the modifiable fields of a LXD storage pool.
-//
-// API extension: storage
-type StoragePoolPut struct {
-	Config map[string]string `json:"config" yaml:"config"`
-
-	// API extension: entity_description
-	Description string `json:"description" yaml:"description"`
-}
-
 // StorageVolumesPost represents the fields of a new LXD storage pool volume
 //
 // API extension: storage
@@ -61,12 +30,6 @@ type StorageVolumePut struct {
 	Description string `json:"description" yaml:"description"`
 }
 
-// Writable converts a full StoragePool struct into a StoragePoolPut struct
-// (filters read-only fields).
-func (storagePool *StoragePool) Writable() StoragePoolPut {
-	return storagePool.StoragePoolPut
-}
-
 // Writable converts a full StorageVolume struct into a StorageVolumePut struct
 // (filters read-only fields).
 func (storageVolume *StorageVolume) Writable() StorageVolumePut {


More information about the lxc-devel mailing list