Merge lp:~blake-rouse/maas/fix-1612203-1611949 into lp:~maas-committers/maas/trunk

Proposed by Blake Rouse
Status: Merged
Approved by: Blake Rouse
Approved revision: no longer in the source branch.
Merged at revision: 5446
Proposed branch: lp:~blake-rouse/maas/fix-1612203-1611949
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 159 lines (+53/-6)
4 files modified
src/maasserver/models/bootresource.py (+5/-5)
src/maasserver/models/tests/test_bootresource.py (+10/-1)
src/maasserver/testing/factory.py (+27/-0)
src/provisioningserver/rackdservices/tftp.py (+11/-0)
To merge this branch: bzr merge lp:~blake-rouse/maas/fix-1612203-1611949
Reviewer Review Type Date Requested Status
Andres Rodriguez (community) Approve
Review via email: mp+307598@code.launchpad.net

Commit message

When selecting the best architecture to perform enlistment only select between fully imported images. Log a message if "no-such-image" occurs when enlistment is being performed.

To post a comment you must log in.
Revision history for this message
Andres Rodriguez (andreserl) wrote :

Overall looks good to me. I'd like to add some more information to the message that is shown.

review: Needs Fixing
Revision history for this message
Andres Rodriguez (andreserl) wrote :

+1 just please improve the message.

review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :
Download full text (1.6 MiB)

The attempt to merge lp:~blake-rouse/maas/fix-1612203-1611949 into lp:maas failed. Below is the output from the failed tests.

Hit:1 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial-updates InRelease [95.7 kB]
Get:3 http://security.ubuntu.com/ubuntu xenial-security InRelease [94.5 kB]
Hit:4 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial-backports InRelease
Fetched 190 kB in 0s (434 kB/s)
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
    --no-install-recommends install apache2 archdetect-deb authbind avahi-utils bash bind9 bind9utils build-essential bzr bzr-builddeb chromium-browser chromium-chromedriver curl daemontools debhelper dh-apport dh-systemd distro-info dnsutils firefox freeipmi-tools git gjs ipython isc-dhcp-common isc-dhcp-server libjs-angularjs libjs-jquery libjs-jquery-hotkeys libjs-yui3-full libjs-yui3-min libpq-dev make nodejs-legacy npm postgresql pxelinux python3-all python3-apt python3-attr python3-bson python3-convoy python3-crochet python3-cssselect python3-curtin python3-dev python3-distro-info python3-django python3-django-nose python3-django-piston3 python3-dnspython python3-docutils python3-formencode python3-hivex python3-httplib2 python3-jinja2 python3-jsonschema python3-lxml python3-netaddr python3-netifaces python3-novaclient python3-oauth python3-oauthlib python3-openssl python3-paramiko python3-petname python3-pexpect python3-psycopg2 python3-pyinotify python3-pyparsing python3-pyvmomi python3-requests python3-seamicroclient python3-setuptools python3-simplestreams python3-sphinx python3-tempita python3-twisted python3-txtftp python3-tz python3-yaml python3-zope.interface python-bson python-crochet python-django python-django-piston python-djorm-ext-pgarray python-formencode python-lxml python-netaddr python-netifaces python-pocket-lint python-psycopg2 python-simplejson python-tempita python-twisted python-yaml socat syslinux-common tgt ubuntu-cloudimage-keyring wget xvfb
Reading package lists...
Building dependency tree...
Reading state information...
archdetect-deb is already the newest version (1.117ubuntu2).
authbind is already the newest version (2.1.1+nmu1).
avahi-utils is already the newest version (0.6.32~rc+dfsg-1ubuntu2).
build-essential is already the newest version (12.1ubuntu2).
debhelper is already the newest version (9.20160115ubuntu3).
distro-info is already the newest version (0.14build1).
freeipmi-tools is already the newest version (1.4.11-1ubuntu1).
git is already the newest version (1:2.7.4-0ubuntu1).
libjs-angularjs is already the newest version (1.2.28-1ubuntu2).
libjs-jquery is already the newest version (1.11.3+dfsg-4).
libjs-yui3-full is already the newest version (3.5.1-1ubuntu3).
libjs-yui3-min is already the newest version (3.5.1-1ubuntu3).
make is already the newest version (4.1-6).
postgresql is already the newest version (9.5+173).
pxelinux is already the newest version (3:6.03+dfsg-11ubuntu1).
python-formencode is already the newest version (1.3.0-0ubuntu5).
python-lxml is already the newest version (3.5.0-1build1).
python-netaddr is already t...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/models/bootresource.py'
2--- src/maasserver/models/bootresource.py 2016-09-29 19:23:13 +0000
3+++ src/maasserver/models/bootresource.py 2016-10-05 12:48:58 +0000
4@@ -111,7 +111,7 @@
5 """
6 arches = set()
7 for resource in self.all():
8- resource_set = resource.get_latest_set()
9+ resource_set = resource.get_latest_complete_set()
10 if (resource_set is not None and
11 resource_set.commissionable and
12 resource_set.xinstallable):
13@@ -132,7 +132,7 @@
14 name = '%s/%s' % (osystem, series)
15 resources = self.filter(name=name).order_by('architecture')
16 for resource in resources:
17- resource_set = resource.get_latest_set()
18+ resource_set = resource.get_latest_complete_set()
19 if resource_set is not None and resource_set.commissionable:
20 yield resource
21
22@@ -243,7 +243,7 @@
23 architecture__startswith=architecture, name__startswith=name):
24 if kflavor is not None and resource.kflavor != kflavor:
25 continue
26- resource_set = resource.get_latest_set()
27+ resource_set = resource.get_latest_complete_set()
28 if(resource_set is None or
29 not resource_set.commissionable or
30 not resource_set.xinstallable):
31@@ -283,7 +283,7 @@
32
33 resource = self.filter(name=os_release, architecture=hwe_arch).first()
34 if resource:
35- latest_set = resource.get_latest_set()
36+ latest_set = resource.get_latest_complete_set()
37 if latest_set:
38 kernel = latest_set.files.filter(
39 filetype=BOOT_RESOURCE_FILE_TYPE.BOOT_KERNEL).first()
40@@ -314,7 +314,7 @@
41 resources = []
42 for resource in self.filter(
43 rtype=BOOT_RESOURCE_TYPE.SYNCED, name__in=lts_releases):
44- resource_set = resource.get_latest_set()
45+ resource_set = resource.get_latest_complete_set()
46 if resource_set is not None and resource_set.commissionable:
47 resources.append(resource)
48
49
50=== modified file 'src/maasserver/models/tests/test_bootresource.py'
51--- src/maasserver/models/tests/test_bootresource.py 2016-10-03 17:53:44 +0000
52+++ src/maasserver/models/tests/test_bootresource.py 2016-10-05 12:48:58 +0000
53@@ -147,8 +147,10 @@
54 def test_get_usable_architectures(self):
55 arches = [
56 '%s/%s' % (factory.make_name('arch'), factory.make_name('subarch'))
57- for _ in range(3)
58+ for _ in range(4)
59 ]
60+ incomplete_arch = arches.pop()
61+ factory.make_incomplete_boot_resource(architecture=incomplete_arch)
62 for arch in arches:
63 factory.make_usable_boot_resource(architecture=arch)
64 usable_arches = BootResource.objects.get_usable_architectures()
65@@ -188,6 +190,8 @@
66 name = '%s/%s' % (os, series)
67 resource = factory.make_usable_boot_resource(
68 rtype=BOOT_RESOURCE_TYPE.SYNCED, name=name)
69+ factory.make_incomplete_boot_resource(
70+ rtype=BOOT_RESOURCE_TYPE.SYNCED, name=name)
71 not_commissionable = factory.make_BootResource(
72 rtype=BOOT_RESOURCE_TYPE.SYNCED, name=name)
73 factory.make_BootResourceSet(not_commissionable)
74@@ -643,6 +647,11 @@
75 factory.make_usable_boot_resource(
76 name=self.name, rtype=BOOT_RESOURCE_TYPE.SYNCED,
77 architecture="%s/%s" % (self.arch, i), kflavor=kflavor)
78+ factory.make_incomplete_boot_resource(
79+ name=self.name, rtype=BOOT_RESOURCE_TYPE.SYNCED,
80+ architecture="%s/%s" % (
81+ self.arch, factory.make_name("incomplete")),
82+ kflavor=kflavor)
83 else:
84 generic_kernels = self.kernels
85 factory.make_usable_boot_resource(
86
87=== modified file 'src/maasserver/testing/factory.py'
88--- src/maasserver/testing/factory.py 2016-09-30 21:08:56 +0000
89+++ src/maasserver/testing/factory.py 2016-10-05 12:48:58 +0000
90@@ -1541,6 +1541,33 @@
91 resource_set, filename=filetype, filetype=filetype, size=None)
92 return resource
93
94+ def make_incomplete_boot_resource(
95+ self, rtype=None, name=None, architecture=None,
96+ extra=None, version=None, label=None, kflavor=None, size=None,
97+ bootloader_type=None):
98+ resource = self.make_BootResource(
99+ rtype=rtype, name=name, architecture=architecture, extra=extra,
100+ kflavor=kflavor, bootloader_type=bootloader_type)
101+ resource_set = self.make_BootResourceSet(
102+ resource, version=version, label=label)
103+ filetypes = {
104+ BOOT_RESOURCE_FILE_TYPE.BOOT_KERNEL,
105+ BOOT_RESOURCE_FILE_TYPE.BOOT_INITRD,
106+ }
107+ filetypes.add(random.choice([
108+ BOOT_RESOURCE_FILE_TYPE.SQUASHFS_IMAGE,
109+ BOOT_RESOURCE_FILE_TYPE.ROOT_IMAGE,
110+ ]))
111+ filetypes.add(random.choice(XINSTALL_TYPES))
112+ for filetype in filetypes:
113+ # Create a half completed file.
114+ size = 512
115+ content = factory.make_bytes(256)
116+ self.make_boot_resource_file_with_content(
117+ resource_set, filename=filetype, filetype=filetype,
118+ size=size, content=content)
119+ return resource
120+
121 def make_default_ubuntu_release_bootable(self, arch=None):
122 if arch is None:
123 arch = self.make_name('arch')
124
125=== modified file 'src/provisioningserver/rackdservices/tftp.py'
126--- src/provisioningserver/rackdservices/tftp.py 2016-06-30 18:27:39 +0000
127+++ src/provisioningserver/rackdservices/tftp.py 2016-10-05 12:48:58 +0000
128@@ -25,6 +25,7 @@
129 send_event_node_mac_address,
130 )
131 from provisioningserver.kernel_opts import KernelParameters
132+from provisioningserver.logger.log import get_maas_logger
133 from provisioningserver.rpc.boot_images import list_boot_images
134 from provisioningserver.rpc.exceptions import BootConfigNoResponse
135 from provisioningserver.rpc.region import (
136@@ -68,6 +69,9 @@
137 from twisted.python.filepath import FilePath
138
139
140+maaslog = get_maas_logger("tftp")
141+
142+
143 def get_boot_image(params):
144 """Get the boot image for the params on this rack controller."""
145 # Match on purpose; enlist uses the commissioning purpose.
146@@ -191,6 +195,13 @@
147 d.addErrback(
148 log.err,
149 "Failed to mark machine failed: %s" % description)
150+ else:
151+ maaslog.error(
152+ "Enlistment failed to boot %s; missing required boot "
153+ "image %s/%s/%s/%s." % (
154+ params["remote_ip"],
155+ params['osystem'], params["arch"],
156+ params["subarch"], params["release"]))
157 params["label"] = "no-such-image"
158 else:
159 params["label"] = boot_image["label"]