• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python uuidhelper.uuid函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中zstacklib.utils.uuidhelper.uuid函数的典型用法代码示例。如果您正苦于以下问题:Python uuid函数的具体用法?Python uuid怎么用?Python uuid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了uuid函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: testName

 def testName(self):
     server = sftpbackupstorage.SftpBackupStorageAgent()
     server.http_server.register_sync_uri('/testcallback', self.callback)
     
     server.http_server.start_in_thread()
     time.sleep(2)
     cmd = sftpbackupstorage.ConnectCmd()
     cmd.storagePath = "/tmp"
     #url = sftpbackupstorage._build_url_for_test([sftpbackupstorage.SftpBackupStorageAgent.CONNECT_PATH])
     url = 'http://localhost:7171%s' % sftpbackupstorage.SftpBackupStorageAgent.CONNECT_PATH
     print url
     rsp = http.json_dump_post(url, cmd)
     
     cmd = sftpbackupstorage.DownloadCmd()
     cmd.accountUuid = uuidhelper.uuid()
     cmd.bits = 64
     cmd.description = "Test"
     cmd.format = sftpbackupstorage.SftpBackupStorageAgent.IMAGE_TEMPLATE
     cmd.guestOsType = "rpm"
     cmd.hypervisorType = "KVM"
     cmd.imageUuid = uuidhelper.uuid()
     cmd.name = "test"
     cmd.timeout = 60
     cmd.url = "http://yum.puppetlabs.com/el/6/products/i386/puppetlabs-release-6-6.noarch.rpm"
     cmd.urlScheme = "http"
     url = 'http://localhost:7171%s' % sftpbackupstorage.SftpBackupStorageAgent.DOWNLOAD_IMAGE_PATH
     print url
     rsp = http.json_dump_post(url, cmd, headers={http.TASK_UUID:uuidhelper.uuid(), http.CALLBACK_URI:self.CALLBACK_URL})
     print "post back"
     time.sleep(20)
     
     server.http_server.stop()
开发者ID:QiRaining,项目名称:zstack-utility,代码行数:32,代码来源:test_download.py


示例2: testName

 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)
开发者ID:QiRaining,项目名称:zstack-utility,代码行数:14,代码来源:test_nfs_primary_storage_create_empty_volume.py


示例3: from_file

        def from_file(tokens):
            file_path = tokens[1]
            file_path = os.path.abspath(file_path)
            if not os.path.exists(file_path):
                self.print_error('cannot find file %s' % file_path)
                return
            
            with open(file_path, 'r') as fd:
                text = fd.read()
                
                path, json_str = text.split('>>', 1)
                path = path.strip(' \t\n\r')
                json_str = json_str.strip(' \t\n\r')

            args = {}
            if len(tokens) > 2:
                for token in tokens[2:]:
                    k, v = token.split('=', 1)
                    args[k] = v
            
            tmp = string.Template(json_str)
            json_str = tmp.substitute(args)
            url = 'http://%s:%s/%s/' % (self.agent_ip, self.agent_port, path)
            callback_url = 'http://%s:%s/%s/' % (self.cip, 10086, 'result')
            rsp = http.json_post(url, json_str, headers={http.TASK_UUID:uuidhelper.uuid(), http.CALLBACK_URI:callback_url})
            print rsp
开发者ID:QiRaining,项目名称:zstack-utility,代码行数:26,代码来源:cli.py


示例4: offline_merge_snapshots

    def offline_merge_snapshots(self, req):
        cmd = jsonobject.loads(req[http.REQUEST_BODY])
        rsp = OfflineMergeSnapshotRsp()
        src_abs_path = translate_absolute_path_from_install_path(cmd.srcPath)
        dst_abs_path = translate_absolute_path_from_install_path(cmd.destPath)

        with lvm.RecursiveOperateLv(src_abs_path, shared=True):
            virtual_size = linux.qcow2_virtualsize(src_abs_path)
            if not lvm.lv_exists(dst_abs_path):
                lvm.create_lv_from_absolute_path(dst_abs_path, virtual_size,
                                                 "%s::%s::%s" % (VOLUME_TAG, cmd.hostUuid, time.time()))
            with lvm.RecursiveOperateLv(dst_abs_path, shared=False):
                if not cmd.fullRebase:
                    linux.qcow2_rebase(src_abs_path, dst_abs_path)
                else:
                    tmp_lv = 'tmp_%s' % uuidhelper.uuid()
                    tmp_abs_path = os.path.join(os.path.dirname(dst_abs_path), tmp_lv)
                    tmp_abs_path = os.path.join(os.path.dirname(dst_abs_path), tmp_lv)
                    logger.debug("creating temp lv %s" % tmp_abs_path)
                    lvm.create_lv_from_absolute_path(tmp_abs_path, virtual_size,
                                                     "%s::%s::%s" % (VOLUME_TAG, cmd.hostUuid, time.time()))
                    with lvm.OperateLv(tmp_abs_path, shared=False, delete_when_exception=True):
                        linux.create_template(dst_abs_path, tmp_abs_path)
                        lvm.lv_rename(tmp_abs_path, dst_abs_path, overwrite=True)

        rsp.totalCapacity, rsp.availableCapacity = lvm.get_vg_size(cmd.vgUuid)
        return jsonobject.dumps(rsp)
开发者ID:zstackorg,项目名称:zstack-utility,代码行数:27,代码来源:shared_block_plugin.py


示例5: test_mount_failure

 def test_mount_failure(self):
     cmd = nfs_primarystorage_plugin.MountCmd()
     cmd.url = 'this_is_a_wrong_path'
     cmd.mountPath = os.path.join('/mnt', uuidhelper.uuid())
     callurl = kvmagent._build_url_for_test([nfs_primarystorage_plugin.MOUNT_PATH])
     ret = http.json_dump_post(callurl, cmd)
     rsp = jsonobject.loads(ret)
     self.assertFalse(rsp.success, rsp.error)
开发者ID:ShaofeiWang,项目名称:zstack-utility,代码行数:8,代码来源:test_nfs_primarystorage_plugin.py


示例6: testName

 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)
开发者ID:QiRaining,项目名称:zstack-utility,代码行数:8,代码来源:test_nfs_primary_storage_get_capacity.py


示例7: testName

 def testName(self):
     url = kvmagent._build_url_for_test([network_plugin.KVM_REALIZE_L2NOVLAN_NETWORK_PATH])
     logger.debug('calling %s' % url)
     cmd = network_plugin.CreateBridgeCmd()
     cmd.physicalInterfaceName = 'eth0'
     cmd.bridgeName = 'br_eth0'
     rsp = http.json_dump_post(url, cmd, headers={http.TASK_UUID:uuidhelper.uuid(), http.CALLBACK_URI:self.CALLBACK_URL})
     time.sleep(2)
     self.service.stop()
开发者ID:QiRaining,项目名称:zstack-utility,代码行数:9,代码来源:test_network_plugin_create_bridge.py


示例8: mount

 def mount(self):
     cmd = nfs_primarystorage_plugin.MountCmd()
     cmd.url = self.NFS_URL
     cmd.mountPath = os.path.join('/mnt', uuidhelper.uuid())
     callurl = kvmagent._build_url_for_test([nfs_primarystorage_plugin.MOUNT_PATH])
     ret = http.json_dump_post(callurl, cmd)
     rsp = jsonobject.loads(ret)
     self.assertTrue(rsp.success, rsp.error)
     self.assertTrue(linux.is_mounted(cmd.url, cmd.mountPath))
开发者ID:QiRaining,项目名称:zstack-utility,代码行数:9,代码来源:test_nfs_primary_storage_get_capacity.py


示例9: callback

 def callback(self, req):
     rsp = jsonobject.loads(req[http.REQUEST_BODY])
     print jsonobject.dumps(rsp)
     
     cmd = vm_plugin.RebootVmCmd()
     cmd.uuid = self.uuid
     cmd.timeout = 30
     url = kvmagent._build_url_for_test([vm_plugin.KVM_REBOOT_VM_PATH])
     rsp = http.json_dump_post(url, cmd, headers={http.TASK_UUID:uuidhelper.uuid(), http.CALLBACK_URI:self.CALLBACK_URL2})
开发者ID:QiRaining,项目名称:zstack-utility,代码行数:9,代码来源:test_vm_plugin_reboot_vm.py


示例10: testName

 def testName(self):
     url = kvmagent._build_url_for_test([virtualrouter_plugin.VirtualRouterPlugin.VR_KVM_CREATE_BOOTSTRAP_ISO_PATH])
     info = virtualrouter_plugin.BootstrapIsoInfo()
     info.managementNicGateway = "192.168.1.1"
     info.managementNicIp = "192.168.1.10"
     info.managementNicMac = "50:E5:49:C9:65:A3"
     info.managementNicNetmask = "255.255.255.0"
     cmd = virtualrouter_plugin.CreateVritualRouterBootstrapIsoCmd()
     cmd.isoInfo = info
     cmd.isoPath = '/tmp/vr.iso'
     rsp = http.json_dump_post(url, cmd, headers={http.TASK_UUID:uuidhelper.uuid(), http.CALLBACK_URI:self.CALLBACK_URL})
     time.sleep(2)
     cmd = virtualrouter_plugin.DeleteVirtualRouterBootstrapIsoCmd()
     cmd.isoPath = '/tmp/vr.iso'
     url = kvmagent._build_url_for_test([virtualrouter_plugin.VirtualRouterPlugin.VR_KVM_DELETE_BOOTSTRAP_ISO_PATH])
     rsp = http.json_dump_post(url, cmd, headers={http.TASK_UUID:uuidhelper.uuid(), http.CALLBACK_URI:self.CALLBACK_URL})
     time.sleep(2)
     self.service.stop()
开发者ID:QiRaining,项目名称:zstack-utility,代码行数:18,代码来源:test_vr_delete_iso.py


示例11: testName

 def testName(self):
     cmd = vm_plugin.StartVmCmd()
     cmd.vmName = 'test'
     cmd.vmUuid = uuidhelper.uuid()
     cmd.cpuNum = 2
     cmd.cpuSpeed = 3000
     cmd.memory = 3221225472
     cmd.rootVolumePath = '/home/root/images/volumes/kvmubuntu.img'
     cmd.bootDev = 'hd'
     cmd.timeout = 30
     nic = vm_plugin.NicTO()
     nic.mac = 'fa:33:f8:5f:00:00'
     nic.bridgeName = 'virbr0'
     nic.deviceId = 0
     cmd.nics.append(nic)
     print 'xxxxxxxxxxxxxxxxxxx %s' % cmd.vmUuid
     url = kvmagent._build_url_for_test([vm_plugin.KVM_START_VM_PATH])
     rsp = http.json_dump_post(url, cmd, headers={http.TASK_UUID:uuidhelper.uuid(), http.CALLBACK_URI:self.CALLBACK_URL})
     time.sleep(30)
     self.service.stop()
开发者ID:ShaofeiWang,项目名称:zstack-utility,代码行数:20,代码来源:test_vm_plugin_start_vm.py


示例12: offline_merge_snapshot

    def offline_merge_snapshot(self, req):
        cmd = jsonobject.loads(req[http.REQUEST_BODY])
        rsp = AgentResponse()
        if not cmd.fullRebase:
            linux.qcow2_rebase(cmd.srcPath, cmd.destPath)
        else:
            tmp = os.path.join(os.path.dirname(cmd.destPath), '%s.qcow2' % uuidhelper.uuid())
            linux.qcow2_create_template(cmd.destPath, tmp)
            shell.call("mv %s %s" % (tmp, cmd.destPath))

        return jsonobject.dumps(rsp)
开发者ID:zeus911,项目名称:zstack-utility,代码行数:11,代码来源:localstorage.py


示例13: merge_snapshot_to_volume

    def merge_snapshot_to_volume(self, req):
        cmd = jsonobject.loads(req[http.REQUEST_BODY])
        rsp = OfflineMergeSnapshotRsp()
        if not cmd.fullRebase:
            linux.qcow2_rebase(cmd.srcPath, cmd.destPath)
        else:
            tmp = os.path.join(os.path.dirname(cmd.destPath), '%s.qcow2' % uuidhelper.uuid())
            linux.qcow2_create_template(cmd.destPath, tmp)
            shell.call("mv %s %s" % (tmp, cmd.destPath))

        self._set_capacity_to_response(cmd.uuid, rsp)
        return jsonobject.dumps(rsp)
开发者ID:rynetang,项目名称:zstack-utility,代码行数:12,代码来源:nfs_primarystorage_plugin.py


示例14: testName

 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)
开发者ID:QiRaining,项目名称:zstack-utility,代码行数:12,代码来源:test_nfs_primary_storage_create_root_volume.py


示例15: offlinemerge

    def offlinemerge(self, req):
        cmd = jsonobject.loads(req[http.REQUEST_BODY])
        rsp = AliyunNasResponse()
        if not cmd.fullRebase:
            linux.qcow2_rebase(cmd.srcPath, cmd.destPath)
        else:
            tmp = os.path.join(os.path.dirname(cmd.destPath), '%s.qcow2' % uuidhelper.uuid())
            linux.create_template(cmd.destPath, tmp)
            shell.call("mv %s %s" % (tmp, cmd.destPath))

        rsp.totalCapacity, rsp.availableCapacity = self._get_disk_capacity(cmd.uuid)
        return jsonobject.dumps(rsp)
开发者ID:zstackorg,项目名称:zstack-utility,代码行数:12,代码来源:aliyun_nas_plugin.py


示例16: reinit_image

    def reinit_image(self, req):
        cmd = jsonobject.loads(req[http.REQUEST_BODY])
        rsp = ReinitImageRsp()

        install_path = cmd.imageInstallPath
        dirname = os.path.dirname(cmd.volumeInstallPath)
        if not os.path.exists(dirname):
            os.makedirs(dirname, 0775)

        new_volume_path = os.path.join(dirname, '{0}.qcow2'.format(uuidhelper.uuid()))
        linux.qcow2_clone_with_cmd(install_path, new_volume_path, cmd)
        rsp.newVolumeInstallPath = new_volume_path
        return jsonobject.dumps(rsp)
开发者ID:zstackorg,项目名称:zstack-utility,代码行数:13,代码来源:shared_mountpoint_plugin.py


示例17: testName

 def testName(self):
     server = sftpbackupstorage.SftpBackupStorageAgent()
     server.http_server.register_sync_uri('/testcallback', self.callback)
     server.http_server.start_in_thread()
     time.sleep(2)
     
     cmd = sftpbackupstorage.GetSshKeyCommand()
     url = 'http://localhost:7171%s' % sftpbackupstorage.SftpBackupStorageAgent.GET_SSHKEY_PATH
     print url
     rsp = http.json_dump_post(url, cmd, headers={http.TASK_UUID:uuidhelper.uuid(), http.CALLBACK_URI:self.CALLBACK_URL})
     print "post back"
     time.sleep(5)
     
     server.http_server.stop()
开发者ID:QiRaining,项目名称:zstack-utility,代码行数:14,代码来源:test_get_sshkey.py


示例18: testName

    def testName(self):
        cmd = dns.SetDnsCmd()

        info = dns.DnsInfo()
        info.dnsAddress = "72.72.72.72"
        cmd.dns = [info]

        rsp = http.json_dump_post(
            "http://localhost:7272/setdns",
            cmd,
            headers={http.TASK_UUID: uuidhelper.uuid(), http.CALLBACK_URI: self.CALLBACK_URL},
        )
        time.sleep(10)
        self.service.stop()
开发者ID:zeus911,项目名称:zstack-utility,代码行数:14,代码来源:test_configure_dns.py


示例19: testName

 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 = "[email protected]"
         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)
开发者ID:QiRaining,项目名称:zstack-utility,代码行数:16,代码来源:test_nfs_primary_storage_download_image.py


示例20: ping

    def ping(self, req):
        cmd = jsonobject.loads(req[http.REQUEST_BODY])
        mount_path = self.mount_path[cmd.uuid]
        if not mount_path or not os.path.isdir(mount_path):
            raise Exception('the mount path[%s] of the nfs primary storage[uuid:%s] is not existing' % (mount_path, cmd.uuid))

        test_file = os.path.join(mount_path, '%s-ping-test-file' % uuidhelper.uuid())
        touch = shell.ShellCmd('timeout 60 touch %s' % test_file)
        touch(False)
        if touch.return_code == 124:
            raise Exception('unable to access the mount path[%s] of the nfs primary storage[uuid:%s] in 60s, timeout' %
                            (mount_path, cmd.uuid))
        elif touch.return_code != 0:
            touch.raise_error()

        shell.call('rm -f %s' % test_file)
        return jsonobject.dumps(NfsResponse())
开发者ID:quarkonics,项目名称:zstack-utility,代码行数:17,代码来源:nfs_primarystorage_plugin.py



注:本文中的zstacklib.utils.uuidhelper.uuid函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python xmlobject.has_element函数代码示例发布时间:2022-05-26
下一篇:
Python ssh.make_ssh_no_password函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap