_del_read_deleted)
def to_dict(self):
- default = super(RequestContext, self).to_dict()
- extra = {'user_id': self.user_id,
- 'project_id': self.project_id,
- 'project_name': self.project_name,
- 'domain': self.domain,
- 'read_deleted': self.read_deleted,
- 'roles': self.roles,
- 'remote_address': self.remote_address,
- 'timestamp': self.timestamp.isoformat(),
- 'quota_class': self.quota_class,
- 'service_catalog': self.service_catalog,
- 'request_id': self.request_id}
- return dict(default.items() + extra.items())
+ result = super(RequestContext, self).to_dict()
+ result['user_id'] = self.user_id
+ result['project_id'] = self.project_id
+ result['project_name'] = self.project_name
+ result['domain'] = self.domain
+ result['read_deleted'] = self.read_deleted
+ result['roles'] = self.roles
+ result['remote_address'] = self.remote_address
+ result['timestamp'] = self.timestamp.isoformat()
+ result['quota_class'] = self.quota_class
+ result['service_catalog'] = self.service_catalog
+ result['request_id'] = self.request_id
+ return result
@classmethod
def from_dict(cls, values):
localtime = time.strftime('%Y%m%d%H%M%S', time.localtime(time.time()))
# Package QoS name.
qos_name = QOS_NAME_PREFIX + lun_id + '_' + localtime
- baseData = {"TYPE": "230",
- "NAME": qos_name,
- "LUNLIST": ["%s" % lun_id],
- "CLASSTYPE": "1",
- "SCHEDULEPOLICY": "2",
- "SCHEDULESTARTTIME": "1410969600",
- "STARTTIME": "08:00",
- "DURATION": "86400",
- "CYCLESET": "[1,2,3,4,5,6,0]"
- }
-
- mergedata = dict(baseData.items() + qos.items())
- url = self.url + "/ioclass/"
+
+ mergedata = {"TYPE": "230",
+ "NAME": qos_name,
+ "LUNLIST": ["%s" % lun_id],
+ "CLASSTYPE": "1",
+ "SCHEDULEPOLICY": "2",
+ "SCHEDULESTARTTIME": "1410969600",
+ "STARTTIME": "08:00",
+ "DURATION": "86400",
+ "CYCLESET": "[1,2,3,4,5,6,0]"}
+ mergedata.update(qos)
data = json.dumps(mergedata)
+ url = self.url + "/ioclass/"
result = self.call(url, data)
self._assert_rest_result(result, 'Create QoS policy error.')
try:
for member in info_members:
info = self._get_vhd_info_member(handle, member)
- vhd_info = dict(vhd_info.items() + info.items())
+ vhd_info.update(info)
finally:
self._close(handle)
rpcapi = volume_rpcapi.VolumeAPI()
# Create new volume on remote host
- new_vol_values = {}
- for k, v in volume.iteritems():
- new_vol_values[k] = v
+ new_vol_values = dict(volume)
del new_vol_values['id']
del new_vol_values['_name_id']
# We don't copy volume_type because the db sets that according to