示例#1
0
 def test_create_cgsnapshot(self, create_snapshot,
                            rename_snapshot,
                            delete_snapshot):
     cgsnapshot = fake_cgsnapshot(self.ctxt)
     volume = fake_volume(self.ctxt)
     snapshot = fake_snapshot(self.ctxt)
     snapshot.volume = volume
     snapshots = [snapshot]
     cgsnapshot_name = (
         self.cfg.nexenta_group_snapshot_template % cgsnapshot['id'])
     cgsnapshot_path = '%s@%s' % (self.drv.root_path, cgsnapshot_name)
     snapshot_path = '%s/%s@%s' % (self.drv.root_path,
                                   snapshot['volume_name'],
                                   cgsnapshot_name)
     create_snapshot.return_value = {}
     rename_snapshot.return_value = {}
     delete_snapshot.return_value = {}
     result = self.drv.create_cgsnapshot(self.ctxt,
                                         cgsnapshot,
                                         snapshots)
     create_payload = {'path': cgsnapshot_path, 'recursive': True}
     create_snapshot.assert_called_with(create_payload)
     rename_payload = {'newName': snapshot['name']}
     rename_snapshot.assert_called_with(snapshot_path, rename_payload)
     delete_payload = {'defer': True, 'recursive': True}
     delete_snapshot.assert_called_with(cgsnapshot_path, delete_payload)
     expected = ({}, [])
     self.assertEqual(expected, result)
示例#2
0
 def test_delete_cgsnapshot(self, delete_snapshot):
     cgsnapshot = fake_cgsnapshot(self.ctxt)
     volume = fake_volume(self.ctxt)
     snapshot = fake_snapshot(self.ctxt)
     snapshot.volume = volume
     snapshots = [snapshot]
     delete_snapshot.return_value = {}
     result = self.drv.delete_cgsnapshot(self.ctxt, cgsnapshot, snapshots)
     delete_snapshot.assert_called_with(snapshot)
     expected = ({}, [])
     self.assertEqual(expected, result)
示例#3
0
 def test_delete_cgsnapshot(self, delete_snapshot):
     cgsnapshot = fake_cgsnapshot(self.ctxt)
     snapshot = fake_snapshot(self.ctxt)
     volume = fake_volume(self.ctxt)
     snapshot.volume = volume
     snapshots = [snapshot]
     delete_snapshot.return_value = {}
     result = self.drv.delete_cgsnapshot(self.ctxt,
                                         cgsnapshot,
                                         snapshots)
     delete_snapshot.assert_called_with(snapshot)
     expected = ({}, [])
     self.assertEqual(expected, result)
示例#4
0
 def test_create_consistencygroup_from_src_snapshots(self, create_volume):
     cgroup = fake_cgroup(self.ctxt)
     cgsnapshot = fake_cgsnapshot(self.ctxt)
     volume = fake_volume(self.ctxt)
     snapshot = fake_snapshot(self.ctxt)
     snapshot.volume = volume
     snapshots = [snapshot]
     clone_spec = {'id': fake.VOLUME2_ID}
     clone = fake_volume(self.ctxt, **clone_spec)
     clones = [clone]
     create_volume.return_value = {}
     result = self.drv.create_consistencygroup_from_src(
         self.ctxt, cgroup, clones, cgsnapshot, snapshots, None, None)
     create_volume.assert_called_with(clone, snapshot)
     expected = ({}, [])
     self.assertEqual(expected, result)
示例#5
0
 def test_create_consistencygroup_from_src_snapshots(self, create_volume):
     cgroup = fake_cgroup(self.ctxt)
     cgsnapshot = fake_cgsnapshot(self.ctxt)
     volume = fake_volume(self.ctxt)
     snapshot = fake_snapshot(self.ctxt)
     snapshot.volume = volume
     snapshots = [snapshot]
     clone_spec = {'id': fake.VOLUME2_ID}
     clone = fake_volume(self.ctxt, **clone_spec)
     clones = [clone]
     create_volume.return_value = {}
     result = self.drv.create_consistencygroup_from_src(self.ctxt, cgroup,
                                                        clones, cgsnapshot,
                                                        snapshots, None,
                                                        None)
     create_volume.assert_called_with(clone, snapshot)
     expected = ({}, [])
     self.assertEqual(expected, result)