#    License for the specific language governing permissions and limitations
#    under the License.

"""
Script to test basic snapshot creation mounting and deletion.
"""
from nova_volume_testing.util.novaexerciser import Volume, Instance, Snapshot

if __name__ == "__main__":
    print "002 basic snapshot - Create a volume, write to it, snapshot it, "\
          "create a volume from the snapshot, change original, check "\
          "snapshot, change snapshot, check original"
    instance = Instance()
    volume = Volume(size=1)

    assert volume.attached() == False

    volume.attach(instance)
    assert volume.attached() == True
    assert volume.attached(instance) == True

    volume.write_test_pattern(key=1)
    assert volume.check_test_pattern(key=1) == True

    volume.detach()
    assert volume.attached() == False

    snapshot = Snapshot(volume)

    snapvol = Volume(snapshot=snapshot)
    snapvol.attach(instance)
Exemplo n.º 2
0
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.
"""
Script to test creation of a stack of volumes 2 voumes deep.
"""
from nova_volume_testing.util.novaexerciser import Volume, Instance, Snapshot

if __name__ == "__main__":
    print "003 snapshot stack - create snapshots of volumes that were created "\
          "from snapshots, check all volumes can be changed without "\
          "corrupting other volumes"
    instance = Instance()
    volume = Volume(size=1)
    assert volume.attached() == False

    volume.attach(instance)
    assert volume.attached() == True
    assert volume.attached(instance) == True
    volume.write_test_pattern(key=1)
    assert volume.check_test_pattern(key=1) == True
    volume.detach()
    assert volume.attached() == False

    snapshot = Snapshot(volume)
    snapvol = Volume(snapshot=snapshot)
    snapvol.attach(instance)
    assert snapvol.check_test_pattern(key=1) == True
    snapvol.write_test_pattern(key=2)
    assert snapvol.check_test_pattern(key=2) == True
#    License for the specific language governing permissions and limitations
#    under the License.
"""
Script to test basic volume creation, mounting and deletion.
"""
from nova_volume_testing.util.novaexerciser import Volume, Instance

if __name__ == "__main__":
    print "001 basic volume create attach - Create a volume, attach it to an "\
          "instance, write to it, dettach it and attach it to a different"\
          "instance, check the data"
    instance1 = Instance()
    instance2 = Instance()
    volume = Volume(size=1)

    assert volume.attached() == False

    volume.attach(instance1)
    assert volume.attached() == True
    assert volume.attached(instance1) == True

    volume.write_test_pattern()
    assert volume.check_test_pattern() == True
    assert volume.check_test_pattern(key=16) == False

    volume.detach()
    assert volume.attached() == False

    volume.attach(instance2)
    assert volume.attached(instance2) == True
    assert volume.check_test_pattern() == True