Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dpvs-agent dump/launch services #932

Merged
merged 1 commit into from
Jan 12, 2024

Conversation

you-looks-not-tasty
Copy link
Collaborator

  1. set query params 'snapshot' of API(/v2/vs) to dump the running service into cache file.
  2. resume running service with snapshot cache file by launch params 'init-mode=local'.
  3. new API(/v2/vs/${SERVICE-ID}/health) for dpvs-healthcheck.

…vice into cache file.

2. resume running service with snapshot cache file by launch params 'init-mode=local'
3. new API(/v2/vs/${SERVICE-ID}/health) for dpvs-healthcheck
@ywc689 ywc689 self-requested a review January 2, 2024 03:45
@ywc689 ywc689 self-assigned this Jan 2, 2024
Comment on lines +93 to +119
// 4> bind laddr with vs (ipvsadm --add-laddr -z ${LADDR} -t ${VIPPORT} -F ${device})
laddr := types.NewLocalAddrFront()
if err := laddr.ParseVipPortProto(vs.ID()); err != nil {
}
lds := make([]*types.LocalAddrDetail, len(laddrs.Items))
for i, lip := range laddrs.Items {
lds[i] = types.NewLocalAddrDetail()
lds[i].SetAddr(lip.Addr)
lds[i].SetIfName(lip.Device)
}
laddr.Add(lds, cp, logger)
// 5> ip addr add ${VIP} dev ${KNIDEVICE(lo?)}
if err := device.NetlinkAddrAdd(service.Addr, announcePort.Switch, logger); err != nil {
logger.Error("add addr", service.Addr, "onto device failed")
errs = append(errs, err)
}
}
// 6> dpip addr add ${LADDR} dev ${device}
for _, lip := range laddrs.Items {
lipAddr := types.NewInetAddrDetail()
lipAddr.SetAddr(lip.Addr)
lipAddr.SetIfName(lip.Device)
lipAddr.SetFlags("sapool")
resultCode := lipAddr.Add(cp, logger)
logger.Info("Add addr to device done.", "Device", lip.Device, "Addr", lip.Addr, "result", resultCode.String())
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Were the following cases considered?

  • The forwarding mode is not FNAT, such as DR, Tunnel.
  • The local addresses for FNAT services aren't always the same.
  • The virtual addresses aren't required announced on netlink device.

The above features may not support in this intial version, but at least should be handled properly to ensure the procedure is successful and all the services booting from local file are correct.

Comment on lines +177 to +183
VsAnnouncePort:
type: object
properties:
switch:
type: string
dpvs:
type: string
Copy link
Collaborator

Choose a reason for hiding this comment

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

A little hard to understand. Add some comments or use more expresive names?

services := &models.VirtualServerList{Items: make([]*models.VirtualServerSpecExpand, len(snapshot.Services))}
i := 0
for _, svc := range snapshot.Services {
services.Items[i] = svc
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is deepcopy needed here?

Comment on lines +119 to +122
if err := os.Rename(cacheFile, bakName); err != nil {
logger.Error(err.Error())
return err
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should it consider the case where the chacheFile doesn't exist?

Comment on lines +35 to +38
func ShareSnapshot() *types.NodeSnapshot {
initOnce.Do(setUp)
return shareSnapshot
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should multi-thread safety be considered for the global data shareSnapshot?

Copy link
Collaborator

@ywc689 ywc689 left a comment

Choose a reason for hiding this comment

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

Please amend the issues mentioned in the review later.

@ywc689 ywc689 added the pr/accepted the pr passed all review stages and await to be merged label Jan 12, 2024
@ywc689 ywc689 merged commit 351e95d into iqiyi:devel Jan 12, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr/accepted the pr passed all review stages and await to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants