Kami commented on a change in pull request #1478:
URL: https://github.com/apache/libcloud/pull/1478#discussion_r470845443



##########
File path: libcloud/container/drivers/lxd.py
##########
@@ -1225,12 +1444,102 @@ def ex_delete_storage_pool_volume(self, pool_id, type, 
name):
         :return:
         """
 
-        response = self.connection.request("/%s/storage-pools/%s/volumes/%s/%s"
-                                           % (self.version, pool_id,
-                                              type, name),
-                                           method="DELETE")
+        try:
+
+            req = "/%s/storage-pools/%s/volumes/%s/%s" % (self.version,
+                                                          pool_id,
+                                                          type,
+                                                          name)
+            response = self.connection.request(req, method="DELETE")
+
+            response_dict = response.parse_body()
+            assert_response(response_dict=response_dict, status_code=200)
+        except BaseHTTPError as err:
+            raise self._get_lxd_api_exception_for_error(err)
+
+        return True
+
+    def ex_list_networks(self):
+        """
+        Returns a list of networks.
+        Implements GET /1.0/networks
+        Authentication: trusted
+        Operation: sync
+
+        :rtype: list of LXDNetwork objects
+        """
+
+        req = "/%s/networks" % (self.version)
+        response = self.connection.request(req)
+
+        response_dict = response.parse_body()
+        assert_response(response_dict=response_dict, status_code=200)
+
+        nets = response_dict["metadata"]
+        networks = []
+        for net in nets:
+            name = net.split('/')[-1]
+            networks.append(self.ex_get_network(name=name))

Review comment:
       This seems a bit wasteful - do we really need to perform another request 
for each network returned by /1.0/networks? Aka doesn't the list response 
contain enough information?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to