Renamed Instance* to Server*

The naming of the classes which were working with servers was
inconsistent: at some places they were referenced as "instances", at
some others as "servers". This is inconsistent, also the word
'instance' is too generic.

So a refactoring was made: InstanceGroup and InstanceProvider were
renamed to ServerGroup and ServerProvider. Some other properties and
variable names were renamed accordingly.

Change-Id: I4ce2d09ae890aec4eb61d9719932c65457fb6dba
This commit is contained in:
Alexander Tivelkov
2016-08-17 13:02:52 +03:00
committed by Stan Lagun
parent 1995f044d6
commit f30906848a
5 changed files with 66 additions and 66 deletions

View File

@@ -30,7 +30,7 @@ Methods:
deployAt:
Arguments:
- servers:
Contract: $.class(InstanceGroup).notNull()
Contract: $.class(ServerGroup).notNull()
Body:
- $servers.deploy()
@@ -87,7 +87,7 @@ Methods:
install:
Arguments:
- servers:
Contract: $.class(InstanceGroup).notNull()
Contract: $.class(ServerGroup).notNull()
Body:
- $serversToInstall: $servers.items.where($this.checkServerNeedsInstallation($))
- If: any($serversToInstall)
@@ -106,7 +106,7 @@ Methods:
beforeInstall:
Arguments:
- servers:
Contract: $.class(InstanceGroup).notNull()
Contract: $.class(ServerGroup).notNull()
Body:
- $this.report(format('Installing {0}', $this.componentName))
- $this.onBeforeInstall($servers)
@@ -114,7 +114,7 @@ Methods:
onBeforeInstall:
Arguments:
- servers:
Contract: $.class(InstanceGroup).notNull()
Contract: $.class(ServerGroup).notNull()
Body:
- $this.beforeInstallEvent.notify($this, $servers)
@@ -158,7 +158,7 @@ Methods:
completeInstallation:
Arguments:
- servers:
Contract: $.class(InstanceGroup).notNull()
Contract: $.class(ServerGroup).notNull()
- numFailures:
Contract: $.int()
Body:
@@ -177,14 +177,14 @@ Methods:
onCompleteInstallation:
Arguments:
- servers:
Contract: $.class(InstanceGroup).notNull()
Contract: $.class(ServerGroup).notNull()
Body:
- $this.completeInstallationEvent.notify($this, $servers)
deployAt:
Arguments:
- servers:
Contract: $.class(InstanceGroup).notNull()
Contract: $.class(ServerGroup).notNull()
Body:
- super($this, $.deployAt($servers))
- $this.install($servers)
@@ -221,7 +221,7 @@ Methods:
configure:
Arguments:
- servers:
Contract: $.class(InstanceGroup).notNull()
Contract: $.class(ServerGroup).notNull()
Body:
- If: not $this.checkClusterNeedsReconfiguration($servers)
Then:
@@ -234,7 +234,7 @@ Methods:
checkClusterNeedsReconfiguration:
Arguments:
- servers:
Contract: $.class(InstanceGroup).notNull()
Contract: $.class(ServerGroup).notNull()
Body:
- $key: $this.getKey()
- $state: $this.getAttr(format('configuration_of_cluster_{0}', id($servers)), null)
@@ -258,7 +258,7 @@ Methods:
preConfigure:
Arguments:
- servers:
Contract: $.class(InstanceGroup).notNull()
Contract: $.class(ServerGroup).notNull()
Body:
- $this.report(format('Applying configuration of {0}', $this.componentName))
- $this.onPreConfigure($servers)
@@ -266,7 +266,7 @@ Methods:
onPreConfigure:
Arguments:
- servers:
Contract: $.class(InstanceGroup).notNull()
Contract: $.class(ServerGroup).notNull()
Body:
- $sr: $this.getSecurityRules()
- If: $sr
@@ -315,7 +315,7 @@ Methods:
completeConfiguration:
Arguments:
- servers:
Contract: $.class(InstanceGroup).notNull()
Contract: $.class(ServerGroup).notNull()
- numFailures:
Contract: $.int()
Body:
@@ -336,7 +336,7 @@ Methods:
onCompleteConfiguration:
Arguments:
- servers:
Contract: $.class(InstanceGroup).notNull()
Contract: $.class(ServerGroup).notNull()
Body:
- $this.completeConfigurationEvent.notify($this, $servers)
@@ -348,7 +348,7 @@ Methods:
deployAt:
Arguments:
- servers:
Contract: $.class(InstanceGroup).notNull()
Contract: $.class(ServerGroup).notNull()
Body:
- super($this, $.deployAt($servers))
- $this.configure($servers)
@@ -365,7 +365,7 @@ Methods:
deployAt:
Arguments:
- servers:
Contract: $.class(InstanceGroup).notNull()
Contract: $.class(ServerGroup).notNull()
Body:
- cast($this, Installable).deployAt($servers)
- cast($this, Configurable).deployAt($servers)

View File

@@ -17,11 +17,11 @@ Namespaces:
std: io.murano
--- # ------------------------------------------------------------------ # ---
# A replication group aggregating Instances
# Adds a logic to concurrently provision and unprovision instances
# A replication group aggregating Servers
# Adds a logic to concurrently provision and unprovision servers
Name: InstanceGroup
Name: ServerGroup
Extends:
- ReplicationGroup
@@ -54,18 +54,18 @@ Methods:
- cast($this, ReplicationGroup).deploy()
- $this.items.select($this._deployInstance($))
- $this.items.select($this._deployServer($))
- $this.items.select($.endDeploy())
_deployInstance:
_deployServer:
Arguments:
- instance:
- server:
Contract: $.class(res:Instance)
Body:
- If: $this._env and name($instance) and not $instance.openstackId
- If: $this._env and name($server) and not $server.openstackId
Then:
- $this._env.reporter.report($this, 'Provisioning VM for ' + $instance.name)
- $instance.beginDeploy()
- $this._env.reporter.report($this, 'Provisioning VM for ' + $server.name)
- $server.beginDeploy()
.destroy:
Body:
@@ -73,16 +73,16 @@ Methods:
- $this.items.select($.endReleaseResources())
--- # ------------------------------------------------------------------ # ---
# A replication provider acting as a default factory class for Instances
# A replication provider acting as a default factory class for Servers
Name: InstanceProvider
Name: ServerProvider
Extends: CloneReplicaProvider
Properties:
source:
Contract: $.class(res:Instance).notNull()
instanceNamePattern:
serverNamePattern:
Contract: $.string().notNull()
@@ -94,11 +94,11 @@ Methods:
- index:
Contract: $.int().notNull()
Body:
- $template[name]: $this.instanceNamePattern.format($index)
- $ownerGroup: $this.find(InstanceGroup)
- $template[name]: $this.serverNamePattern.format($index)
- $ownerGroup: $this.find(ServerGroup)
- If: $ownerGroup
Then:
- $template['?'][name]: format('Group {0} instance {1}', name($ownerGroup), $index)
- $template['?'][name]: format('Group {0} server {1}', name($ownerGroup), $index)
- Return: $template
releaseReplica:

View File

@@ -6,7 +6,7 @@ Namespaces:
res: io.murano.resources
--- # ------------------------------------------------------------------ # ---
Name: TestMockedInstanceFactory
Name: TestMockedServerFactory
Extends: tst:TestFixtureWithEnvironment
Properties:
@@ -19,7 +19,7 @@ Properties:
Methods:
report:
Arguments:
- instance:
- server:
Contract: $
- message:
Contract: $.string()
@@ -82,62 +82,62 @@ Methods:
- $this.pushCalled: 0
- $instanceTemplate: new(res:LinuxMuranoInstance, $this.environment,
- $serverTemplate: new(res:LinuxMuranoInstance, $this.environment,
name=>'whatever',
image=>'murano-latest',
flavor=>'t1.medium')
- $this.provider: new(apps:InstanceProvider, source=>$instanceTemplate,
instanceNamePattern=>'testNode-{0}')
- $this.provider: new(apps:ServerProvider, source=>$serverTemplate,
serverNamePattern=>'testNode-{0}')
testCreateSingleServer:
Body:
- $ssg: new(apps:InstanceGroup, provider=>$this.provider)
- $ssg: new(apps:ServerGroup, provider=>$this.provider)
- $ssg.deploy()
- $this.assertInstanceCount(1)
- $this.assertServerCount(1)
testInstancesHaveProperName:
testServersHaveProperName:
Body:
- $model:
apps:InstanceGroup:
apps:ServerGroup:
numItems: 2
provider:
apps:InstanceProvider:
apps:ServerProvider:
source: $this.provider.source
instanceNamePattern: 'testNode-{0}'
serverNamePattern: 'testNode-{0}'
name: testGroup
- $namedSsg: new($model)
- $namedSsg.deploy()
- $this.assertEqual('Group testGroup instance 1', name($namedSsg.items[0]))
- $this.assertEqual('Group testGroup instance 2', name($namedSsg.items[1]))
- $this.assertEqual('Group testGroup server 1', name($namedSsg.items[0]))
- $this.assertEqual('Group testGroup server 2', name($namedSsg.items[1]))
testCreateMultipleServers:
Body:
- $ssg: new(apps:InstanceGroup, provider=>$this.provider, numItems=>5)
- $ssg: new(apps:ServerGroup, provider=>$this.provider, numItems=>5)
- $ssg.deploy()
- $this.assertInstanceCount(5)
- $this.assertServerCount(5)
testCreateScaleUp:
Body:
- $ssg: new(apps:InstanceGroup, provider=>$this.provider, numItems=>3)
- $ssg: new(apps:ServerGroup, provider=>$this.provider, numItems=>3)
- $ssg.deploy()
- $this.assertInstanceCount(3)
- $this.assertServerCount(3)
- $ssg.scale(4)
- $ssg.deploy()
- $this.assertInstanceCount(7)
- $this.assertServerCount(7)
testCreateScaleDown:
Body:
- $ssg: new(apps:InstanceGroup, provider=>$this.provider, numItems=>3)
- $ssg: new(apps:ServerGroup, provider=>$this.provider, numItems=>3)
- $ssg.deploy()
- $this.assertInstanceCount(3)
- $this.assertServerCount(3)
- $ssg.scale(-2)
- $ssg.deploy()
- $this.assertInstanceCount(1)
- $this.assertServerCount(1)
testMultipleServersReporting:
Body:
- $ssg: new(apps:InstanceGroup, $this.environment, TestGroup, provider=>$this.provider, numItems=>3)
- $ssg: new(apps:ServerGroup, $this.environment, TestGroup, provider=>$this.provider, numItems=>3)
- $ssg.deploy()
- $this.assertEqual('Creating 3 servers for TestGroup', $this.reports[0])
- $ssg.scale(-2)
@@ -145,7 +145,7 @@ Methods:
testMultipleServersReportingNoGroupName:
Body:
- $ssg: new(apps:InstanceGroup, $this.environment, null, provider=>$this.provider, numItems=>3)
- $ssg: new(apps:ServerGroup, $this.environment, null, provider=>$this.provider, numItems=>3)
- $ssg.deploy()
- $this.assertEqual('Creating 3 servers', $this.reports[0])
- $ssg.scale(-2)
@@ -153,12 +153,12 @@ Methods:
testNoReportingIfSingleServer:
Body:
- $ssg: new(apps:InstanceGroup, $this.environment, TestGroup, provider=>$this.provider, numItems=>1)
- $ssg: new(apps:ServerGroup, $this.environment, TestGroup, provider=>$this.provider, numItems=>1)
- $ssg.deploy()
- $this.assertEqual([], $this.reports)
assertInstanceCount:
assertServerCount:
Arguments:
- count:
Contract: $.int()

View File

@@ -36,7 +36,7 @@ Properties:
Methods:
report:
Arguments:
- instance:
- server:
Contract: $
- message:
Contract: $.string()
@@ -48,13 +48,13 @@ Methods:
- super($this, $.setUp())
- inject(res:LinuxMuranoInstance, beginDeploy, '')
- inject(res:LinuxMuranoInstance, endDeploy, '')
- $instance: new(res:LinuxMuranoInstance, $this.environment,
name=>'noop',
image=>'noop',
flavor=>'noop')
- $provider: new(apps:InstanceProvider, $this.environment,
source=>$instance, instanceNamePattern=>'testNode-{0}')
- $this.group: new(apps:InstanceGroup, provider=>$provider, numItems=>5)
- $server: new(res:LinuxMuranoInstance, $this.environment,
name=>'noop',
image=>'noop',
flavor=>'noop')
- $provider: new(apps:ServerProvider, $this.environment,
source=>$server, serverNamePattern=>'testNode-{0}')
- $this.group: new(apps:ServerGroup, provider=>$provider, numItems=>5)
- $this.group.deploy()
- $this.reports: []
- inject($this.environment.reporter, report, $this, report)