Earlier  
Posted Nick Remark
#openstack-nova - 2019-10-02
07:02:42 gibi SonPham: hi! most of the core developers are active after 12:00 UTC. The contribution process is documented here https://docs.openstack.org/nova/latest/contributor/index.html
07:09:52 gibi SonPham: regarding your feature. How does it different from the existing snapshot feature of OpenStack?
07:10:50 SonPham gibi i'm using libvirt for snapshot
07:11:17 SonPham it can keep running process
07:11:59 SonPham but volume image type must be change from RAW to QCOW2
07:15:00 gibi SonPham: I think nova can also do live snapshot
07:17:26 gibi SonPham: the relevant codepath starts around here https://github.com/openstack/nova/blob/bf37bec80baa527ac013dfaa7480ef2761ed2cb9/nova/virt/libvirt/driver.py#L2267
07:19:16 openstackgerrit OpenStack Proposal Bot proposed openstack/nova stable/train: Imported Translations from Zanata https://review.opendev.org/685534
07:30:17 SonPham gibi i think openstakc snapshot is an image of disk. not keep process
07:31:59 gibi SonPham: yes, it creates a copy of the disk while the libvirt domain is still running
07:33:52 gibi SonPham: you what I mean is that the existing snapshot code does not require to shutdown the domain
07:33:59 gibi s/you//
07:34:45 gibi SonPham: do you mean that in your case the snapshot itself stores the running state of the whole domain?
07:35:12 SonPham gibi my project create snapshot when domain running. but when you revert snapshot. all of process still keep lock like you snapshot
07:37:05 SonPham gibi yep . stores the running state of the whole domain
07:37:15 gibi SonPham: I see
07:37:32 gibi SonPham: I suggest to try to propose a feature specification
07:37:41 gibi SonPham: the nova spec repo is here https://opendev.org/openstack/nova-specs
07:38:25 gibi SonPham: you basically need to fill the spec template https://opendev.org/openstack/nova-specs/src/branch/master/specs/ussuri-template.rst
07:39:28 gibi SonPham: and open a blueprint pointing to the spec https://blueprints.launchpad.net/nova
08:03:53 brinzhang gibi: I saw the code as you, and there is an configuration https://docs.openstack.org/nova/stein/configuration/config.html#workarounds.disable_libvirt_livesnapshot
08:05:17 brinzhang gibi: it seems that there is not has the API provide for user to do the live-snapshot,I think it's not support good enough(https://docs.openstack.org/nova/stein/configuration/config.html#workarounds.disable_libvirt_livesnapshot)
08:06:05 brinzhang gibi: I didn't go deep into the logic of this piece :P
09:17:59 openstackgerrit Balazs Gibizer proposed openstack/nova master: Do not print default dicts during heal_allocations https://review.opendev.org/686001
09:18:00 openstackgerrit Balazs Gibizer proposed openstack/nova master: Test heal port allocations in nova-next https://review.opendev.org/669879
09:18:28 gibi stephenfin: fixed your comments in ^^
09:20:08 gibi stephenfin: unfortunately we dont have jq in the environment
10:17:34 openstackgerrit Balazs Gibizer proposed openstack/nova master: Add a way to spy on function calls in test https://review.opendev.org/685949
10:18:54 openstackgerrit Balazs Gibizer proposed openstack/nova master: Replace mock with spy in test https://review.opendev.org/685950
12:38:44 openstackgerrit Stephen Finucane proposed openstack/nova master: nova-net: Use nova-net explicitly in functional tests https://review.opendev.org/684326
13:41:11 openstackgerrit Eric Fried proposed openstack/nova master: Improve spy CM's data passing https://review.opendev.org/686167
13:41:45 openstackgerrit Matt Riedemann proposed openstack/nova stable/queens: lxc: make use of filter python3 compatible https://review.opendev.org/676500
13:49:11 efried gibi: I'm having way too much fun with spy
13:55:12 gibi efried: I know.I feel the same thing :)
13:55:22 openstackgerrit Eric Fried proposed openstack/nova master: Improve spy CM's data passing https://review.opendev.org/686167
13:56:15 gibi efried: I try to answered your concerns about accessing _spy in the body of _spy()
13:56:17 dansmith efried: gibi: maybe I'm missing something, but why isn't this as easy as: https://pastebin.com/b0g9ZFHS ?
13:56:41 dansmith that mock-wraps the original thing with just one line but leaves you to examine the regular mock attributes
13:56:44 mriedem gibi: replied in https://review.opendev.org/#/c/686047/
13:57:19 efried dansmith: it allows you to examine the args, but it never runs the original foo()
13:57:20 gibi dansmith: is some tests we need to run the original function
13:57:29 dansmith efried: yes it does
13:57:31 dansmith efried: run it
13:57:37 efried oic
13:57:44 mriedem note that mock.patch(wraps=...) does that as well
13:57:45 dansmith gibi: that runs the original
13:58:04 dansmith ah, didn't know about wraps
13:58:12 gibi dansmith: let me try that with a bound method
13:58:17 mriedem wraps is kind of weird to use
13:58:20 mriedem not documented very well
13:58:58 efried What spy does is allow you to keep track of things per invocation of the wrapped method, which wraps= doesn't
13:59:29 efried also selectively change the behavior
13:59:42 efried like "run normally the first time, raise the second time"
13:59:54 dansmith I don't see how it's different from side_effect
14:04:21 gibi dansmith: side_effect is not good for calling the original if the original is a bound method http://paste.openstack.org/show/780754/
14:05:02 dansmith gibi: that's because you're mocking the class not the object
14:05:15 dansmith I think you're just using your spy in a different order
14:05:27 dansmith if you mock.patch.object(a) I think you'll be fine
14:06:10 gibi dansmith: but in the functional test when we mock we tend not to have easy access to the instantiated objects just the classes
14:06:35 dansmith in that one scenario you mean, but not necessarily as a general rule
14:07:24 dansmith efried's use of spy in the patch above that does not seem to be very clean to me, especially for a supposed functional test
14:07:34 gibi dansmith: my goal is to want to get rid of (or contain) the scope magic and the original function handling in cases like https://github.com/openstack/nova/blob/bf37bec80baa527ac013dfaa7480ef2761ed2cb9/nova/tests/functional/regressions/test_bug_1843090.py#L100
14:07:59 dansmith but anyway, not saying it's not useful, it just seems like in a lot of cases, you could get away with base mock stuff instead of having to learn a new convention
14:08:11 efried oh, yeah, in the vast majority of cases
14:08:33 gibi spy is not a replacement for mock. There are cases where I think mock is hard to use to achive the same thing
14:08:43 gibi like the funct test I linket above
14:08:52 dansmith gibi: understand. using side_effect to provide a sequence of run,fail is more conventional than what either the old or new code in that patch is doing
14:09:02 dansmith assuming you can hook at the right spot to mock the object itself
14:09:40 efried dansmith: I don't think you can use side_effect to run,fail
14:09:46 dansmith efried: of course you can
14:09:53 dansmith efried: provide it a list and it will iterate on each call
14:09:55 efried because when you pass an iterable to side_effect, it's return values, not callables.
14:10:00 dansmith nope
14:10:07 dansmith return_value behaves like that, side_effect does not
14:10:28 efried side_effect=one_thing calls one_thing
14:10:28 efried side_effect=[one, two] *returns* one followed by two
14:10:33 gibi dansmith: btw, mocking f through the instance doesn't work either http://paste.openstack.org/show/780755/
14:10:54 dansmith efried: "If side_effect is an iterable then each call to the mock will return the next value from the iterable."
14:11:01 efried ^
14:11:56 dansmith efried: https://pastebin.com/bLpt6Skz
14:12:22 dansmith gibi: it's all about calling convention, it's tricky and magical, but you're not doing anything different other than the ordering
14:12:46 efried dansmith: yup, that didn't print "Foo ran 1"
14:13:12 efried try to get it to do that the first time, and raise the second
14:13:13 gibi dansmith: tell me how can I call the original with side_effect if the original is a bound method because I failed to find a way
14:13:26 efried gibi: you can't
14:13:27 dansmith efried: it printed 1, my local env has a different foo
14:14:13 dansmith efried: wait, what are you arguing? that it didn't run foo? I didn't ask it to
14:14:22 efried I know. And you can't.
14:14:36 efried that's what spy helps with
14:14:54 gibi exaclty what efried is asking is what I'm after. having the original function is called while spying on the call
14:15:07 dansmith ah, I see what you mean.. a lambda in the list will solve that
14:15:20 gibi dansmith: no, the lambda would be returned, not called
14:15:29 efried ^
14:15:38 dansmith gibi: having the original called is what side_effect=callable will do, but the list, fine fine, I see
14:16:20 gibi dansmith: but I cannot do that^^ if the original is a bound method as mock does not pass proper arglist to the callable
14:16:42 dansmith you guys seem to be describing a world where spy will make it easier to not write terrible tests like what efried is adding (and what he replaced), yet he's using spy to (if called once, then explode)
14:16:56 efried what did I write?
14:17:10 dansmith efried: this: https://review.opendev.org/#/c/685950/3/nova/tests/functional/regressions/test_bug_1843090.py
14:17:40 efried gibi gets credit for those
14:17:53 efried I think

Earlier   Later