def testName(self):
     self.mount()
     cmd = nfs_primarystorage_plugin.DownloadImageToCacheFromSftpBackupStorageCmd(
     )
     p = os.path.expanduser('~/.ssh/id_rsa')
     with open(p, 'r') as fd:
         sshkey = fd.read()
         cmd.installUrl = '/tmp/test.qcow2'
         cmd.sftpBackupStorageHostName = "root@localhost"
         cmd.sftpBackupStorageSshKey = sshkey
         cmd.templatePath = '/home/root/test.qcow2'
         cmd.timeout = 300
         url = aliyunagent._build_url_for_test([
             nfs_primarystorage_plugin.
             DOWNLOAD_IMAGE_FROM_SFTP_BACKUP_STORAGE_PATH
         ])
         rsp = http.json_dump_post(url,
                                   cmd,
                                   headers={
                                       http.TASK_UUID: uuidhelper.uuid(),
                                       http.CALLBACK_URI: self.CALLBACK_URL
                                   })
         time.sleep(10)
         self.service.stop()
         linux.umount_by_url(self.NFS_URL)
 def testName(self):
     self.mount()
     cmd = nfs_primarystorage_plugin.GetCapacityCmd()
     url = kvmagent._build_url_for_test([nfs_primarystorage_plugin.GET_CAPACITY_PATH])
     rsp = http.json_dump_post(url, cmd, headers={http.TASK_UUID:uuidhelper.uuid(), http.CALLBACK_URI:self.CALLBACK_URL})
     time.sleep(5)
     self.service.stop()
     linux.umount_by_url(self.NFS_URL)
 def testName(self):
     self.mount()
     cmd = nfs_primarystorage_plugin.CreateRootVolumeFromTemplateCmd()
     cmd.installUrl = '/tmp/test1.qcow2'
     cmd.templatePathInCache = "/tmp/test.qcow2"
     cmd.timeout = 30
     
     url = kvmagent._build_url_for_test([nfs_primarystorage_plugin.CREATE_VOLUME_FROM_TEMPLATE_PATH])
     rsp = http.json_dump_post(url, cmd, headers={http.TASK_UUID:uuidhelper.uuid(), http.CALLBACK_URI:self.CALLBACK_URL})
     time.sleep(10)
     self.service.stop()
     linux.umount_by_url(self.NFS_URL)
 def testName(self):
     self.mount()
     cmd = nfs_primarystorage_plugin.CreateEmptyVolumeCmd()
     cmd.accountUuid = uuidhelper.uuid()
     cmd.hypervisorType = 'KVM'
     cmd.installUrl = '/tmp/emptyvolume.qcow2'
     cmd.name = 'testEmptyVolume'
     cmd.size = '1410400256'
     cmd.uuid = uuidhelper.uuid()
     url = aliyunagent._build_url_for_test([nfs_primarystorage_plugin.CREATE_EMPTY_VOLUME_PATH])
     rsp = http.json_dump_post(url, cmd, headers={http.TASK_UUID:uuidhelper.uuid(), http.CALLBACK_URI:self.CALLBACK_URL})
     time.sleep(5)
     self.service.stop()
     linux.umount_by_url(self.NFS_URL)
 def testName(self):
     self.mount()
     cmd = nfs_primarystorage_plugin.CreateEmptyVolumeCmd()
     cmd.accountUuid = uuidhelper.uuid()
     cmd.hypervisorType = 'KVM'
     cmd.installUrl = '/tmp/emptyvolume.qcow2'
     cmd.name = 'testEmptyVolume'
     cmd.size = '1410400256'
     cmd.uuid = uuidhelper.uuid()
     url = kvmagent._build_url_for_test([nfs_primarystorage_plugin.CREATE_EMPTY_VOLUME_PATH])
     rsp = http.json_dump_post(url, cmd, headers={http.TASK_UUID:uuidhelper.uuid(), http.CALLBACK_URI:self.CALLBACK_URL})
     time.sleep(5)
     self.service.stop()
     linux.umount_by_url(self.NFS_URL)
 def testName(self):
     self.mount()
     cmd = nfs_primarystorage_plugin.DownloadImageToCacheFromSftpBackupStorageCmd()
     p = os.path.expanduser('~/.ssh/id_rsa')
     with open(p, 'r') as fd:
         sshkey = fd.read()
         cmd.installUrl = '/tmp/test.qcow2'
         cmd.sftpBackupStorageHostName = "root@localhost"
         cmd.sftpBackupStorageSshKey = sshkey
         cmd.templatePath = '/home/root/test.qcow2'
         cmd.timeout = 300
         url = kvmagent._build_url_for_test([nfs_primarystorage_plugin.DOWNLOAD_IMAGE_FROM_SFTP_BACKUP_STORAGE_PATH])
         rsp = http.json_dump_post(url, cmd, headers={http.TASK_UUID:uuidhelper.uuid(), http.CALLBACK_URI:self.CALLBACK_URL})
         time.sleep(10)
         self.service.stop()
         linux.umount_by_url(self.NFS_URL)
    def testName(self):
        self.mount()
        cmd = nfs_primarystorage_plugin.CreateRootVolumeFromTemplateCmd()
        cmd.installUrl = '/tmp/test1.qcow2'
        cmd.templatePathInCache = "/tmp/test.qcow2"
        cmd.timeout = 30

        url = aliyunagent._build_url_for_test(
            [nfs_primarystorage_plugin.CREATE_VOLUME_FROM_TEMPLATE_PATH])
        rsp = http.json_dump_post(url,
                                  cmd,
                                  headers={
                                      http.TASK_UUID: uuidhelper.uuid(),
                                      http.CALLBACK_URI: self.CALLBACK_URL
                                  })
        time.sleep(10)
        self.service.stop()
        linux.umount_by_url(self.NFS_URL)
 def _unmount_all(self):
     linux.umount_by_url(NFS_URL)
 def _unmount_all(self):
     linux.umount_by_url(NFS_URL)