Join us for a virtual Nutanix User Group meeting with Jarian Gibson as he covers Nutanix Cloud Clusters (NC2) on Azure and AWS with Citrix. <\/span><\/p>

Jarian will take a deep dive into NC2 on Azure architecture and Citrix on NC2 on Azure\u00a0that helps you strengthen your business continuity and disaster recovery position. He\u2019ll also provide the latest updates for NC2 on AWS.<\/span><\/p>

Plus, we're\u00a0giving away a Nutanix suitcase to one lucky winner!\u00a0Opt-in when you register\u00a0to be entered to win.\u00a0<\/p>","author":{"id":113632,"url":"\/members\/karlie-beil-113632","name":"Karlie Beil","avatar":"https:\/\/uploads-us-west-2.insided.com\/nutanix-us\/icon\/200x200\/1581aab3-bcf6-49f4-b2fb-3d11e8c010dc.png","userTitle":"Community Manager","rank":{"isBold":false,"isItalic":false,"isUnderline":false,"name":"Community Manager","color":"#0873ba"},"userLevel":4},"type":"Webinar","url":"https:\/\/next.nutanix.com\/events\/global-nug-nc2-on-azure-and-aws-with-citrix-151","image":"https:\/\/uploads-us-west-2.insided.com\/nutanix-us\/attachment\/f9693b5b-436b-427a-9b98-531b4040ff24_thumb.png","location":"","startsAt":1678298400,"endsAt":1678302000,"contentType":"event","attendees":[],"attendeeCount":0,"isLoggedInUserAttendee":false,"createdAt":"1675974969"},"phrases":{"Forum":{"{n} year|{n} years":"{n} year|{n} years","{n} month|{n} months":"{n} month|{n} months","{n} day|{n} days":"{n} day|{n} days","{n} hour|{n} hours":"{n} hour|{n} hours","{n} minute|{n} minutes":"{n} minute|{n} minutes","just":"just now","{plural} ago":"{plural} ago"}}}">

解决了

通过API/Python创建保护域表

  • 2019年2月6日
  • 1回复
  • 1524意见

你好,



我正在尝试为这样的现有保护域创建时间表:



代码:
def createProtectionDomainsChedule(self,pdname):
#设置保护域的时间表
尝试:
policy = {"retention_policy": {"remote_retention_type": None, "remote_max_snapshots": {}, "local_retention_period": None, "local_max_snapshots": 1, "remote_retention_period": {}, "local_retention_type": None}, "start_times_in_usecs":[1549477620000000l],“ crolup_schedule_uuid”:none,“ user_start_time_in_isecs”:15494777620000000l,“ is_rollup_sched”:none,none,“ pd_name”::none,“ type”:“ daily”,“ id”:“ 63C037E5-41E4-4630-8641-23509A5360AGG”,“ every_nth”:1}

protectionDomainurl = self.base_url+“/protection_domains/”+pdname+“/schedule”

serverResponse = self.session.post(protectionDomainurl,策略)
打印serverresponse.text
返回json.loads(serverresponse.text)
除例外为E:
ErrorHandler(E)





但是,这返回:



{“消息”:“意外字符('r'(代码114)):预期有效值(数字,字符串,数组,对象,'true','false'或null'或'null'),“ lated_message”:“java.io.ioexception:意外字符('r'(代码114)):期望有效值(数字,字符串,数组,对象,'true','false'或null')\ n \ tat com.nutanix。




我想知道有人有工作的例子吗?



谢谢!



米歇尔
图标

最好的答案钱德鲁2019年2月8日,21:55

@Michelp_be<\/user-mention> One issue i see in your code is that the last two characters in the id contains letter `g` any UUID only contains characters a to f. But this doesn't seem to be causing the error and yoou can ignore the id altogether it will still update.
\r\n
\r\nThe error may be caused by the payload getting passed in non-json format. This could be because you are not setting header \"content-type:application\/json\" or the data payload is being converted to string instead of being passed as dictionary.
\r\n
\r\nI tried your payload exactly and i'm able to successfully create the schedule","className":"post__content__best_answer"}">
查看原件

该主题已关闭以供评论

1回复

UserLevel 3
徽章 +13
@michelp_be我在您的代码中看到的一个问题是,ID中的最后两个字符包含字母`g'任何UUID仅包含字符a至f。但这似乎并没有导致错误,您可以忽略它仍然会更新的ID。



错误可能是由于有效载荷以非JSON格式通过的。这可能是因为您没有设置标题“ content-type:application/json”,或者数据有效负载正在转换为字符串,而不是通过字典传递。



我准确地尝试了您的有效负载,我能够成功创建时间表
Learn more about our cookies.<\/a>","cookiepolicy.button":"Accept cookies","cookiepolicy.button.deny":"Deny all","cookiepolicy.link":"Cookie settings","cookiepolicy.modal.title":"Cookie settings","cookiepolicy.modal.content":"We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.<\/a>","cookiepolicy.modal.level1":"Basic
Functional","cookiepolicy.modal.level2":"Normal
Functional + analytics","cookiepolicy.modal.level3":"Complete
Functional + analytics + social media + embedded videos"}}}">
Baidu