Skip to content
Permalink
Browse files

Change the internal --to arg name to "to"

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 5755c6d71c51763cb6145b9c70de5170a761e6f5
Showing with 8 additions and 8 deletions.
  1. +1 −1 lib/resContainerHpVm.py
  2. +1 −1 lib/resContainerLxd.py
  3. +1 −1 lib/resContainerOvm.py
  4. +4 −4 lib/svc.py
  5. +1 −1 lib/svcmgr_parser.py
@@ -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
@@ -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
@@ -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
@@ -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:
@@ -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
@@ -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")
@@ -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(

0 comments on commit 5755c6d

Please sign in to comment.
You can’t perform that action at this time.