Merge lp:~newell-jensen/maas/2.2-fix-1694767 into lp:maas/2.2

Proposed by Newell Jensen on 2017-06-07
Status: Merged
Approved by: Mike Pontillo on 2017-06-16
Approved revision: 6061
Merged at revision: 6061
Proposed branch: lp:~newell-jensen/maas/2.2-fix-1694767
Merge into: lp:maas/2.2
Diff against target: 115 lines (+35/-14)
2 files modified
src/provisioningserver/drivers/pod/rsd.py (+16/-8)
src/provisioningserver/drivers/pod/tests/test_rsd.py (+19/-6)
To merge this branch: bzr merge lp:~newell-jensen/maas/2.2-fix-1694767
Reviewer Review Type Date Requested Status
Newell Jensen Approve on 2017-06-07
Review via email: mp+325262@code.launchpad.net

Commit message

Backport trunk r6078: Fixes RSD pod driver conditional to check that the smallest available block size is larger than the requested block device size in get_pod_machine_local_storages. Adds tests to check for successful and unsuccessful mapping of block device tags.

To post a comment you must log in.
Newell Jensen (newell-jensen) wrote :

Self review backport.

review: Approve
MAAS Lander (maas-lander) wrote :
Download full text (175.8 KiB)

The attempt to merge lp:~newell-jensen/maas/2.2-fix-1694767 into lp:maas/2.2 failed. Below is the output from the failed tests.

Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Hit:2 http://prodstack-zone-1.clouds.archive.ubuntu.com/ubuntu xenial InRelease
Get:3 http://prodstack-zone-1.clouds.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:4 http://prodstack-zone-1.clouds.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Get:5 http://prodstack-zone-1.clouds.archive.ubuntu.com/ubuntu xenial-updates/universe Sources [158 kB]
Get:6 http://prodstack-zone-1.clouds.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [479 kB]
Get:7 http://prodstack-zone-1.clouds.archive.ubuntu.com/ubuntu xenial-updates/universe Translation-en [189 kB]
Get:8 http://security.ubuntu.com/ubuntu xenial-security/universe Sources [31.9 kB]
Get:9 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [133 kB]
Get:10 http://security.ubuntu.com/ubuntu xenial-security/universe Translation-en [68.4 kB]
Fetched 1,365 kB in 0s (2,033 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 libnss-wrapper libpq-dev make nodejs-legacy npm postgresql psmisc 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...
distro-info is already the newest version (0.14build1).
distro-info set to manually installed.
libjs-jquery is already the newest version (1.11.3+dfsg-4).
libjs-jquery set to manually installed.
make is already the newest version (4.1-6).
psmisc is already the newest version (22.21-2.1build1).
python-simplejson is already the newest version (3.8.1-1ubuntu2).
python-simplejson set to manually installed.
python3-apt i...

MAAS Lander (maas-lander) wrote :
Download full text (124.5 KiB)

The attempt to merge lp:~newell-jensen/maas/2.2-fix-1694767 into lp:maas/2.2 failed. Below is the output from the failed tests.

Hit:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:2 http://prodstack-zone-1.clouds.archive.ubuntu.com/ubuntu xenial InRelease
Hit:3 http://prodstack-zone-1.clouds.archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:4 http://prodstack-zone-1.clouds.archive.ubuntu.com/ubuntu xenial-backports InRelease
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 libnss-wrapper libpq-dev make nodejs-legacy npm postgresql psmisc 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...
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).
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).
psmisc is already the newest version (22.21-2.1build1).
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 the newest version (0.7.18-1).
python-netifaces is already the newest version (0.10.4-0.1build2).
python-psycopg2 is already the newest version (2.6.1-1...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/provisioningserver/drivers/pod/rsd.py'
2--- src/provisioningserver/drivers/pod/rsd.py 2017-05-09 19:10:12 +0000
3+++ src/provisioningserver/drivers/pod/rsd.py 2017-06-07 17:54:54 +0000
4@@ -474,12 +474,13 @@
5 """Get pod machine local strorages."""
6 local_drives = node_data.get('Links', {}).get('LocalDrives', [])
7 for local_drive in local_drives:
8+ local_drive_endpoint = local_drive['@odata.id']
9 discovered_machine_block_device = (
10 DiscoveredMachineBlockDevice(
11 model='', serial='', size=0))
12 drive_data, _ = yield self.redfish_request(
13- b"GET", join(url, local_drive[
14- '@odata.id'].lstrip('/').encode('utf-8')), headers)
15+ b"GET", join(url, local_drive_endpoint.lstrip(
16+ '/').encode('utf-8')), headers)
17 discovered_machine_block_device.model = drive_data['Model']
18 discovered_machine_block_device.serial = drive_data['SerialNumber']
19 discovered_machine_block_device.size = float(
20@@ -489,26 +490,33 @@
21 # block devices. This ensures that the composed machine has the
22 # requested tags on the block device.
23 if request is not None:
24- # Iterate over all the request's block devices and pick first
25+ # Iterate over all the request's block devices and pick
26 # device that has 'local' flag set with smallest adequate size.
27 chosen_block_device = None
28 smallest_size = discovered_machine_block_device.size
29 for block_device in request.block_devices:
30 if ('local' in block_device.tags and
31- block_device.size >= smallest_size):
32+ smallest_size >= block_device.size):
33 smallest_size = block_device.size
34 chosen_block_device = block_device
35 if chosen_block_device is not None:
36 discovered_machine_block_device.tags = (
37 chosen_block_device.tags)
38 # Delete this from the request's block devices as it
39- # is not longer needed.
40+ # is no longer needed.
41 request.block_devices.remove(chosen_block_device)
42 else:
43 # Log the fact that we did not find a chosen block device
44- # to set the tags.
45- maaslog.info(
46- "Unable to set tags for local drive: %r" % local_drive)
47+ # to set the tags. If the RSD is performing the way it
48+ # should, the user should not be seeing this as the
49+ # allocation process for composition should have failed.
50+ # Warn the user of this.
51+ maaslog.warning(
52+ "Requested disk size is larger than %d GiB, which "
53+ "drive '%r' contains. RSD allocation should have "
54+ "failed. Please report this to your RSD Pod "
55+ "administrator." % (
56+ smallest_size / (1024 ** 3), local_drive_endpoint))
57
58 if 'local' not in discovered_machine_block_device.tags:
59 discovered_machine_block_device.tags.append('local')
60
61=== modified file 'src/provisioningserver/drivers/pod/tests/test_rsd.py'
62--- src/provisioningserver/drivers/pod/tests/test_rsd.py 2017-05-09 21:53:26 +0000
63+++ src/provisioningserver/drivers/pod/tests/test_rsd.py 2017-06-07 17:54:54 +0000
64@@ -1312,14 +1312,20 @@
65 headers = driver.make_auth_headers(**context)
66 request = make_requested_machine()
67 # Set the tags on the requested machine's block devices
68- # and the size.
69- for idx in range(3):
70- request.block_devices[idx].size = 200 * 1024 ** 3
71- request.block_devices[idx].tags = ['local', 'testing tags']
72+ # and the size. First device will be a device that has
73+ # its tags mapped, while the second one will be at a size
74+ # that is bigger than the available local disk size so its
75+ # tags will not be mapped.
76+ request.block_devices[0].size = 100 * 1024 ** 3
77+ request.block_devices[0].tags = ['local', 'tags mapped']
78+ request.block_devices[1].size = 200 * 1024 ** 3
79+ request.block_devices[1].tags = ['local', 'tags not mapped']
80+ local_drive = "/redfish/v1/Systems/1/Adapters/3/Devices/3"
81 node_data = SAMPLE_JSON_NODE
82 discovered_machine = make_discovered_machine(block_devices=[])
83 mock_redfish_request = self.patch(driver, 'redfish_request')
84 mock_redfish_request.return_value = (SAMPLE_JSON_DEVICE, None)
85+ self.patch_autospec(rsd_module.maaslog, 'warning')
86
87 yield driver.get_pod_machine_local_storages(
88 node_data, url, headers, discovered_machine, request)
89@@ -1330,7 +1336,7 @@
90 serial=Equals('CVLI310601PY120E'),
91 size=Equals(119999999999.99997),
92 block_size=Equals(512),
93- tags=Equals(['local', 'testing tags', 'ssd']),
94+ tags=Equals(['local', 'tags mapped', 'ssd']),
95 type=Equals(BlockDeviceType.PHYSICAL),
96 ),
97 MatchesStructure(
98@@ -1338,9 +1344,16 @@
99 serial=Equals('CVLI310601PY120E'),
100 size=Equals(119999999999.99997),
101 block_size=Equals(512),
102- tags=Equals(['local', 'testing tags', 'ssd']),
103+ tags=Equals(['local', 'ssd']),
104 type=Equals(BlockDeviceType.PHYSICAL),
105 )]))
106+ self.assertThat(rsd_module.maaslog.warning, MockCalledOnceWith(
107+ "Requested disk size is larger than %d GiB, which "
108+ "drive '%r' contains. RSD allocation should have "
109+ "failed. Please report this to your RSD Pod "
110+ "administrator." % (
111+ discovered_machine.block_devices[1].size / (1024 ** 3),
112+ local_drive)))
113
114 def test__get_pod_machine_remote_storages(self):
115 driver = RSDPodDriver()

Subscribers

People subscribed via source and target branches

to all changes: