summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog14
-rw-r--r--debian/cloud-init.templates2
-rw-r--r--debian/patches/lp1316475-1303986-cloudsigma.patch122
-rw-r--r--debian/patches/series1
4 files changed, 138 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index d2c71ba2..8f40cbed 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,17 @@
+cloud-init (0.7.5-0ubuntu1.1) trusty-proposed; urgency=medium
+
+ [ Ben Howard ]
+ * debian/patches/lp1316475-1303986-cloudsigma.patch: Backport of
+ CloudSigma Datasource from 14.10
+ - [FFe] Support VendorData for CloudSigma (LP: #1303986).
+ - Only query /dev/ttys1 when CloudSigma is detected (LP: #1316475).
+
+ [ Scott Moser ]
+ * debian/cloud-init.templates: fix choices so dpkg-reconfigure works as
+ expected (LP: #1325746)
+
+ -- Scott Moser <smoser@ubuntu.com> Fri, 20 Jun 2014 13:29:29 -0400
+
cloud-init (0.7.5-0ubuntu1) trusty; urgency=medium
* New upstream release.
diff --git a/debian/cloud-init.templates b/debian/cloud-init.templates
index 30e1a6a7..1076649c 100644
--- a/debian/cloud-init.templates
+++ b/debian/cloud-init.templates
@@ -1,7 +1,7 @@
Template: cloud-init/datasources
Type: multiselect
Default: NoCloud, ConfigDrive, OpenNebula, Azure, AltCloud, OVF, MAAS, GCE, OpenStack, CloudSigma, Ec2, CloudStack, None
-Choices-C: NoCloud, ConfigDrive, OpenNebula, Azure, AltCloud, OVF, MAAS, Ec2, CloudStack, None
+Choices-C: NoCloud, ConfigDrive, OpenNebula, Azure, AltCloud, OVF, MAAS, GCE, Openstack, CloudSigma, Ec2, CloudStack, None
Choices: NoCloud: Reads info from /var/lib/cloud/seed only, ConfigDrive: Reads data from Openstack Config Drive, OpenNebula: read from OpenNebula context disk, Azure: read from MS Azure cdrom. Requires walinux-agent, AltCloud: config disks for RHEVm and vSphere, OVF: Reads data from OVF Transports, MAAS: Reads data from Ubuntu MAAS, GCE: google compute metadata service, OpenStack: native openstack metadata service, CloudSigma: metadata over serial for cloudsigma.com, Ec2: reads data from EC2 Metadata service, CloudStack: Read from CloudStack metadata service, None: Failsafe datasource
Description: Which data sources should be searched?
Cloud-init supports searching different "Data Sources" for information
diff --git a/debian/patches/lp1316475-1303986-cloudsigma.patch b/debian/patches/lp1316475-1303986-cloudsigma.patch
new file mode 100644
index 00000000..8d13ac5e
--- /dev/null
+++ b/debian/patches/lp1316475-1303986-cloudsigma.patch
@@ -0,0 +1,122 @@
+Author: Ben Howard <ben.howard@ubuntu.com>
+Bug: https://launchpad.net/bugs/1316475
+Bug: https://launchpad.net/bugs/1303986
+Applied-Upstream: yes
+Description: Backport of 14.10 CloudSigma datasource
+ Only use /dev/ttys1 for CloudSigma if on CloudSigma
+ Added Vendordata support for CloudSigma datasource
+ Updated test suite for CloudSigma datasource
+--- a/cloudinit/sources/DataSourceCloudSigma.py
++++ b/cloudinit/sources/DataSourceCloudSigma.py
+@@ -16,10 +16,12 @@
+ # You should have received a copy of the GNU General Public License
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
+ from base64 import b64decode
++import os
+ import re
+
+ from cloudinit import log as logging
+ from cloudinit import sources
++from cloudinit import util
+ from cloudinit.cs_utils import Cepko
+
+ LOG = logging.getLogger(__name__)
+@@ -40,12 +42,40 @@
+ self.ssh_public_key = ''
+ sources.DataSource.__init__(self, sys_cfg, distro, paths)
+
++ def is_running_in_cloudsigma(self):
++ """
++ Uses dmidecode to detect if this instance of cloud-init is running
++ in the CloudSigma's infrastructure.
++ """
++ uname_arch = os.uname()[4]
++ if uname_arch.startswith("arm") or uname_arch == "aarch64":
++ # Disabling because dmidecode in CMD_DMI_SYSTEM crashes kvm process
++ LOG.debug("Disabling CloudSigma datasource on arm (LP: #1243287)")
++ return False
++
++ dmidecode_path = util.which('dmidecode')
++ if not dmidecode_path:
++ return False
++
++ LOG.debug("Determining hypervisor product name via dmidecode")
++ try:
++ cmd = [dmidecode_path, "--string", "system-product-name"]
++ system_product_name, _ = util.subp(cmd)
++ return 'cloudsigma' in system_product_name.lower()
++ except:
++ LOG.warn("Failed to get hypervisor product name via dmidecode")
++
++ return False
++
+ def get_data(self):
+ """
+ Metadata is the whole server context and /meta/cloud-config is used
+ as userdata.
+ """
+ dsmode = None
++ if not self.is_running_in_cloudsigma():
++ return False
++
+ try:
+ server_context = self.cepko.all().result
+ server_meta = server_context['meta']
+@@ -66,6 +96,8 @@
+ self.userdata_raw = server_meta.get('cloudinit-user-data', "")
+ if 'cloudinit-user-data' in base64_fields:
+ self.userdata_raw = b64decode(self.userdata_raw)
++ if 'cloudinit' in server_context.get('vendor_data', {}):
++ self.vendordata_raw = server_context["vendor_data"]["cloudinit"]
+
+ self.metadata = server_context
+ self.ssh_public_key = server_meta['ssh_public_key']
+--- a/tests/unittests/test_datasource/test_cloudsigma.py
++++ b/tests/unittests/test_datasource/test_cloudsigma.py
+@@ -20,7 +20,11 @@
+ "smp": 1,
+ "tags": ["much server", "very performance"],
+ "uuid": "65b2fb23-8c03-4187-a3ba-8b7c919e8890",
+- "vnc_password": "9e84d6cb49e46379"
++ "vnc_password": "9e84d6cb49e46379",
++ "vendor_data": {
++ "location": "zrh",
++ "cloudinit": "#cloud-config\n\n...",
++ }
+ }
+
+
+@@ -35,6 +39,7 @@
+ class DataSourceCloudSigmaTest(TestCase):
+ def setUp(self):
+ self.datasource = DataSourceCloudSigma.DataSourceCloudSigma("", "", "")
++ self.datasource.is_running_in_cloudsigma = lambda: True
+ self.datasource.cepko = CepkoMock(SERVER_CONTEXT)
+ self.datasource.get_data()
+
+@@ -68,3 +73,25 @@
+ self.datasource.get_data()
+
+ self.assertEqual(self.datasource.userdata_raw, b'hi world\n')
++
++ def test_vendor_data(self):
++ self.assertEqual(self.datasource.vendordata_raw,
++ SERVER_CONTEXT['vendor_data']['cloudinit'])
++
++ def test_lack_of_vendor_data(self):
++ stripped_context = copy.deepcopy(SERVER_CONTEXT)
++ del stripped_context["vendor_data"]
++ self.datasource = DataSourceCloudSigma.DataSourceCloudSigma("", "", "")
++ self.datasource.cepko = CepkoMock(stripped_context)
++ self.datasource.get_data()
++
++ self.assertIsNone(self.datasource.vendordata_raw)
++
++ def test_lack_of_cloudinit_key_in_vendor_data(self):
++ stripped_context = copy.deepcopy(SERVER_CONTEXT)
++ del stripped_context["vendor_data"]["cloudinit"]
++ self.datasource = DataSourceCloudSigma.DataSourceCloudSigma("", "", "")
++ self.datasource.cepko = CepkoMock(stripped_context)
++ self.datasource.get_data()
++
++ self.assertIsNone(self.datasource.vendordata_raw)
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 00000000..9c43ebc0
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+lp1316475-1303986-cloudsigma.patch