|
32 | 32 | from marvin.lib.common import (get_zone, |
33 | 33 | get_template, |
34 | 34 | get_test_template, |
35 | | - get_builtin_template_info, |
36 | 35 | get_domain) |
37 | 36 | from nose.plugins.attrib import attr |
38 | 37 | from marvin.sshClient import SshClient |
@@ -665,42 +664,44 @@ def test_05_scale_vm_dont_allow_disk_offering_change(self): |
665 | 664 | # update setting allow.diskOffering.change.during.scale.vm to true |
666 | 665 | # scale up the VM to serviceoffering3 |
667 | 666 | # Check disk offering of root volume to be diskoffering3 since setting allow.diskOffering.change.during.scale.vm is true |
| 667 | + template = self.template |
| 668 | + if self.hypervisor.lower() in ['xenserver']: |
| 669 | + test_template = get_test_template(self.apiclient, self.zone.id, self.hypervisor) |
| 670 | + self.services["template_2"]["url"] = test_template["url"] |
| 671 | + self.services["template_2"]["hypervisor"] = test_template["hypervisor"] |
| 672 | + self.services["template_2"]["format"] = test_template["format"] |
| 673 | + self.services["template_2"]["ostype"] = "CentOS 5.6 (64-bit)" |
668 | 674 |
|
669 | | - builtin_info = get_builtin_template_info(self.apiclient, self.zone.id) |
670 | | - self.services["template_2"]["url"] = builtin_info[0] |
671 | | - self.services["template_2"]["hypervisor"] = builtin_info[1] |
672 | | - self.services["template_2"]["format"] = builtin_info[2] |
| 675 | + try: |
| 676 | + template = Template.register(self.apiclient, |
| 677 | + self.services["template_2"], |
| 678 | + zoneid=self.zone.id, |
| 679 | + account=self.account.name, |
| 680 | + domainid=self.account.domainid, |
| 681 | + hypervisor=self.hypervisor |
| 682 | + ) |
| 683 | + |
| 684 | + template.download(self.apiclient) |
| 685 | + except Exception as e: |
| 686 | + self.fail("Failed to register template: %s" % e) |
673 | 687 |
|
674 | | - try: |
675 | | - template = Template.register(self.apiclient, |
676 | | - self.services["template_2"], |
677 | | - zoneid=self.zone.id, |
678 | | - account=self.account.name, |
679 | | - domainid=self.account.domainid, |
680 | | - hypervisor=self.hypervisor |
681 | | - ) |
682 | | - |
683 | | - template.download(self.apiclient) |
684 | | - except Exception as e: |
685 | | - self.fail("Failed to register template: %s" % e) |
| 688 | + time.sleep(120) |
686 | 689 |
|
687 | | - time.sleep(120) |
| 690 | + template = Template.update( |
| 691 | + template, |
| 692 | + self.apiclient, |
| 693 | + isdynamicallyscalable='true' |
| 694 | + ) |
688 | 695 |
|
689 | | - template = Template.update( |
690 | | - template, |
691 | | - self.apiclient, |
692 | | - isdynamicallyscalable='true' |
693 | | - ) |
| 696 | + templates = Template.list(self.apiclient, |
| 697 | + templatefilter= \ |
| 698 | + self.services["template_2"]["templatefilter"], |
| 699 | + id=template.id, |
| 700 | + ) |
694 | 701 |
|
695 | | - templates = Template.list(self.apiclient, |
696 | | - templatefilter= \ |
697 | | - self.services["template_2"]["templatefilter"], |
698 | | - id=template.id, |
699 | | - ) |
| 702 | + template = templates[0] |
700 | 703 |
|
701 | | - template = templates[0] |
702 | 704 | disk_offering = self.services["disk_offering"] |
703 | | - disk_offering["disksize"] = 25 |
704 | 705 | disk_offering["name"] = "Disk Offering 1" |
705 | 706 | self.disk_offering1 = DiskOffering.create( |
706 | 707 | self.apiclient, |
@@ -770,7 +771,7 @@ def test_05_scale_vm_dont_allow_disk_offering_change(self): |
770 | 771 | disk_offering2["name"] = "Disk Offering 2" |
771 | 772 | self.disk_offering2 = DiskOffering.create( |
772 | 773 | self.apiclient, |
773 | | - disk_offering2, |
| 774 | + disk_offering2 |
774 | 775 | ) |
775 | 776 | self._cleanup.append(self.disk_offering2) |
776 | 777 | offering_data = { |
@@ -934,7 +935,6 @@ def test_05_scale_vm_dont_allow_disk_offering_change(self): |
934 | 935 | listall=True |
935 | 936 | )[0] |
936 | 937 |
|
937 | | - self.debug("After scaling 3: Volume disk offering %s and disk offering 3: %s" % (volume_response.diskofferingid, self.disk_offering3.id)) |
938 | 938 | self.assertEqual( |
939 | 939 | volume_response.diskofferingid, |
940 | 940 | self.disk_offering3.id, |
|
0 commit comments