當前位置: 首頁>>代碼示例>>Python>>正文


Python Iso.extract方法代碼示例

本文整理匯總了Python中marvin.lib.base.Iso.extract方法的典型用法代碼示例。如果您正苦於以下問題:Python Iso.extract方法的具體用法?Python Iso.extract怎麽用?Python Iso.extract使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在marvin.lib.base.Iso的用法示例。


在下文中一共展示了Iso.extract方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_02_download_iso

# 需要導入模塊: from marvin.lib.base import Iso [as 別名]
# 或者: from marvin.lib.base.Iso import extract [as 別名]
    def test_02_download_iso(self):
        """
        @Desc: Test to Download ISO
        @steps:
        Step1: Listing all the ISO's for a user
        Step2: Verifying that no ISO's are listed
        Step3: Creating an ISO
        Step4: Listing all the ISO's again for a user
        Step5: Verifying that list size is 1
        Step6: Verifying if the ISO is in ready state.
                If yes the continuing
                If not waiting and checking for template to be ready till timeout
        Step7: Downloading the ISO (Extract)
        Step8: Verifying the details of downloaded ISO
        """
        # Listing all the ISO's for a User
        list_iso_before = Iso.list(
                                   self.userapiclient,
                                   listall=self.services["listall"],
                                   isofilter=self.services["templatefilter"]
                                   )
        # Verifying that no ISOs are listed
        self.assertIsNone(
                          list_iso_before,
                          "ISOs listed for newly created User"
                          )
        self.services["iso"]["zoneid"] = self.zone.id
        self.services["iso"]["isextractable"] = True
        # Creating an ISO's
        iso_created = Iso.create(
                                 self.userapiclient,
                                 self.services["iso"]
                                 )
        self.assertIsNotNone(
                             iso_created,
                             "ISO creation failed"
                             )
        self.cleanup.append(iso_created)
        # Listing all the ISO's for a User
        list_iso_after = Iso.list(
                                  self.userapiclient,
                                  listall=self.services["listall"],
                                  isofilter=self.services["templatefilter"]
                                  )
        status = validateList(list_iso_after)
        self.assertEquals(
                          PASS,
                          status[0],
                          "ISO's creation failed"
                          )
        # Verifying that list size is 1
        self.assertEquals(
                          1,
                          len(list_iso_after),
                          "Failed to create an ISO's"
                          )
        # Verifying the state of the ISO to be ready. If not waiting for state to become ready
        iso_ready = False
        count = 0
        while iso_ready is False:
            list_iso = Iso.list(
                                self.userapiclient,
                                listall=self.services["listall"],
                                isofilter=self.services["templatefilter"],
                                id=iso_created.id
                                )
            status = validateList(list_iso)
            self.assertEquals(
                              PASS,
                              status[0],
                              "Failed to list ISO by Id"
                              )
            if list_iso[0].isready is True:
                iso_ready = True
            elif (str(list_iso[0].status) == "Error"):
                self.fail("Created ISO is in Errored state")
                break
            elif count > 10:
                self.fail("Timed out before ISO came into ready state")
                break
            else:
                time.sleep(self.services["sleep"])
                count = count + 1

        # Downloading the ISO
        download_iso = Iso.extract(
                                   self.userapiclient,
                                   iso_created.id,
                                   mode="HTTP_DOWNLOAD",
                                   zoneid=self.zone.id
                                   )
        self.assertIsNotNone(
                             download_iso,
                             "Download ISO failed"
                             )
         # Verifying the details of downloaded ISO
        self.assertEquals(
                          "DOWNLOAD_URL_CREATED",
                          download_iso.state,
                          "Download URL not created for ISO"
#.........這裏部分代碼省略.........
開發者ID:fengyueyugu,項目名稱:cloudstack,代碼行數:103,代碼來源:test_escalations_isos.py


注:本文中的marvin.lib.base.Iso.extract方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。