コード例 #1
0
class ListOperatingSystems(amp.Command):
    """Report the cluster's supported operating systems.

    :since: 1.7
    """

    arguments = []
    response = [(
        b"osystems",
        AmpList([
            (b"name", amp.Unicode()),
            (b"title", amp.Unicode()),
            (
                b"releases",
                AmpList([
                    (b"name", amp.Unicode()),
                    (b"title", amp.Unicode()),
                    (b"requires_license_key", amp.Boolean()),
                    (b"can_commission", amp.Boolean()),
                ]),
            ),
            (b"default_release", amp.Unicode(optional=True)),
            (
                b"default_commissioning_release",
                amp.Unicode(optional=True),
            ),
        ]),
    )]
    errors = []
コード例 #2
0
class EvaluateTag(amp.Command):
    """Evaluate a tag against the list of nodes.

    :since: 2.0
    """

    arguments = [
        # System ID for rack controller.
        (b"system_id", amp.Unicode()),
        (b"tag_name", amp.Unicode()),
        (b"tag_definition", amp.Unicode()),
        (b"tag_nsmap",
         AmpList([
             (b"prefix", amp.Unicode()),
             (b"uri", amp.Unicode()),
         ])),
        # A 3-part credential string for the web API.
        (b"credentials", amp.Unicode()),
        # List of nodes the rack controller should evaluate.
        (b"nodes", AmpList([
            (b"system_id", amp.Unicode()),
        ])),
    ]
    response = []
    errors = []
コード例 #3
0
class ImportBootImages(amp.Command):
    """Import boot images and report the final
    boot images that exist on the cluster.

    :since: 1.7
    """

    arguments = [
        (
            b"sources",
            AmpList([
                (b"url", amp.Unicode()),
                (b"keyring_data", Bytes()),
                (
                    b"selections",
                    AmpList([
                        (b"os", amp.Unicode()),
                        (b"release", amp.Unicode()),
                        (b"arches", amp.ListOf(amp.Unicode())),
                        (b"subarches", amp.ListOf(amp.Unicode())),
                        (b"labels", amp.ListOf(amp.Unicode())),
                    ]),
                ),
            ]),
        ),
        (b"http_proxy", ParsedURL(optional=True)),
        (b"https_proxy", ParsedURL(optional=True)),
    ]
    response = []
    errors = []
コード例 #4
0
ファイル: region.py プロジェクト: casual-lemon/maas
class GetBootSources(amp.Command):
    """Report boot sources and selections for the given cluster.

    Includes the new os field for the selections.

    :since: 1.7
    """

    arguments = [
        # The cluster UUID.
        (b"uuid", amp.Unicode())
    ]
    response = [(
        b"sources",
        AmpList([
            (b"url", amp.Unicode()),
            (b"keyring_data", Bytes()),
            (
                b"selections",
                AmpList([
                    (b"os", amp.Unicode()),
                    (b"release", amp.Unicode()),
                    (b"arches", amp.ListOf(amp.Unicode())),
                    (b"subarches", amp.ListOf(amp.Unicode())),
                    (b"labels", amp.ListOf(amp.Unicode())),
                ]),
            ),
        ]),
    )]
    errors = []
コード例 #5
0
class ListNodePowerParameters(amp.Command):
    """Return power parameters for the nodes in the specified cluster.

    This will only return power parameters for nodes that have power types for
    which MAAS has a query capability.

    It will return nodes in priority order. Those nodes at the beginning of
    the list should be queried first.

    It may return an empty list. This means that all nodes have been recently
    queried. Take a break before asking again.

    :since: 1.7
    """

    arguments = [
        # The cluster UUID.
        (b"uuid", amp.Unicode()),
    ]
    response = [
        (b"nodes", AmpList(
            [(b"system_id", amp.Unicode()),
             (b"hostname", amp.Unicode()),
             (b"power_state", amp.Unicode()),
             (b"power_type", amp.Unicode()),
             # We can't define a tighter schema here because this is a highly
             # variable bag of arguments from a variety of sources.
             (b"context", StructureAsJSON())])),
    ]
    errors = {
        NoSuchCluster: b"NoSuchCluster",
    }
コード例 #6
0
ファイル: cluster.py プロジェクト: casual-lemon/maas
class SetBootOrder(_Power):
    """Remotely configure a BMC's boot order

    :since: 2.10
    """

    arguments = [
        (b"system_id", amp.Unicode()),
        (b"hostname", amp.Unicode()),
        (b"power_type", amp.Unicode()),
        # We can't define a tighter schema here because this is a highly
        # variable bag of arguments from a variety of sources.
        (b"context", StructureAsJSON()),
        (
            b"order",
            AmpList([
                (b"id", amp.Integer()),
                (b"name", amp.Unicode()),
                # Fields used with Interfaces
                (b"mac_address", amp.Unicode(optional=True)),
                (b"vendor", amp.Unicode(optional=True)),
                (b"product", amp.Unicode(optional=True)),
                # Fields used with Blockdevices
                (b"id_path", amp.Unicode(optional=True)),
                (b"model", amp.Unicode(optional=True)),
                (b"serial", amp.Unicode(optional=True)),
            ]),
        ),
    ]
コード例 #7
0
class CheckIPs(amp.Command):
    """Check IP addresses already in-use.

    :since: 2.7
    """
    arguments = [
        (b"ip_addresses", AmpList([
            (b"ip_address", amp.Unicode()),
            (b"interface", amp.Unicode(optional=True)),
        ])),
    ]
    response = [
        (b"ip_addresses", AmpList([
            (b"ip_address", amp.Unicode()),
            (b"interface", amp.Unicode(optional=True)),
            (b"used", amp.Boolean()),
            (b"mac_address", amp.Unicode(optional=True)),
        ])),
    ]
    errors = {}
コード例 #8
0
class ListSupportedArchitectures(amp.Command):
    """Report the cluster's supported architectures.

    :since: 1.5
    """

    arguments = []
    response = [(
        b"architectures",
        AmpList([(b"name", amp.Unicode()), (b"description", amp.Unicode())]),
    )]
    errors = []
コード例 #9
0
class _ConfigureDHCP_V2(amp.Command):
    """Configure a DHCP server.

    :since: 2.1
    """
    arguments = [
        (b"omapi_key", amp.Unicode()),
        (b"failover_peers", AmpList([
            (b"name", amp.Unicode()),
            (b"mode", amp.Unicode()),
            (b"address", amp.Unicode()),
            (b"peer_address", amp.Unicode()),
            ])),
        (b"shared_networks", CompressedAmpList([
            (b"name", amp.Unicode()),
            (b"subnets", AmpList([
                (b"subnet", amp.Unicode()),
                (b"subnet_mask", amp.Unicode()),
                (b"subnet_cidr", amp.Unicode()),
                (b"broadcast_ip", amp.Unicode()),
                (b"router_ip", amp.Unicode()),
                (b"dns_servers", amp.ListOf(IPAddress())),
                (b"ntp_servers", amp.ListOf(amp.Unicode())),
                (b"domain_name", amp.Unicode()),
                (b"search_list", amp.ListOf(amp.Unicode(), optional=True)),
                (b"pools", AmpList([
                    (b"ip_range_low", amp.Unicode()),
                    (b"ip_range_high", amp.Unicode()),
                    (b"failover_peer", amp.Unicode(optional=True)),
                    ])),
                (b"dhcp_snippets", AmpList([
                    (b"name", amp.Unicode()),
                    (b"description", amp.Unicode(optional=True)),
                    (b"value", amp.Unicode()),
                    ], optional=True)),
                ])),
            (b"mtu", amp.Integer(optional=True)),
            (b"interface", amp.Unicode(optional=True)),
        ])),
        (b"hosts", CompressedAmpList([
            (b"host", amp.Unicode()),
            (b"mac", amp.Unicode()),
            (b"ip", amp.Unicode()),
            (b"dhcp_snippets", AmpList([
                (b"name", amp.Unicode()),
                (b"description", amp.Unicode(optional=True)),
                (b"value", amp.Unicode()),
                ], optional=True)),
            ])),
        (b"interfaces", AmpList([
            (b"name", amp.Unicode()),
            ])),
        (b"global_dhcp_snippets", CompressedAmpList([
            (b"name", amp.Unicode()),
            (b"description", amp.Unicode(optional=True)),
            (b"value", amp.Unicode()),
            ], optional=True)),
        ]
    response = []
    errors = {exceptions.CannotConfigureDHCP: b"CannotConfigureDHCP"}
コード例 #10
0
class ReportBootImages(amp.Command):
    """Report boot images available on the invoking cluster controller.

    :since: 1.5
    """

    arguments = [
        # The cluster UUID.
        (b"uuid", amp.Unicode()),
        (b"images",
         AmpList([(b"architecture", amp.Unicode()),
                  (b"subarchitecture", amp.Unicode()),
                  (b"release", amp.Unicode()), (b"purpose", amp.Unicode())])),
    ]
    response = []
    errors = []
コード例 #11
0
class UpdateServices(amp.Command):
    """Report service statuses that are monitored on the rackd.

    :since: 2.0
    """

    arguments = [
        (b"system_id", amp.Unicode()),
        (b"services",
         AmpList([(b"name", amp.Unicode()), (b"status", amp.Unicode()),
                  (b"status_info", amp.Unicode())])),
    ]
    response = []
    errors = {
        NoSuchCluster: b"NoSuchCluster",
    }
コード例 #12
0
class ListBootImages(amp.Command):
    """List the boot images available on this rack controller.

    :since: 1.5
    """

    arguments = []
    response = [(b"images",
                 AmpList([(b"osystem", amp.Unicode()),
                          (b"architecture", amp.Unicode()),
                          (b"subarchitecture", amp.Unicode()),
                          (b"release", amp.Unicode()),
                          (b"label", amp.Unicode()),
                          (b"purpose", amp.Unicode()),
                          (b"xinstall_type", amp.Unicode()),
                          (b"xinstall_path", amp.Unicode())]))]
    errors = []
コード例 #13
0
class _ConfigureDHCP(amp.Command):
    """Configure a DHCP server.

    :since: 2.0
    """
    arguments = [
        (b"omapi_key", amp.Unicode()),
        (b"failover_peers",
         AmpList([
             (b"name", amp.Unicode()),
             (b"mode", amp.Unicode()),
             (b"address", amp.Unicode()),
             (b"peer_address", amp.Unicode()),
         ])),
        (
            b"shared_networks",
            CompressedAmpList([
                (b"name", amp.Unicode()),
                (
                    b"subnets",
                    AmpList([
                        (b"subnet", amp.Unicode()),
                        (b"subnet_mask", amp.Unicode()),
                        (b"subnet_cidr", amp.Unicode()),
                        (b"broadcast_ip", amp.Unicode()),
                        (b"router_ip", amp.Unicode()),
                        # dns_servers is a space- or comma-separated list (it's not
                        # clear which) of IP addresses. In _ConfigureDHCP_V2 is it a
                        # list proper.
                        (b"dns_servers", amp.Unicode()),
                        # ntp_server (note: singular) is a space- or comma-separated
                        # list (it's not clear which) of IP addresses and/or
                        # hostnames. In _ConfigureDHCP_V2 is it a list proper.
                        (b"ntp_server", amp.Unicode()),
                        (b"domain_name", amp.Unicode()),
                        (b"pools",
                         AmpList([
                             (b"ip_range_low", amp.Unicode()),
                             (b"ip_range_high", amp.Unicode()),
                             (b"failover_peer", amp.Unicode(optional=True)),
                         ])),
                        (b"dhcp_snippets",
                         AmpList([
                             (b"name", amp.Unicode()),
                             (b"description", amp.Unicode(optional=True)),
                             (b"value", amp.Unicode()),
                         ],
                                 optional=True)),
                    ])),
            ])),
        (b"hosts",
         CompressedAmpList([
             (b"host", amp.Unicode()),
             (b"mac", amp.Unicode()),
             (b"ip", amp.Unicode()),
             (b"dhcp_snippets",
              AmpList([
                  (b"name", amp.Unicode()),
                  (b"description", amp.Unicode(optional=True)),
                  (b"value", amp.Unicode()),
              ],
                      optional=True)),
         ])),
        (b"interfaces", AmpList([
            (b"name", amp.Unicode()),
        ])),
        (b"global_dhcp_snippets",
         CompressedAmpList([
             (b"name", amp.Unicode()),
             (b"description", amp.Unicode(optional=True)),
             (b"value", amp.Unicode()),
         ],
                           optional=True)),
    ]
    response = []
    errors = {exceptions.CannotConfigureDHCP: b"CannotConfigureDHCP"}