From: Ben Swartzlander Date: Fri, 21 Dec 2012 05:24:46 +0000 (-0500) Subject: Make the NetAppISCSIDriver._is_clone_done() method able to handle X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=035cd28ed36c4ec34c20e7cedf0815af72e3f2c0;p=openstack-build%2Fcinder-build.git Make the NetAppISCSIDriver._is_clone_done() method able to handle empty responses. Add unit tests to exercise this case. bug 1090168 Change-Id: Ia51a73b8ebead7a0f3be9202794ca8549bdf3e5b --- diff --git a/cinder/tests/test_netapp.py b/cinder/tests/test_netapp.py index 93aba2605..21b39e4f3 100644 --- a/cinder/tests/test_netapp.py +++ b/cinder/tests/test_netapp.py @@ -822,7 +822,25 @@ class FakeDfmServerHandler(BaseHTTPServer.BaseHTTPRequestHandler): names = body.xpath('na:ApiProxy/na:Request/na:Name', namespaces=nsmap) proxy = names[0].text - if 'igroup-list-info' == proxy: + if 'clone-list-status' == proxy: + op_elem = body.xpath('na:ApiProxy/na:Request/na:Args/' + 'clone-id/clone-id-info/clone-op-id', + namespaces=nsmap) + proxy_body = """ + + completed + + """ + if '0' == op_elem[0].text: + proxy_body = '' + elif 'clone-start' == proxy: + proxy_body = """ + + 1 + xxx + + """ + elif 'igroup-list-info' == proxy: igroup = 'openstack-iqn.1993-08.org.debian:01:23456789' initiator = 'iqn.1993-08.org.debian:01:23456789' proxy_body = """ @@ -988,6 +1006,15 @@ class NetAppDriverTestCase(test.TestCase): self.driver.terminate_connection(volume, connector) self.driver._remove_destroy(self.VOLUME_NAME, self.PROJECT_ID) + def test_clone(self): + self.driver._discover_luns() + self.driver._clone_lun(0, '/vol/vol/qtree/src', '/vol/vol/qtree/dst', + False) + + def test_clone_fail(self): + self.driver._discover_luns() + self.driver._is_clone_done(0, '0', 'xxx') + WSDL_HEADER_CMODE = """