Skip to content

Commit

Permalink
Merge "Don't change undisclosed param on slave-change"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Jul 14, 2015
2 parents 1e3d11e + ee3b89e commit b04f13c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
4 changes: 2 additions & 2 deletions devops/models/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def set_vcpu(self, vcpu):
param: vcpu: Integer
:rtype : None
"""
if vcpu != self.vcpu:
if vcpu is not None and vcpu != self.vcpu:
self.vcpu = vcpu
self.driver.node_set_vcpu(node=self, vcpu=vcpu)
self.save()
Expand All @@ -175,7 +175,7 @@ def set_memory(self, memory):
param: memory: Integer
:rtype : None
"""
if memory != self.memory:
if memory is not None and memory != self.memory:
self.memory = memory
self.driver.node_set_memory(node=self, memory=memory * 1024)
self.save()
Expand Down
30 changes: 25 additions & 5 deletions devops/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ def do_slave_change(self):

def do_admin_change(self):
node = self.env.get_node(name="admin")
node.set_vcpu(vcpu=self.params.vcpu_count)
node.set_memory(memory=self.params.ram_size)
node.set_vcpu(vcpu=self.params.admin_vcpu_count)
node.set_memory(memory=self.params.admin_ram_size)

def do_admin_setup(self):
admin_node = self.env.get_node(name='admin')
Expand Down Expand Up @@ -327,6 +327,18 @@ def get_params(self):
admin_vcpu_parser.add_argument('--admin-vcpu', dest='admin_vcpu_count',
help='Select admin node VCPU count',
default=2, type=int)
change_admin_ram_parser = argparse.ArgumentParser(add_help=False)
change_admin_ram_parser.add_argument('--admin-ram',
dest='admin_ram_size',
help='Select admin node RAM '
'size (MB)',
default=None, type=int)
change_admin_vcpu_parser = argparse.ArgumentParser(add_help=False)
change_admin_vcpu_parser.add_argument('--admin-vcpu',
dest='admin_vcpu_count',
help='Select admin node VCPU '
'count',
default=None, type=int)
admin_disk_size_parser = argparse.ArgumentParser(add_help=False)
admin_disk_size_parser.add_argument('--admin-disk-size',
dest='admin_disk_size',
Expand All @@ -341,6 +353,14 @@ def get_params(self):
vcpu_parser.add_argument('--vcpu', dest='vcpu_count',
help='Set node VCPU count',
default=1, type=int)
change_ram_parser = argparse.ArgumentParser(add_help=False)
change_ram_parser.add_argument('--ram', dest='ram_size',
help='Set node RAM size',
default=None, type=int)
change_vcpu_parser = argparse.ArgumentParser(add_help=False)
change_vcpu_parser.add_argument('--vcpu', dest='vcpu_count',
help='Set node VCPU count',
default=None, type=int)
node_count = argparse.ArgumentParser(add_help=False)
node_count.add_argument('--node-count', '-C', dest='node_count',
help='How many nodes will be created',
Expand Down Expand Up @@ -457,7 +477,7 @@ def get_params(self):
description="Add a new node to environment")
subparsers.add_parser('slave-change',
parents=[name_parser, node_name_parser,
ram_parser, vcpu_parser],
change_ram_parser, change_vcpu_parser],
help="Change node VCPU and memory config",
description="Change count of VCPUs and memory")
subparsers.add_parser('slave-remove',
Expand All @@ -470,8 +490,8 @@ def get_params(self):
help="Setup admin node",
description="Setup admin node from ISO")
subparsers.add_parser('admin-change',
parents=[name_parser, admin_ram_parser,
admin_vcpu_parser],
parents=[name_parser, change_admin_ram_parser,
change_admin_vcpu_parser],
help="Change admin node VCPU and memory config",
description="Change count of VCPUs and memory "
"for admin node")
Expand Down

0 comments on commit b04f13c

Please sign in to comment.