From a2c8ed318486ac3a3a2d590c11845f345c29c748 Mon Sep 17 00:00:00 2001 From: Tim Penhey Date: Fri, 8 Apr 2016 12:03:36 +1200 Subject: [PATCH 1/6] Rework allocate with new storage and interfaces constraints. --- controller.go | 121 +++++++++++++++++++++++++++++++++++++-------- controller_test.go | 29 +++++++---- errors.go | 9 +++- interfaces.go | 5 +- machine.go | 10 ++++ machine_test.go | 3 ++ 6 files changed, 146 insertions(+), 31 deletions(-) diff --git a/controller.go b/controller.go index f2d246d..7c6adcf 100644 --- a/controller.go +++ b/controller.go @@ -286,26 +286,56 @@ type AllocateMachineArgs struct { MinMemory int Tags []string NotTags []string - // Networks - list of networks (defined in MAAS) to which the machine must be - // attached. A network can be identified by the name assigned to it in MAAS; - // or by an ip: prefix followed by any IP address that falls within the - // network; or a vlan: prefix followed by a numeric VLAN tag, e.g. vlan:23 - // for VLAN number 23. Valid VLAN tags must be in the range of 1 to 4094 - // inclusive. - Networks []string - NotNetworks []string - Zone string - NotInZone []string - AgentName string - Comment string - DryRun bool + Zone string + NotInZone []string + // Storage is an optional value listing one or more storage constraints. + // Format is an optional label, followed by an optional colon, then size + // (which is mandatory) followed by an optional comma seperated list of tags + // in parentheses. + // + // Examples: + // + // 200(ssd,removable),400(ssd),300 + // - 200GB disk with ssd and removable tag + // - 400GB disk with ssd tag + // - 300GB disk + // + // root:80(ssd),data:400 + // - 80+GB disk with ssd tag, name the constraint "root" + // - 400+GB disk, name the consrtaint "data" + Storage string + // Interfaces is an optional value listing one or more interface constraints. + // Format of the string is semi-colon delimited labelled constraints. Each + // labelled constraint has the format: + //