~rvb/maas/bug-1234853-1.3

« back to all changes in this revision

Viewing changes to src/maasserver/api.py

Merge 1.2 into trunk, resolve conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
748
748
        The minimum data required is:
749
749
        architecture=<arch string> (e.g "i386/generic")
750
750
        mac_address=<value>
 
751
 
 
752
        :param architecture: A string containing the architecture type of
 
753
            the node.
 
754
        :param mac_address: The MAC address of the node.
 
755
        :param hostname: A hostname. If not given, one will be generated.
 
756
        :param powertype: A power management type, if applicable (e.g.
 
757
            "virsh", "ipmi").
751
758
        """
752
759
        node = create_node(request)
753
760
        if request.user.is_superuser:
1527
1534
        'name',
1528
1535
        'definition',
1529
1536
        'comment',
 
1537
        'kernel_opts',
1530
1538
        )
1531
1539
 
1532
1540
    def read(self, request, name):
1658
1666
            It is meant as a human readable description of the tag.
1659
1667
        :param definition: An XPATH query that will be evaluated against the
1660
1668
            hardware_details stored for all nodes (output of `lshw -xml`).
 
1669
        :param kernel_opts: Can be None. If set, nodes associated with this tag
 
1670
            will add this string to their kernel options when booting. The
 
1671
            value overrides the global 'kernel_opts' setting. If more than one
 
1672
            tag is associated with a node, the one with the lowest alphabetical
 
1673
            name will be picked (eg 01-my-tag will be taken over 99-tag-name).
1661
1674
        """
1662
1675
        if not request.user.is_superuser:
1663
1676
            raise PermissionDenied()
1892
1905
    else:
1893
1906
        series = node.get_distro_series()
1894
1907
 
 
1908
    if node is not None:
 
1909
        # We don't care if the kernel opts is from the global setting or a tag,
 
1910
        # just get the options
 
1911
        _, extra_kernel_opts = node.get_effective_kernel_options()
 
1912
    else:
 
1913
        extra_kernel_opts = None
 
1914
 
1895
1915
    purpose = get_boot_purpose(node)
1896
1916
    server_address = get_maas_facing_server_address()
1897
1917
    cluster_address = get_mandatory_param(request.GET, "local")
1899
1919
    params = KernelParameters(
1900
1920
        arch=arch, subarch=subarch, release=series, purpose=purpose,
1901
1921
        hostname=hostname, domain=domain, preseed_url=preseed_url,
1902
 
        log_host=server_address, fs_host=cluster_address)
 
1922
        log_host=server_address, fs_host=cluster_address,
 
1923
        extra_opts=extra_kernel_opts)
1903
1924
 
1904
1925
    return HttpResponse(
1905
1926
        json.dumps(params._asdict()),