~ubuntu-branches/ubuntu/utopic/maas/utopic-security

« back to all changes in this revision

Viewing changes to src/provisioningserver/boot/__init__.py

  • Committer: Package Import Robot
  • Author(s): Julian Edwards, Julian Edwards, Andres Rodriguez
  • Date: 2014-08-21 18:38:27 UTC
  • mfrom: (1.2.34)
  • Revision ID: package-import@ubuntu.com-20140821183827-9xyb5u2o4l8g3zxj
Tags: 1.6.1+bzr2550-0ubuntu1
* New upstream bugfix release:
  - Auto-link node MACs to Networks (LP: #1341619)

[ Julian Edwards ]
* debian/maas-region-controller.postinst: Don't restart RabbitMQ on
  upgrades, just ensure it's running.  Should prevent a race with the
  cluster celery restarting.
* debian/rules: Pull upstream branch from the right place.

[ Andres Rodriguez ]
* debian/maas-region-controller.postinst: Ensure cluster celery is
  started if it also runs on the region.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
from provisioningserver.boot.tftppath import compose_image_path
30
30
from provisioningserver.kernel_opts import compose_kernel_command_line
31
31
from provisioningserver.utils import locate_config
 
32
from provisioningserver.utils.network import find_mac_via_arp
32
33
from provisioningserver.utils.registry import Registry
33
34
import tempita
34
35
from tftp.backend import IReader
 
36
from twisted.python.context import get
35
37
from zope.interface import implementer
36
38
 
37
39
 
94
96
    yield "config.template"
95
97
 
96
98
 
 
99
def get_remote_mac():
 
100
    """Gets the requestors MAC address from arp cache.
 
101
 
 
102
    This is used, when the dhcp lease file is not up-to-date soon enough
 
103
    to extract the MAC address from the IP address assigned by dhcp.
 
104
    """
 
105
    remote_host, remote_port = get("remote", (None, None))
 
106
    return find_mac_via_arp(remote_host)
 
107
 
 
108
 
97
109
class BootMethod:
98
110
    """Skeleton for a boot method."""
99
111
 
100
112
    __metaclass__ = ABCMeta
101
113
 
 
114
    # Path prefix that is used for the pxelinux.cfg. Used for
 
115
    # the dhcpd.conf that is generated.
 
116
    path_prefix = None
 
117
 
102
118
    @abstractproperty
103
119
    def name(self):
104
120
        """Name of the boot method."""
188
204
        """
189
205
        def image_dir(params):
190
206
            return compose_image_path(
191
 
                params.arch, params.subarch,
 
207
                params.osystem, params.arch, params.subarch,
192
208
                params.release, params.label)
193
209
 
194
210
        def initrd_path(params):
223
239
from provisioningserver.boot.pxe import PXEBootMethod
224
240
from provisioningserver.boot.uefi import UEFIBootMethod
225
241
from provisioningserver.boot.powerkvm import PowerKVMBootMethod
 
242
from provisioningserver.boot.powernv import PowerNVBootMethod
 
243
from provisioningserver.boot.windows import WindowsPXEBootMethod
226
244
 
227
245
 
228
246
builtin_boot_methods = [
229
247
    PXEBootMethod(),
230
248
    UEFIBootMethod(),
231
249
    PowerKVMBootMethod(),
 
250
    PowerNVBootMethod(),
 
251
    WindowsPXEBootMethod(),
232
252
]
233
253
for method in builtin_boot_methods:
234
254
    BootMethodRegistry.register_item(method.name, method)