@@ -2942,11 +2942,14 @@ func (self *SGuest) PerformChangeIpaddr(
29422942
29432943 notes := gn .GetShortDesc (ctx )
29442944 if gn != nil {
2945- notes .Add (jsonutils .NewString (gn .IpAddr ), "prev_ip" )
2946- }
2947- if ngn != nil {
2948- notes .Add (jsonutils .NewString (ngn .IpAddr ), "ip" )
2945+ if gn .IpAddr != ngn .IpAddr {
2946+ notes .Add (jsonutils .NewString (gn .IpAddr ), "prev_ip" )
2947+ }
2948+ if gn .Ip6Addr != ngn .Ip6Addr {
2949+ notes .Add (jsonutils .NewString (gn .Ip6Addr ), "prev_ip6" )
2950+ }
29492951 }
2952+ db .OpsLog .LogEvent (self , db .ACT_CHANGE_IPADDR , notes , userCred )
29502953 logclient .AddActionLogWithContext (ctx , self , logclient .ACT_VM_CHANGE_NIC , notes , userCred , true )
29512954
29522955 restartNetwork := (input .RestartNetwork != nil && * input .RestartNetwork )
@@ -3328,15 +3331,18 @@ func (guest *SGuest) PerformChangeBandwidth(
33283331 }
33293332
33303333 if guestnic .BwLimit != int (bandwidth ) {
3331- diff , err := db .Update (guestnic , func () error {
3334+ oldBw := guestnic .BwLimit
3335+ _ , err := db .Update (guestnic , func () error {
33323336 guestnic .BwLimit = int (bandwidth )
33333337 return nil
33343338 })
33353339 if err != nil {
33363340 return nil , err
33373341 }
3338- db .OpsLog .LogEvent (guest , db .ACT_CHANGE_BANDWIDTH , diff , userCred )
3339- logclient .AddActionLogWithContext (ctx , guest , logclient .ACT_VM_CHANGE_BANDWIDTH , diff , userCred , true )
3342+ eventDesc := guestnic .GetShortDesc (ctx )
3343+ eventDesc .Add (jsonutils .NewInt (int64 (oldBw )), "old_bw_limit_mbps" )
3344+ db .OpsLog .LogEvent (guest , db .ACT_CHANGE_BANDWIDTH , eventDesc , userCred )
3345+ logclient .AddActionLogWithContext (ctx , guest , logclient .ACT_VM_CHANGE_BANDWIDTH , eventDesc , userCred , true )
33403346 if guest .Status == api .VM_READY || (input .NoSync != nil && * input .NoSync ) {
33413347 // if no sync, just update db
33423348 return nil , nil
0 commit comments