예제 #1
0
    def test_incorrect_protocol(self):
        drive = Drive(self.log,
                      diskType=DISK_TYPE.NETWORK,
                      protocol='gluster',
                      **self.conf)

        with pytest.raises(exception.UnsupportedOperation):
            drive.get_snapshot_xml({'protocol': 'bad', 'diskType': 'network'})
예제 #2
0
    def test_block(self):
        drive = Drive(self.log, diskType=DISK_TYPE.BLOCK, **self.conf)

        expected = """
            <disk name='vda' snapshot='external' type='block'>
                <source dev='/dev/dm-1' type='block'/>
            </disk>
            """
        snap_info = {'path': '/dev/dm-1', 'device': 'disk'}
        actual = drive.get_snapshot_xml(snap_info)
        self.assertXMLEqual(vmxml.format_xml(actual), expected)
예제 #3
0
    def test_file(self):
        drive = Drive(self.log, diskType=DISK_TYPE.FILE, **self.conf)

        expected = """
            <disk name='vda' snapshot='external' type='file'>
                <source file='/image' type='file'/>
            </disk>
            """
        snap_info = {'path': '/image', 'device': 'disk'}
        actual = drive.get_snapshot_xml(snap_info)
        self.assertXMLEqual(vmxml.format_xml(actual), expected)
예제 #4
0
    def test_file(self):
        drive = Drive(self.log, **self.conf)

        expected = """
            <disk name='vda' snapshot='external' type='file'>
                <source file='/image' type='file'/>
            </disk>
            """
        snap_info = {'path': '/image', 'device': 'disk'}
        actual = drive.get_snapshot_xml(snap_info)
        self.assertXMLEqual(vmxml.format_xml(actual), expected)
예제 #5
0
    def test_block(self):
        drive = Drive(self.log, **self.conf)
        drive._blockDev = True

        expected = """
            <disk name='vda' snapshot='external' type='block'>
                <source dev='/dev/dm-1' type='block'/>
            </disk>
            """
        snap_info = {'path': '/dev/dm-1', 'device': 'disk'}
        actual = drive.get_snapshot_xml(snap_info)
        self.assertXMLEqual(vmxml.format_xml(actual), expected)
예제 #6
0
파일: vmstorage_test.py 프로젝트: nirs/vdsm
    def test_block(self):
        drive = Drive(self.log, diskType=DISK_TYPE.BLOCK, **self.conf)

        expected = """
            <disk name='vda' snapshot='external' type='block'>
                <source dev='/dev/dm-1' type='block'>
                    <seclabel model="dac" relabel="no" type="none" />
                </source>
            </disk>
            """
        snap_info = {'path': '/dev/dm-1', 'device': 'disk'}
        actual = drive.get_snapshot_xml(snap_info)
        self.assertXMLEqual(xmlutils.tostring(actual), expected)
예제 #7
0
    def test_block(self):
        drive = Drive(self.log, diskType=DISK_TYPE.BLOCK, **self.conf)

        expected = """
            <disk name='vda' snapshot='external' type='block'>
                <source dev='/dev/dm-1' type='block'>
                    <seclabel model="dac" relabel="no" type="none" />
                </source>
            </disk>
            """
        snap_info = {'path': '/dev/dm-1', 'device': 'disk'}
        actual = drive.get_snapshot_xml(snap_info)
        self.assertXMLEqual(xmlutils.tostring(actual), expected)
예제 #8
0
    def test_network(self):
        drive = Drive(self.log,
                      diskType=DISK_TYPE.NETWORK,
                      protocol='gluster',
                      **self.conf)

        expected = """
            <disk name='vda' snapshot='external' type='network'>
                <source protocol='gluster'
                        name='volume/11111111-1111-1111-1111-111111111111'
                        type='network'>
                    <host name="brick1.example.com" port="49152"
                        transport="tcp"/>
                    <host name="brick2.example.com" port="49153"
                        transport="tcp"/>
                    <seclabel model="dac" relabel="no" type="none"/>
                </source>
            </disk>
            """
        snap_info = {
            'protocol':
            'gluster',
            'path':
            'volume/11111111-1111-1111-1111-111111111111',
            'diskType':
            'network',
            'device':
            'disk',
            'hosts': [{
                'name': 'brick1.example.com',
                'port': '49152',
                'transport': 'tcp'
            }, {
                'name': 'brick2.example.com',
                'port': '49153',
                'transport': 'tcp'
            }]
        }
        actual = drive.get_snapshot_xml(snap_info)
        self.assertXMLEqual(xmlutils.tostring(actual), expected)
예제 #9
0
파일: vmstorage_test.py 프로젝트: nirs/vdsm
    def test_network(self):
        drive = Drive(self.log, diskType=DISK_TYPE.NETWORK,
                      protocol='gluster', **self.conf)

        expected = """
            <disk name='vda' snapshot='external' type='network'>
                <source protocol='gluster'
                        name='volume/11111111-1111-1111-1111-111111111111'
                        type='network'>
                    <host name="brick1.example.com" port="49152"
                        transport="tcp"/>
                    <host name="brick2.example.com" port="49153"
                        transport="tcp"/>
                </source>
            </disk>
            """
        snap_info = {
            'protocol': 'gluster',
            'path': 'volume/11111111-1111-1111-1111-111111111111',
            'diskType': 'network',
            'device': 'disk',
            'hosts': [
                {
                    'name': 'brick1.example.com',
                    'port': '49152',
                    'transport': 'tcp'
                },
                {
                    'name': 'brick2.example.com',
                    'port': '49153',
                    'transport': 'tcp'
                }
            ]
        }
        actual = drive.get_snapshot_xml(snap_info)
        self.assertXMLEqual(xmlutils.tostring(actual), expected)
예제 #10
0
파일: vmstorage_test.py 프로젝트: nirs/vdsm
    def test_incorrect_protocol(self):
        drive = Drive(self.log, diskType=DISK_TYPE.NETWORK,
                      protocol='gluster', **self.conf)

        with self.assertRaises(exception.UnsupportedOperation):
            drive.get_snapshot_xml({'protocol': 'bad', 'diskType': 'network'})
예제 #11
0
파일: vmstorage_test.py 프로젝트: nirs/vdsm
    def test_incorrect_disk_type(self):
        drive = Drive(self.log, diskType=DISK_TYPE.FILE, **self.conf)

        with self.assertRaises(exception.UnsupportedOperation):
            drive.get_snapshot_xml({"path": "/foo", "diskType": "bad"})
예제 #12
0
    def test_incorrect_disk_type(self):
        drive = Drive(self.log, diskType=DISK_TYPE.FILE, **self.conf)

        with pytest.raises(exception.UnsupportedOperation):
            drive.get_snapshot_xml({"path": "/foo", "diskType": "bad"})
예제 #13
0
    def test_incorrect_disk_type(self):
        drive = Drive(self.log, **self.conf)

        with self.assertRaises(exception.UnsupportedOperation):
            drive.get_snapshot_xml({"path": "/foo", "diskType": "bad"})