Merge "Add new API - zone pool move"
This commit is contained in:
commit
90a9fe3d65
@ -148,6 +148,17 @@ class TestZones(v2.APIV2TestCase, v2.CrudMixin):
|
|||||||
self.client.zones.axfr(ref["id"])
|
self.client.zones.axfr(ref["id"])
|
||||||
self.assertRequestBodyIs(None)
|
self.assertRequestBodyIs(None)
|
||||||
|
|
||||||
|
def test_task_pool_move(self):
|
||||||
|
ref = self.new_ref(pool_id=1)
|
||||||
|
|
||||||
|
parts = [self.RESOURCE, ref["id"], "tasks", "pool_move"]
|
||||||
|
self.stub_url("POST", parts=parts)
|
||||||
|
|
||||||
|
values = ref.copy()
|
||||||
|
|
||||||
|
self.client.zones.pool_move(ref["id"], values)
|
||||||
|
self.assertRequestBodyIs(json=values)
|
||||||
|
|
||||||
|
|
||||||
class TestZoneTransfers(v2.APIV2TestCase, v2.CrudMixin):
|
class TestZoneTransfers(v2.APIV2TestCase, v2.CrudMixin):
|
||||||
def test_create_request(self):
|
def test_create_request(self):
|
||||||
|
@ -312,6 +312,32 @@ class AXFRZoneCommand(command.Command):
|
|||||||
{'zone_id': parsed_args.id})
|
{'zone_id': parsed_args.id})
|
||||||
|
|
||||||
|
|
||||||
|
class PoolMoveZoneCommand(command.Command):
|
||||||
|
"""Move a zone to another pool"""
|
||||||
|
def get_parser(self, prog_name):
|
||||||
|
parser = super(PoolMoveZoneCommand, self).get_parser(prog_name)
|
||||||
|
|
||||||
|
parser.add_argument('zone_id', help="Zone ID")
|
||||||
|
parser.add_argument('--pool-id', help="Pool ID")
|
||||||
|
|
||||||
|
common.add_all_common_options(parser)
|
||||||
|
|
||||||
|
return parser
|
||||||
|
|
||||||
|
def take_action(self, parsed_args):
|
||||||
|
client = self.app.client_manager.dns
|
||||||
|
common.set_all_common_headers(client, parsed_args)
|
||||||
|
|
||||||
|
data = {}
|
||||||
|
if parsed_args.pool_id:
|
||||||
|
data['pool_id'] = parsed_args.pool_id
|
||||||
|
|
||||||
|
client.zones.pool_move(parsed_args.zone_id, data)
|
||||||
|
|
||||||
|
LOG.info("Scheduled move for zone %(zone_id)s",
|
||||||
|
{"zone_id": parsed_args.zone_id})
|
||||||
|
|
||||||
|
|
||||||
class CreateTransferRequestCommand(command.ShowOne):
|
class CreateTransferRequestCommand(command.ShowOne):
|
||||||
"""Create new zone transfer request"""
|
"""Create new zone transfer request"""
|
||||||
|
|
||||||
|
@ -89,6 +89,13 @@ class ZoneController(V2Controller):
|
|||||||
|
|
||||||
self.client.session.post(url)
|
self.client.session.post(url)
|
||||||
|
|
||||||
|
def pool_move(self, zone, values):
|
||||||
|
zone = v2_utils.resolve_by_name(self.list, zone)
|
||||||
|
|
||||||
|
url = self.build_url('/zones/%s/tasks/pool_move' % zone)
|
||||||
|
|
||||||
|
return self._post(url, data=values)
|
||||||
|
|
||||||
|
|
||||||
class ZoneTransfersController(V2Controller):
|
class ZoneTransfersController(V2Controller):
|
||||||
def create_request(self, zone, target_project_id, description=None):
|
def create_request(self, zone, target_project_id, description=None):
|
||||||
|
@ -55,6 +55,7 @@ openstack.dns.v2 =
|
|||||||
|
|
||||||
zone_abandon = designateclient.v2.cli.zones:AbandonZoneCommand
|
zone_abandon = designateclient.v2.cli.zones:AbandonZoneCommand
|
||||||
zone_axfr = designateclient.v2.cli.zones:AXFRZoneCommand
|
zone_axfr = designateclient.v2.cli.zones:AXFRZoneCommand
|
||||||
|
zone_move = designateclient.v2.cli.zones:PoolMoveZoneCommand
|
||||||
|
|
||||||
zone_export_create = designateclient.v2.cli.zones:ExportZoneCommand
|
zone_export_create = designateclient.v2.cli.zones:ExportZoneCommand
|
||||||
zone_export_list = designateclient.v2.cli.zones:ListZoneExportsCommand
|
zone_export_list = designateclient.v2.cli.zones:ListZoneExportsCommand
|
||||||
|
Loading…
Reference in New Issue
Block a user