Skip to content

Add UpdateImage feature - #869

Merged
seokho-son merged 2 commits into
cloud-barista:mainfrom
jihoon-seo:211014_Add_UpdateImage_feature
Oct 18, 2021
Merged

seokho-son merged 2 commits into
cloud-barista:mainfrom
jihoon-seo:211014_Add_UpdateImage_feature

Conversation

@jihoon-seo

Copy link
Copy Markdown
Member

Resolves #866

❯ ./list-image.sh                            
####################################################################
## 6. image: List
####################################################################
{
  "image": null
}

❯ ./registerImageWithId.sh -n jhseo -c mock -r 1
####################################################################
## 6. image: Register
####################################################################


- Register image in mock-seoul
{
  "namespace": "tb01",
  "id": "mock-seoul-jhseo",
  "name": "mock-seoul-jhseo",
  "connectionName": "mock-seoul",
  "cspImageId": "mock-vmimage-01",
  "guestOS": "TestGuestOS",
  "status": "TestStatus"
}

❯ ./test-update-image.sh                        
####################################################################
## 6. image: Update
####################################################################
{
  "namespace": "tb01",
  "id": "mock-seoul-jhseo",
  "name": "mock-seoul-jhseo",
  "connectionName": "mock-seoul",
  "cspImageId": "mock-vmimage-01",
  "description": "UpdateImage() test",
  "guestOS": "TestGuestOS",
  "status": "TestStatus"
}

❯ ./list-image.sh                            
####################################################################
## 6. image: List
####################################################################
{
  "image": [
    {
      "namespace": "tb01",
      "id": "mock-seoul-jhseo",
      "name": "mock-seoul-jhseo",
      "connectionName": "mock-seoul",
      "cspImageId": "mock-vmimage-01",
      "description": "UpdateImage() test",
      "guestOS": "TestGuestOS",
      "status": "TestStatus"
    }
  ]
}

@jihoon-seo
jihoon-seo requested a review from seokho-son October 14, 2021 01:56

@seokho-son seokho-son left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jihoon-seo 마이너한 의견을 달았습니다.. ^^

Comment thread src/core/mcir/image.go Outdated
Comment thread src/core/mcir/image.go Outdated
Comment thread src/core/mcir/image.go Outdated
common.CBLog.Error(err)
return temp, err
}
keyValue, _ := common.CBStore.Get(string(Key))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
keyValue, _ := common.CBStore.Get(string(Key))
keyValue, _ := common.CBStore.Get(string(Key))

여기도 오류 확인을 먼저하는 게 좋겠지요? (이런 코드가 여기저기 많긴할텐데..)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 부분은
UpdateImage 함수에서
update 작업을 완료한 뒤
K-V store에 저장된 내용을 Println 하기 위해 Get 하는 부분입니다.

훔.. 만약 L594 의 Put 에서 에러가 없었다면 K-V store에 저장은 잘 된 것으로 볼 수 있고,
Put 에서 에러가 없었기 때문에 아마 Get 에서도 에러가 발생하지 않을 것으로 예상됩니다.


만약 여기에 오류 확인 코드를 추가하고
L594 의 Put 에서 에러가 없었는데 Get 에서 에러가 발생하면 (← 이런 일이 없을 것 같기는 하지만..)
update 작업이 완료되었지만
UpdateImage 함수가 에러를 리턴하게 됩니다. 😢
(롤백 로직이 필요할지 등의 이슈가 있습니다.)


(이런 코드가 여기저기 많긴할텐데..)

네 검색해보니 12개 파일에서 36군데에 있습니다. 😊


의견 주시면 위의 사항들과 함께 처리하겠습니다. 😊

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

L594 의 Put 에서 에러가 없었는데 Get 에서 에러가 발생하면 (← 이런 일이 없을 것 같기는 하지만..)

이번에 꼭 정리할 필요가 있을지 모르겠지만~ 살살 정리해두면 좋을 것 같긴하네요.. ^^
Get 할때는 애러 로깅만하구, 리턴은 하지 않도록 하면 좀 괜찮을까요?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get 할때는 애러 로깅만하구, 리턴은 하지 않도록

12개 파일, 36군데 중
대부분을 이렇게 처리하였습니다 😊

@seokho-son

Copy link
Copy Markdown
Member

/lgtm
@jihoon-seo 고생많으셨어요!! 감사합니다.. 👍

@github-actions github-actions Bot added the lgtm This PR is acceptable by at least one reviewer label Oct 18, 2021
@seokho-son
seokho-son merged commit 1369c3d into cloud-barista:main Oct 18, 2021
@jihoon-seo
jihoon-seo deleted the 211014_Add_UpdateImage_feature branch October 22, 2021 06:08
@jihoon-seo jihoon-seo added the hacktoberfest-accepted hacktoberfest-accepted label Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hacktoberfest-accepted hacktoberfest-accepted lgtm This PR is acceptable by at least one reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add UpdateImage feature

2 participants