Merge lp:~rvb/maas/netboot-allocated-fix-mig-10-1.2 into lp:maas/1.2

Proposed by Raphaël Badin
Status: Merged
Approved by: Raphaël Badin
Approved revision: no longer in the source branch.
Merged at revision: 1384
Proposed branch: lp:~rvb/maas/netboot-allocated-fix-mig-10-1.2
Merge into: lp:maas/1.2
Diff against target: 28 lines (+9/-1)
1 file modified
src/maasserver/migrations/0010_add_node_netboot.py (+9/-1)
To merge this branch: bzr merge lp:~rvb/maas/netboot-allocated-fix-mig-10-1.2
Reviewer Review Type Date Requested Status
Julian Edwards (community) Approve
Review via email: mp+186378@code.launchpad.net

Commit message

Backport revision 1624. Set netboot=False on the allocated nodes with netboot=True. in migration #10.

To post a comment you must log in.
Revision history for this message
Julian Edwards (julian-edwards) wrote :

Feel free to self-approve straight backports.

review: Approve
Revision history for this message
Raphaël Badin (rvb) wrote :

> Feel free to self-approve straight backports.

ditto

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/migrations/0010_add_node_netboot.py'
2--- src/maasserver/migrations/0010_add_node_netboot.py 2012-06-18 03:20:51 +0000
3+++ src/maasserver/migrations/0010_add_node_netboot.py 2013-09-18 15:54:38 +0000
4@@ -4,9 +4,12 @@
5
6 # encoding: utf-8
7 import datetime
8+
9+from django.db import models
10+from maasserver.enum import NODE_STATUS
11 from south.db import db
12 from south.v2 import SchemaMigration
13-from django.db import models
14+
15
16 class Migration(SchemaMigration):
17
18@@ -15,6 +18,11 @@
19 # Adding field 'Node.netboot'
20 db.add_column(u'maasserver_node', 'netboot', self.gf('django.db.models.fields.BooleanField')(default=True), keep_default=False)
21
22+ # Find all the allocated nodes with netboot=True.
23+ allocated_nodes = orm['maasserver.node'].objects.filter(
24+ status=NODE_STATUS.ALLOCATED, netboot=True)
25+ # Set netboot=False on these nodes.
26+ allocated_nodes.update(netboot=False)
27
28 def backwards(self, orm):
29

Subscribers

People subscribed via source and target branches

to status/vote changes: