diff --git a/doc/design-2.1.rst b/doc/design-2.1.rst index 5e768e267dbfd78a7119049ed770b35205e5aa1e..c3002dd783b8b5b2cac5bf42ec96af58f44da78f 100644 --- a/doc/design-2.1.rst +++ b/doc/design-2.1.rst @@ -361,7 +361,7 @@ Wire protocol A confd query will look like this, on the wire:: - { + plj0{ "msg": "{\"type\": 1, \"rsalt\": \"9aa6ce92-8336-11de-af38-001d093e835f\", \"protocol\": 1, @@ -370,7 +370,10 @@ A confd query will look like this, on the wire:: "hmac": "4a4139b2c3c5921f7e439469a0a45ad200aead0f" } -Detailed explanation of the various fields: +"plj0" is a fourcc that details the message content. It stands for plain +json 0, and can be changed as we move on to different type of protocols +(for example protocol buffers, or encrypted json). What follows is a +json encoded string, with the following fields: - 'msg' contains a JSON-encoded query, its fields are: @@ -392,7 +395,7 @@ Detailed explanation of the various fields: If an answer comes back (which is optional, since confd works over UDP) it will be in this format:: - { + plj0{ "msg": "{\"status\": 0, \"answer\": 0, \"serial\": 42, @@ -403,6 +406,7 @@ it will be in this format:: Where: +- 'plj0' the message type magic fourcc, as discussed above - 'msg' contains a JSON-encoded answer, its fields are: - 'protocol', integer, is the confd protocol version (initially just diff --git a/lib/locking.py b/lib/locking.py index c6b9aa4b5b30e142b3d14a8b3bc913d1c3f7c831..aeafd3f7911db3830ff4b22c9d945fcd0185a067 100644 --- a/lib/locking.py +++ b/lib/locking.py @@ -141,8 +141,12 @@ class _SingleNotifyPipeConditionWaiter(object): while True: remaining_time = running_timeout.Remaining() - if remaining_time is not None and remaining_time < 0.0: - break + if remaining_time is not None: + if remaining_time < 0.0: + break + + # Our calculation uses seconds, poll() wants milliseconds + remaining_time *= 1000 try: result = self._poller.poll(remaining_time) diff --git a/qa/ganeti-qa.py b/qa/ganeti-qa.py index 5c399e72ccd68e7567ea706be20c8f8cb34607c7..a7f34509d1a0e6e01231c10700f63baf60c4164a 100755 --- a/qa/ganeti-qa.py +++ b/qa/ganeti-qa.py @@ -157,6 +157,11 @@ def RunCommonInstanceTests(instance): if qa_config.TestEnabled('instance-reboot'): RunTest(qa_instance.TestInstanceReboot, instance) + if qa_config.TestEnabled('instance-rename'): + RunTest(qa_instance.TestInstanceShutdown, instance) + RunTest(qa_instance.TestInstanceRename, instance) + RunTest(qa_instance.TestInstanceStartup, instance) + if qa_config.TestEnabled('tags'): RunTest(qa_tags.TestInstanceTags, instance) diff --git a/qa/qa-sample.json b/qa/qa-sample.json index f051ec9b21611ffc4765c3230163c1330b785e48..d167e06e9831fcf58756d1730d4d8d6f5e5debe0 100644 --- a/qa/qa-sample.json +++ b/qa/qa-sample.json @@ -62,17 +62,18 @@ "instance-add-plain-disk": true, "instance-add-drbd-disk": true, - "instance-list": true, + "instance-automatic-restart": false, + "instance-consecutive-failures": false, + "instance-export": true, "instance-failover": true, + "instance-import": true, "instance-info": true, + "instance-list": true, "instance-modify": true, - "instance-export": true, - "instance-import": true, - "instance-reinstall": true, "instance-reboot": true, + "instance-reinstall": true, + "instance-rename": true, "instance-shutdown": true, - "instance-automatic-restart": false, - "instance-consecutive-failures": false, "# This test might fail with certain hypervisor types, depending": null, "# on whether they support the `gnt-instance console' command.": null, diff --git a/qa/qa_instance.py b/qa/qa_instance.py index af3afeb6af10295f027240cd7213f884008cb4d3..8552e2686d3a712e074f02d66cb598940634f141 100644 --- a/qa/qa_instance.py +++ b/qa/qa_instance.py @@ -127,6 +127,23 @@ def TestInstanceReinstall(instance): utils.ShellQuoteArgs(cmd)).wait(), 0) +def TestInstanceRename(instance): + """gnt-instance rename""" + master = qa_config.GetMasterNode() + + rename_source = instance['name'] + rename_target = qa_config.get('rename', None) + if rename_target is None: + print qa_utils.FormatError('"rename" entry is missing') + return + + for name1, name2 in [(rename_source, rename_target), + (rename_target, rename_source)]: + cmd = ['gnt-instance', 'rename', name1, name2] + AssertEqual(StartSSH(master['primary'], + utils.ShellQuoteArgs(cmd)).wait(), 0) + + def TestInstanceFailover(instance): """gnt-instance failover""" master = qa_config.GetMasterNode() diff --git a/scripts/gnt-instance b/scripts/gnt-instance index 81cf1c27dc1cbd0ead68320d32dd24a2e0360fb7..fb9d58fedbbe52687590b7ca88bdf003cdd3ff81 100755 --- a/scripts/gnt-instance +++ b/scripts/gnt-instance @@ -615,7 +615,7 @@ def RenameInstance(opts, args): """ op = opcodes.OpRenameInstance(instance_name=args[0], new_name=args[1], - ignore_ip=opts.ignore_ip) + ignore_ip=not opts.ip_check) SubmitOrSend(op, opts) return 0