def __save_volume(self, tenant, service, volumes): if volumes: volume_service.delete_service_volumes(service) index = 0 for volume in volumes: index += 1 volume_name = service.service_alias.upper() + "_" + str(index) if "file_content" in volume.keys(): code, msg, volume_data = volume_service.add_service_volume( tenant, service, volume["volume_path"], volume["volume_type"], volume_name, volume["file_content"]) if code != 200: logger.error( "service.check", "save service check info port error {0}".format( msg)) # return code, msg else: code, msg, volume_data = volume_service.add_service_volume( tenant, service, volume["volume_path"], volume["volume_type"], volume_name) if code != 200: logger.error( "service.check", "save service check info port error {0}".format( msg)) # return code, msg return 200, "success"
def __save_volume(self, tenant, service, volumes): if volumes: volume_service.delete_service_volumes(service) index = 0 for volume in volumes: index += 1 volume_name = service.service_alias.upper() + "_" + str(index) if "file_content" in list(volume.keys()): volume_service.add_service_volume(tenant, service, volume["volume_path"], volume["volume_type"], volume_name, volume["file_content"]) else: settings = {} settings["volume_capacity"] = volume["volume_capacity"] try: volume_service.add_service_volume( tenant, service, volume["volume_path"], volume["volume_type"], volume_name, None, settings) except ErrVolumePath: logger.warning("Volume Path {0} error".format( volume["volume_path"])) return 200, "success"
def __save_volume(self, tenant, service, volumes): if volumes: volume_service.delete_service_volumes(service) index = 0 for volume in volumes: index += 1 volume_name = service.service_alias.upper() + "_" + str(index) if "file_content" in volume.keys(): volume_service.add_service_volume(tenant, service, volume["volume_path"], volume["volume_type"], volume_name, volume["file_content"]) else: settings = {} settings["volume_capacity"] = volume["volume_capacity"] volume_service.add_service_volume(tenant, service, volume["volume_path"], volume["volume_type"], volume_name, None, settings) return 200, "success"