[lxc-devel] [pylxd/master] Allow specification of devices in a profile

zulcss on Github lxc-bot at linuxcontainers.org
Wed May 25 01:59:15 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 514 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160525/08ff3787/attachment.bin>
-------------- next part --------------
From bf24df46d21da59d4dd7537de3cb2a6225d3f63b Mon Sep 17 00:00:00 2001
From: Chuck Short <chuck.short at canonical.com>
Date: Tue, 24 May 2016 21:50:33 -0400
Subject: [PATCH] Allow specification of devices in a profile

Currently its not specify devices when creating a
LXD profile. This is required so we can attach
disks, network interfaces, etc.

Signed-off-by: Chuck Short <chuck.short at canonical.com>
---
 pylxd/profile.py            | 5 +++--
 pylxd/tests/test_profile.py | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/pylxd/profile.py b/pylxd/profile.py
index 1dab086..16c7de4 100644
--- a/pylxd/profile.py
+++ b/pylxd/profile.py
@@ -44,11 +44,12 @@ def all(cls, client):
         return profiles
 
     @classmethod
-    def create(cls, client, name, config):
+    def create(cls, client, name, config, devices={}):
         """Create a profile."""
         client.api.profiles.post(json={
             'name': name,
-            'config': config
+            'config': config,
+            'devices': devices
             })
 
         return cls.get(client, name)
diff --git a/pylxd/tests/test_profile.py b/pylxd/tests/test_profile.py
index f8ea7e1..49df682 100644
--- a/pylxd/tests/test_profile.py
+++ b/pylxd/tests/test_profile.py
@@ -14,7 +14,7 @@ def test_all(self):
     def test_create(self):
         """A new profile is created."""
         an_profile = profile.Profile.create(
-            self.client, name='an-new-profile', config={})
+            self.client, name='an-new-profile', config={}, devices={})
 
         self.assertIsInstance(an_profile, profile.Profile)
         self.assertEqual('an-new-profile', an_profile.name)


More information about the lxc-devel mailing list