Skip to content

Commit

Permalink
Change the internal --to arg name to "to"
Browse files Browse the repository at this point in the history
So the api call using that option is more intuitive:

POST /service_action
{
  "path": "test/svc/c1",
  "action": "scale",
  "options": {
    "to": 2
  }
}
  • Loading branch information
cvaroqui committed Jul 16, 2019
1 parent 68058f3 commit 5755c6d
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/resContainerHpVm.py
Expand Up @@ -109,7 +109,7 @@ def check_capabilities(self):
return False

def _migrate(self):
cmd = ['hpvmmigrate', '-o', '-P', self.name, '-h', self.svc.options.destination_node]
cmd = ['hpvmmigrate', '-o', '-P', self.name, '-h', self.svc.options.to]
(ret, buff, err) = self.vcall(cmd)
if ret != 0:
raise ex.excError
Expand Down
2 changes: 1 addition & 1 deletion lib/resContainerLxd.py
Expand Up @@ -136,7 +136,7 @@ def cleanup_cgroup(self, t="*"):
self.log.debug("failed to remove leftover cgroup %s: %s" % (p, str(e)))

def _migrate(self):
cmd = [lxc, 'move', self.name, self.svc.options.destination_node+":"+self.name]
cmd = [lxc, 'move', self.name, self.svc.options.to+":"+self.name]
(ret, buff, err) = self.vcall(cmd)
if ret != 0:
raise ex.excError
Expand Down
2 changes: 1 addition & 1 deletion lib/resContainerOvm.py
Expand Up @@ -59,7 +59,7 @@ def find_vmcf(self):
return l[0]

def _migrate(self):
cmd = ['xm', 'migrate', '-l', self.uuid, self.svc.options.destination_node]
cmd = ['xm', 'migrate', '-l', self.uuid, self.svc.options.to]
(ret, buff, err) = self.vcall(cmd)
if ret != 0:
raise ex.excError
Expand Down
8 changes: 4 additions & 4 deletions lib/svc.py
Expand Up @@ -1365,9 +1365,9 @@ def prepare_global_expect(self, action):
global_expect = "purged"
action = "purge"
elif action == "move":
if self.options.destination_node is None:
if self.options.to is None:
raise ex.excError("the --to <node>[,<node>,...] option is required")
global_expect += self.options.destination_node
global_expect += self.options.to
elif action == "switch":
dst = self.destination_node_sanity_checks() # pylint: disable=assignment-from-none
if dst is None:
Expand Down Expand Up @@ -5033,7 +5033,7 @@ def destination_node_sanity_checks(self, destination_node=None):
Return the validated destination node name.
"""
if destination_node is None:
destination_node = self.options.destination_node
destination_node = self.options.to
if destination_node is None:
destination_node = "<peer>"
return destination_node
Expand Down Expand Up @@ -5082,7 +5082,7 @@ def scale(self):
if self.scale_target is None:
raise ex.excError("can't scale: not a scaler")
try:
value = int(self.options.destination_node)
value = int(self.options.to)
assert value >= 0
except Exception:
raise ex.excError("invalid scale target: set '--to <n>' where n>=0")
Expand Down
2 changes: 1 addition & 1 deletion lib/svcmgr_parser.py
Expand Up @@ -105,7 +105,7 @@
help="The tag name, as shown by :cmd:`svcmgr collector list tags`."),
"to": Option(
"--to", default=None,
action="store", dest="parm_destination_node",
action="store", dest="to",
help="The remote node to start or migrate the service to. Or the "
"target number of instance to scale to."),
"upto": Option(
Expand Down

0 comments on commit 5755c6d

Please sign in to comment.