コード例 #1
0
 def setUp(self):
     self.dm = super(self.__class__, self).setUp()
     self.diskapi = DiskAPIs()
     #创建一个虚拟机
     LogPrint().info("Pre-Test-1: Create vm %s for TC."% self.dm.vm_name)
     self.assertTrue(smart_create_vm(self.dm.vm_name, self.dm.vm_info)) 
          
     #创建一块磁盘
     '''
     @note: 创建磁盘时,磁盘的sharable属性必须为false,因为共享磁盘不作为模板的一部份
     '''
     LogPrint().info("Pre-Test-2: Create a disk for TC.")
     r= smart_create_disk(self.dm.disk_info, self.dm.disk_name)
     self.assertTrue(r[0])
     self.disk_id = r[1]   
     #将该磁盘附加到虚拟机
     LogPrint().info("Pre-Test-3: Attach disk %s to vm %s for TC."% (self.dm.disk_name
                                                              ,self.dm.vm_name))
     self.vmdiskapi = VmDiskAPIs()
     r=self.vmdiskapi.attachDiskToVm(self.dm.vm_name, self.disk_id)
     if r['status_code'] == 200:
         LogPrint().info("Attach Disk to vm success.")
     else:
         LogPrint().error("Attach Disk to vm fail.Status-code is wrong.")
         self.assertTrue(False)
     #启动虚拟机
     LogPrint().info("Pre-Test-4: Start vm for TC.")
     self.assertTrue(smart_start_vm(self.dm.vm_name))
     #激活磁盘
     LogPrint().info("Pre-Test-5: Active vmdisk for TC.")
     self.assertTrue(smart_active_vmdisk(self.dm.vm_name,self.disk_id))
コード例 #2
0
 def setUp(self):
     '''
     @summary: 测试用例执行前的环境初始化(前提)
     '''
     self.dm = super(self.__class__, self).setUp()
     #首先新建一个磁盘并获取id
     LogPrint().info("Pre-Test-1: Create Disk %s for TC."% self.dm.disk_name)
     r = smart_create_disk(self.dm.disk_info,self.dm.disk_name)
     self.disk_id = r[1]
     self.assertTrue(r[0])
コード例 #3
0
    def setUp(self):
        """
        @summary: 初始化测试数据、测试环境。
        """
        # 初始化测试数据
        self.dm = super(self.__class__, self).setUp()

        # 前提1:在存储域中创建一个磁盘
        LogPrint().info("Pre-Test: Create disk '%s' for this TC." % self.dm.disk_name)
        r = smart_create_disk(self.dm.xml_disk_info, self.dm.disk_name)
        self.assertTrue(r[0])
        self.disk_id = r[1]
コード例 #4
0
 def setUp(self):
     '''
     @summary: 初始化测试数据、测试环境。
     '''
     # 初始化测试数据
     self.dm = super(self.__class__, self).setUp()
     
     # 前提1:在Active状态的存储域中创建一个磁盘
     LogPrint().info("Pre-Test: Create disk '%s' in the active data storage '%s'." % (self.dm.disk_name, self.dm.data1_name))
     r = smart_create_disk(self.dm.xml_disk_info, disk_alias=self.dm.disk_name)
     self.assertTrue(r[0])
     self.disk_id = r[1]
コード例 #5
0
 def setUp(self):
     '''
     @summary: 初始化测试数据、测试环境。
     '''
     # 初始化测试数据
     self.dm = super(self.__class__, self).setUp()
     
     # 前提1:在Data存储域中创建一个磁盘
     LogPrint().info("Pre-Test: Create disk '%s' in data storage for this TC." % self.dm.disk_name)
     r = smart_create_disk(self.dm.xml_disk_info)
     self.assertTrue(r[0])
     self.disk_id = r[1]
コード例 #6
0
    def setUp(self):
        '''
        @summary: 初始化测试数据、测试环境。
        '''
        # 初始化测试数据
        self.dm = super(self.__class__, self).setUp()

        # 前提1:在存储域中创建一个磁盘
        LogPrint().info("Pre-Test: Create disk '%s' for this TC." %
                        self.dm.disk_name)
        r = smart_create_disk(self.dm.xml_disk_info, self.dm.disk_name)
        self.assertTrue(r[0])
        self.disk_id = r[1]
コード例 #7
0
    def setUp(self):
        '''
        @summary: 初始化测试数据、测试环境。
        '''
        # 初始化测试数据
        self.dm = super(self.__class__, self).setUp()

        # 前提1:在Active状态的存储域中创建一个磁盘
        LogPrint().info(
            "Pre-Test: Create disk '%s' in the active data storage '%s'." %
            (self.dm.disk_name, self.dm.data1_name))
        r = smart_create_disk(self.dm.xml_disk_info,
                              disk_alias=self.dm.disk_name)
        self.assertTrue(r[0])
        self.disk_id = r[1]
コード例 #8
0
 def setUp(self):
     self.dm = super(self.__class__, self).setUp()
     #创建一个虚拟机
     LogPrint().info("Pre-Test-1: Create vm %s for TC."% self.dm.vm_name)
     self.assertTrue(smart_create_vm(self.dm.vm_name, self.dm.vm_info))    
     #创建一块磁盘
     '''
     @note: 创建磁盘时,磁盘的sharable属性必须为false,因为共享磁盘不作为模板的一部份
     '''
     LogPrint().info("Pre-Test-2: Create a disk for TC.")
     r= smart_create_disk(self.dm.disk_info, self.dm.disk_name)
     self.assertTrue(r[0])
     self.disk_id = r[1]    
     #将该磁盘附加到虚拟机上
     LogPrint().info("Pre-Test-3: Attach disk %s to vm %s for TC."% (self.dm.disk_name
                                                              ,self.dm.vm_name))
     self.vmdiskapi = VmDiskAPIs()
     r=self.vmdiskapi.attachDiskToVm(self.dm.vm_name, self.disk_id)
     if r['status_code'] == 200:
         LogPrint().info("Attach Disk to vm success.")
     else:
         LogPrint().error("Attach Disk to vm fail.Status-code is wrong.")
         self.assertTrue(False)    
     #该虚拟机创建模板   
     LogPrint().info("Pre-Test-4: Create template for vm %s for TC."% self.dm.vm_name)
     self.tempapi = TemplatesAPIs()
     self.vm_id = VirtualMachineAPIs().getVmIdByName(self.dm.vm_name)
     r = self.tempapi.createTemplate(self.dm.temp_info, self.vm_id)
     def is_temp_ok():
         return self.tempapi.getTemplateInfo(temp_name=self.dm.temp_name)['result']['template']['status']['state']=='ok'
     if r['status_code'] == 202:
         if wait_until(is_temp_ok, 600, 10):
             LogPrint().info("Create Template ok.")
         else:
             LogPrint().error("Create Template overtime")
             self.assertTrue(False)
     else:
         LogPrint().error("Create Template failed.Status-code is wrong.")
         self.assertTrue(False)
     #获得模板关联的磁盘id
     r = TemplateDisksAPIs().getTemplateDiskInfo(self.dm.temp_name, self.dm.disk_name) 
     if r['status_code'] == 200:
         self.disk_id_temp = r['result']['disk']['@id']
     else:
         self.assertTrue(False)
コード例 #9
0
 def setUp(self):
     self.dm = super(self.__class__, self).setUp()
     LogPrint().info("Pre-Test: Create a disk for TC.")
     r=smart_create_disk(self.dm.disk_info)
     self.disk_id = r[1]
     self.assertTrue(r[0])
コード例 #10
0
 def setUp(self):
     self.dm = super(self.__class__, self).setUp()
     LogPrint().info("Pre-Test-1: Create disk %s for TC."% self.dm.disk_name)
     r = smart_create_disk(self.dm.disk_info, self.dm.disk_name)
     self.disk_id = r[1]
     self.assertTrue(r[0])