예제 #1
0
    def test_no_leases(self):
        """
        without leases, do nothing
        """
        # any VM without leases is fine
        xml_str = read_data('vm_compat41.xml')
        self.assertXMLEqual(
            extract_device_snippet('lease', xml_str=xml_str),
            u'''<?xml version='1.0' encoding='utf-8'?><devices />'''
        )

        dom = xmlutils.fromstring(xml_str)
        disk_devs = domxml_preprocess._make_disk_devices(
            xml_str, self.log)
        disk_devs = self._inject_volume_chain(
            disk_devs, self.driveVolInfo,
            domainID='unknwonDomainID',
            volumeID='unknownVolumeID')

        domxml_preprocess.update_leases_xml_from_disk_objs(
            self.vm, dom, disk_devs)

        self.assertXMLEqual(
            extract_device_snippet('lease', dom=dom),
            u'''<?xml version='1.0' encoding='utf-8'?><devices />'''
        )
예제 #2
0
    def test_no_leases(self):
        """
        without leases, do nothing
        """
        # any VM without leases is fine
        xml_str = read_data('vm_compat41.xml')
        self.assertXMLEqual(
            extract_device_snippet('lease', xml_str=xml_str),
            u'''<?xml version='1.0' encoding='utf-8'?><devices />'''
        )

        dom = xmlutils.fromstring(xml_str)
        disk_devs = domxml_preprocess._make_disk_devices(
            xml_str, self.log)
        disk_devs = self._inject_volume_chain(
            disk_devs, self.driveVolInfo,
            domainID='unknwonDomainID',
            volumeID='unknownVolumeID')

        domxml_preprocess.update_leases_xml_from_disk_objs(
            self.vm, dom, disk_devs)

        self.assertXMLEqual(
            extract_device_snippet('lease', dom=dom),
            u'''<?xml version='1.0' encoding='utf-8'?><devices />'''
        )
예제 #3
0
    def setUp(self):
        self.vm = FakeVM(self.log)
        self.cif = fake.ClientIF()
        self.xml_str = read_data('hostedengine_lease.xml')
        self.dom = xmlutils.fromstring(self.xml_str)
        self.disk_devs = domxml_preprocess._make_disk_devices(
            self.xml_str, self.log)

        self.driveVolInfo = {
            'leasePath': '/fake/drive/lease/path',
            'leaseOffset': 42,
        }
        self.vmVolInfo = {
            # from XML
            'leasePath': 'LEASE-PATH:'
                         '9eaa286e-37d6-429e-a46b-63bec1dd4868:'
                         '4f0a775f-ed16-4832-ab9f-f0427f33ab92',
            'leaseOffset': 'LEASE-OFFSET:'
                           '9eaa286e-37d6-429e-a46b-63bec1dd4868:'
                           '4f0a775f-ed16-4832-ab9f-f0427f33ab92',
        }
예제 #4
0
    def setUp(self):
        self.vm = FakeVM(self.log)
        self.cif = fake.ClientIF()
        self.xml_str = read_data('hostedengine_lease.xml')
        self.dom = xmlutils.fromstring(self.xml_str)
        self.disk_devs = domxml_preprocess._make_disk_devices(
            self.xml_str, self.log)

        self.driveVolInfo = {
            'leasePath': '/fake/drive/lease/path',
            'leaseOffset': 42,
        }
        self.vmVolInfo = {
            # from XML
            'leasePath': 'LEASE-PATH:'
                         '9eaa286e-37d6-429e-a46b-63bec1dd4868:'
                         '4f0a775f-ed16-4832-ab9f-f0427f33ab92',
            'leaseOffset': 'LEASE-OFFSET:'
                           '9eaa286e-37d6-429e-a46b-63bec1dd4868:'
                           '4f0a775f-ed16-4832-ab9f-f0427f33ab92',
        }