Earlier  
Posted Nick Remark
#openstack-nova - 2017-06-13
15:05:35 dansmith right
15:05:36 dansmith right
15:05:42 dansmith that is the late run to pick up stragglers I think,
15:05:53 dansmith and this is earlier
15:06:07 dansmith I don't think the devstack change makes anything like db init happen in any different order,
15:06:21 dansmith so I'm kinda suspecting that we're using the wrong config file somewhere and never installing the maps at the top
15:06:38 dansmith but I can chase that down.. just want to do this as the easy first stab and see where we are
15:06:49 dansmith if this doesn't work, it's definitely a config file thing I think
15:06:59 dansmith definitely I think
15:09:14 huanxie stack.org/#/c/462017/ ? And TBH, I'm not quit sure which one is better now, so could you help give some suggestions? Thanks a lot:)
15:09:14 huanxie Hi jaypipes, for VM lost connection issue during live migration with XenServer, I saw your comments with this patch https://review.openstack.org/#/c/451657/ and I think it's reasonable to hide detailed bridge operation, so I made another patch https://review.openstack.org/#/c/462017/ for this issue. Could you help have a look at https://review.open
15:10:40 cfriesen mriedem: dansmith: If you have a few minutes, I addressed some of mriedem's comments on https://review.openstack.org/#/c/435141/ but I'm stuck on how to mock the unit tests to do the api version.
15:11:14 dansmith cfriesen: that's not a thing I'm going to be helpful with. ask sdague or alex_xu
15:12:48 jaypipes huanxie: yup, it's on my queue :) sorry, in three hour meeting right now :(
15:13:08 mriedem cfriesen: andreykurilin might be able to help, otherwise i can look later
15:13:25 andreykurilin hi
15:13:29 cfriesen hey
15:13:53 andreykurilin cfriesen: what had happend? need help?)
15:13:54 huanxie That's fine, please leave your comments and concern and I will address your comments my next Monday:)
15:14:06 cfriesen andreykurilin: see https://review.openstack.org/#/c/435141/
15:14:12 andreykurilin looking
15:14:41 cfriesen andreykurilin: I added a microversion such that the "nova list" command now needs to check microversions to determine how to format the output, and it's breaking a bunch of novaclient tests.
15:15:01 huanxie Hi jaypipes, sorry for my mistack, I mean I will fix your comments my next morning :)
15:15:21 jaypipes huanxie: no problem!
15:16:01 cfriesen andreykurilin: the tests in question use mock.MagickMock for novaclient.client.Client, and then later on some of the tests do @mock.patch('novaclient.client.Client'), and I can't figure out how to get them to report api_version properly
15:16:09 huanxie Thanks a lot jaypipes
15:16:36 andreykurilin cfriesen: are you talking about unit or functional tests?
15:17:06 cfriesen andreykurilin: unit. novaclient/tests/unit/test_shell.py
15:17:52 mriedem cfriesen: wouldn't you just put an api_version attribute on the mock?
15:19:42 cfriesen mriedem: the code in question does this in setUp(): self.useFixture(fixtures.MonkeyPatch('novaclient.client.Client', mock.MagicMock()))
15:20:12 cfriesen mriedem: I can't figure out how to put an api_version attribute on that
15:20:20 andreykurilin cfriesen: it looks like just that module requires some cleanup
15:20:38 mriedem cfriesen: mock.MagicMock(api_version=api_versions.APIVersion('2.1'))
15:20:40 mriedem or something
15:20:41 andreykurilin if setUp method uses fixtures, no @mock.patch is required
15:22:36 andreykurilin cfriesen: I suppose, we need to same mock.MagicMock() object as self.mock_client before transmitting to MonkeyPatch, and than you will able to do `self.mock_client.api_version = api_versions.APIVersion("2.22")` in your test
15:24:58 cfriesen andreykurilin: if you don't @mock.patch on the test itself, how do you do stuff like "client_kwargs = mock_client.call_args_list[0][1]" ?
15:25:31 andreykurilin cfriesen: as I mentioned previously, we need to store object transmitted to MockPatch in setUp method
15:25:59 cfriesen andreykurilin: I think I see. will try that
15:29:10 cfriesen andreykurilin: you are a genius. Looks like that'll work. let me respin a new version for review.
15:29:47 andreykurilin cfriesen: If you have time, please submit a patch with removing all redundant @mock.patch there
15:30:03 cfriesen andreykurilin: whoops, spoke too soon. TypeError: '<MagicMock name='mock().api_version' id='69241360'>' should be an instance of '<class 'novaclient.api_versions.APIVersion'>'
15:30:53 andreykurilin cfriesen: in your test, you should do something like `self.mock_client.api_version = api_versions.APIVersion("2.22")`` where api_versions is a module novaclient.api_versions
15:31:42 mriedem _CellProxy
15:31:42 cfriesen andreykurilin: this is what I have now: http://paste.openstack.org/show/612435/
15:31:43 mriedem oh _CellProxy
15:31:46 mriedem why oh why
15:33:18 cfriesen andreykurilin: and this is what I get when running it: http://paste.openstack.org/show/612437/
15:33:47 mriedem cfriesen: needs to be an object,
15:33:49 mriedem not a string
15:34:38 mriedem cfriesen: https://github.com/openstack/python-novaclient/blob/master/novaclient/client.py#L59
15:34:43 mriedem ^ is what you're mocking out ultimately
15:34:57 cfriesen mriedem: what needs to be an object?
15:34:58 mriedem so it needs to be of type novaclient.api_versions.APIVersion
15:35:09 mriedem cfriesen: self.mock_client.api_version = novaclient.API_MAX_VERSION
15:35:13 mriedem that's a string
15:35:15 mriedem needs to be an object
15:35:22 mriedem an APIVersion object
15:35:26 mriedem which is constructed with a string value
15:36:02 mriedem i would probably also use API_MIN_VERSION as the default
15:36:06 mriedem for existing tests
15:36:44 cfriesen yeah, that was my intent. copy/paste error just now
15:37:25 mriedem bauzas: i've got a fun cells v1 question for you
15:37:34 mriedem bauzas: i need to implement __contains__ for the _CellProxy
15:37:36 bauzas mriedem: kaboom
15:37:37 mriedem like https://github.com/openstack/nova/blob/master/nova/cells/utils.py#L64
15:37:41 mriedem i see that id and host are special cased
15:37:50 mriedem i was just doing this:
15:37:51 mriedem return key in self._obj
15:37:51 mriedem def __contains__(self, key):
15:37:56 mriedem but do i need to special case id and host?
15:38:11 mriedem i don't think so, but wanted to ask
15:38:37 bauzas mriedem: I need to reload the context in mind because it's a 2-yr blame :p
15:39:11 mriedem i think we special case id and host because they are namespaced
15:39:12 mriedem to the cell
15:39:28 mriedem whether they are IN the proxied object is the same either way i think
15:41:00 bauzas mriedem: oh right I remember
15:41:01 bauzas mriedem: now
15:41:30 bauzas AFAIR, we're amending the host value by the cell path
15:41:43 bauzas the same goes with the ID
15:41:55 bauzas something like 'foo' becomes cell1!foo AFAIR
15:42:13 bauzas which was a problem for our object layers
15:42:20 bauzas at least the id
15:42:48 bauzas so, we wrote those ugly patterns to make sure we can just modify both the ID and the host fields without touching the object
15:43:48 mriedem yeah, so i think the answer is my simple __contains__ impl is fine
15:43:50 mriedem for what i need
15:43:57 mriedem which is just checking if a field is set in the wrapped object
15:44:08 mriedem it's a proxy to the ovo base __contains__
15:44:26 bauzas I'm thinking of your question
15:44:33 bauzas whether we should special case id and host
15:44:44 bauzas I think no
15:44:50 bauzas because we have the properties
15:46:59 bauzas mriedem: ^
15:49:31 bauzas mriedem: the thing is, I'm thiking of the precedence between __getitem__ and __contains__
15:50:33 bauzas mriedem: but if you ask : 'id' in mycellproxy
15:50:39 mriedem bauzas: __contains__ is used before __getitem__
15:50:43 bauzas it should provide True anyway
15:50:45 mriedem which is why i needed to add it
15:50:59 mriedem see http://logs.openstack.org/99/471899/5/check/gate-nova-python27-ubuntu-xenial/7be94a3/testr_results.html.gz
15:51:12 mriedem that was calling __getitem__ with key=0

Earlier   Later