diff --git a/Makefile b/Makefile index e6bbd42b06e..4999ee56399 100644 --- a/Makefile +++ b/Makefile @@ -212,7 +212,7 @@ whitespace: @infra/scripts/whitespace-check.sh # exit 1 if golint complains about anything other than comments -golintf = $(GOLINT) $(1) | sh -c "! grep -v 'lib/apiservers/portlayer/restapi/operations'" | sh -c "! grep -v 'lib/config/dynamic/admiral/client'" | sh -c "! grep -v 'should have comment'" | sh -c "! grep -v 'comment on exported'" | sh -c "! grep -v 'by other packages, and that stutters'" | sh -c "! grep -v 'error strings should not be capitalized'" +golintf = $(GOLINT) $(1) | sh -c "! grep -v 'lib/apiservers/portlayer/restapi/operations'" | sh -c "! grep -v 'lib/apiservers/service/restapi/operations/not_yet_implemented'" | sh -c "! grep -v 'lib/config/dynamic/admiral/client'" | sh -c "! grep -v 'should have comment'" | sh -c "! grep -v 'comment on exported'" | sh -c "! grep -v 'by other packages, and that stutters'" | sh -c "! grep -v 'error strings should not be capitalized'" golint: $(GOLINT) @echo checking go lint... diff --git a/cmd/vic-machine/common/target.go b/cmd/vic-machine/common/target.go index e96e5e5fe55..c4cbf5c7173 100644 --- a/cmd/vic-machine/common/target.go +++ b/cmd/vic-machine/common/target.go @@ -33,6 +33,8 @@ type Target struct { Password *string CloneTicket string Thumbprint string `cmd:"thumbprint"` + + MaxConcurrentConnections *int `cmd:"max-concurrent-connections"` } func NewTarget() *Target { @@ -67,11 +69,20 @@ func (t *Target) TargetFlags() []cli.Flag { Usage: "ESX or vCenter host certificate thumbprint", EnvVar: "VIC_MACHINE_THUMBPRINT", }, + cli.GenericFlag{ + Name: "max-concurrent-connections, mcc", + Value: flags.NewOptionalInt(&t.MaxConcurrentConnections), + Usage: "Determines maximum number of connections (not sessions) to vCenter. Integer value, greater than 0", + EnvVar: "VIC_MACHINE_MAX_CONCURRENT_CONNECTIONS", + Hidden: true, + }, } } // HasCredentials check that the credentials have been supplied by any of the permitted mechanisms func (t *Target) HasCredentials(op trace.Operation) error { + defer trace.End(trace.Begin("", op)) + if t.URL == nil { return cli.NewExitError("--target argument must be specified", 1) } diff --git a/cmd/vic-machine/common/target_test.go b/cmd/vic-machine/common/target_test.go index 58f83b6338d..e4fe99b462b 100644 --- a/cmd/vic-machine/common/target_test.go +++ b/cmd/vic-machine/common/target_test.go @@ -29,7 +29,7 @@ func TestFlags(t *testing.T) { target := NewTarget() flags := target.TargetFlags() - if len(flags) != 4 { + if len(flags) != 5 { t.Errorf("Wrong flag numbers") } } @@ -50,6 +50,10 @@ func TestProcess(t *testing.T) { User string Password *string + // MaxConcurrentConnections is not tested here as there's no explicit validation at this stage + // Validation of input type is via flags package, and validation of values is via validator + /// mcc *int + err error result *url.URL }{ diff --git a/cmd/vic-machine/configure/configure.go b/cmd/vic-machine/configure/configure.go index 23f55ada2cb..18b73bc07a9 100644 --- a/cmd/vic-machine/configure/configure.go +++ b/cmd/vic-machine/configure/configure.go @@ -19,6 +19,7 @@ import ( "fmt" "net" "os" + "strconv" "strings" "time" @@ -214,6 +215,11 @@ func (c *Configure) copyChangedConf(o *config.VirtualContainerHostConfigSpec, n updateSessionEnv(portlayerSession, config.PortLayerDCPath, v.Session().Datacenter.Name()) } + // if mcc is explicitly set, apply it + if c.Data.MaxConcurrentConnections != nil { + updateSessionEnv(portlayerSession, config.PortLayerMaxConcurrentConnections, strconv.Itoa(*c.Data.MaxConcurrentConnections)) + } + if c.Debug.Debug != nil { o.SetDebug(n.Diagnostics.DebugLevel) } diff --git a/cmd/vic-machine/create/create.go b/cmd/vic-machine/create/create.go index 03915f49689..df9e986fa70 100644 --- a/cmd/vic-machine/create/create.go +++ b/cmd/vic-machine/create/create.go @@ -719,6 +719,8 @@ func (c *Create) Run(clic *cli.Context) (err error) { vConfig.Timeout = c.Data.Timeout + vConfig.MaxConcurrentConnections = c.MaxConcurrentConnections + // separate initial validation from dispatch of creation task op.Info("") diff --git a/cmd/vic-machine/create/create_test.go b/cmd/vic-machine/create/create_test.go index e257db88ad5..91c93b454a9 100644 --- a/cmd/vic-machine/create/create_test.go +++ b/cmd/vic-machine/create/create_test.go @@ -72,7 +72,7 @@ func TestParseGatewaySpec(t *testing.T) { func TestFlags(t *testing.T) { c := NewCreate() flags := c.Flags() - numberOfFlags := 65 + numberOfFlags := 66 assert.Equal(t, numberOfFlags, len(flags), "Missing flags during Create.") } diff --git a/infra/scripts/bash-helpers.sh b/infra/scripts/bash-helpers.sh index c3f86fdf6df..25c629b203d 100644 --- a/infra/scripts/bash-helpers.sh +++ b/infra/scripts/bash-helpers.sh @@ -30,7 +30,7 @@ fi # 1: release numnber, e.g. 1.4.1 or 1.4.1-rc2, or build id, e.g. 19653 vic-set-version () { version="$1" - + if [ "$1" == "" ]; then unset VIC_VERSION return @@ -63,7 +63,7 @@ init-profile () { unset-vic () { unset TARGET_URL MAPPED_NETWORKS NETWORKS IMAGE_STORE DATASTORE COMPUTE VOLUME_STORES IPADDR TLS THUMBPRINT OPS_CREDS VIC_NAME PRESERVE_VOLUMES - unset GOVC_URL GOVC_INSECURE GOVC_DATACENTER GOVC_USERNAME GOVC_PASSWORD GOVC_DATASTORE GOVC_CERTIFICATE + unset GOVC_URL GOVC_INSECURE GOVC_DATACENTER GOVC_USERNAME GOVC_PASSWORD GOVC_DATASTORE GOVC_CERTIFICATE unset vsphere datacenter user password opsuser opspass opsgrant timeout compute datastore dns publicNet publicIP publicGW bridgeNet bridgeRange unset clientNet clientIP clientGW managementNet managementIP managementGW tls volumestores preserveVolumestores containernet @@ -79,7 +79,7 @@ vic-create () { base=$(pwd) ( cd "$(vic-path)"/bin || return - "$(vic-path)/bin/${VIC_VERSION}/vic-machine-$OS" create --target="$TARGET_URL" "${OPS_CREDS[@]}" --image-store="$IMAGE_STORE" --compute-resource="$COMPUTE" "${TLS[@]}" ${TLS_OPTS} --name="${VIC_NAME:-${USER}test}" "${MAPPED_NETWORKS[@]}" "${VOLUME_STORES[@]}" "${NETWORKS[@]}" ${IPADDR} ${TIMEOUT} --thumbprint="$THUMBPRINT" --ai="${VIC_VERSION}/appliance.iso" --bi="${VIC_VERSION}/bootstrap.iso" "$@" + "$(vic-path)/bin/${VIC_VERSION}/vic-machine-$OS" create --target="$TARGET_URL" "${OPS_CREDS[@]}" --image-store="$IMAGE_STORE" --compute-resource="$COMPUTE" "${TLS[@]}" ${TLS_OPTS} --name="${VIC_NAME:-${USER}test}" "${MAPPED_NETWORKS[@]}" "${VOLUME_STORES[@]}" "${NETWORKS[@]}" ${IPADDR} --timeout=${TIMEOUT} --thumbprint="$THUMBPRINT" --ai="${VIC_VERSION}/appliance.iso" --bi="${VIC_VERSION}/bootstrap.iso" "$@" ) vic-select diff --git a/infra/scripts/focused-test.sh b/infra/scripts/focused-test.sh index 8b06879e783..de80e23fcb3 100755 --- a/infra/scripts/focused-test.sh +++ b/infra/scripts/focused-test.sh @@ -20,7 +20,7 @@ # if [ -z "$1" ]; then - export REMOTE=$(git remote -v | grep "github.com.vmware/vic.git (fetch)" | awk '{print$1;exit}')/master + export REMOTE=$(git remote -v | grep "github.com.vmware/vic\(\.git\)* (fetch)" | awk '{print$1;exit}')/master echo "Using ${REMOTE} as default remote" else echo "Using ${REMOTE} as specified remote" diff --git a/lib/config/executor/container_vm.go b/lib/config/executor/container_vm.go index b616e08e66c..b9ed6ec6c52 100644 --- a/lib/config/executor/container_vm.go +++ b/lib/config/executor/container_vm.go @@ -119,7 +119,8 @@ type ExitLog struct { // MountSpec details a mount that must be executed within the executor // A mount is a URI -> path mapping with a credential of some kind // In the case of a labeled disk: -// label://