Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,21 @@ require (
github.com/spf13/pflag v1.0.5 // indirect

Choose a reason for hiding this comment

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

same as other prs, make sure to remove all changes from these files before merge

github.com/subosito/gotenv v1.4.2 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/net v0.39.0 // indirect
golang.org/x/sys v0.32.0 // indirect
golang.org/x/text v0.24.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250428153025-10db94c68c34 // indirect
golang.org/x/net v0.41.0 // indirect
golang.org/x/sys v0.33.0 // indirect
golang.org/x/text v0.26.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace (
github.com/gogo/protobuf => github.com/gogo/protobuf v1.3.2
github.com/microsoft/moc => github.com/hvedati/moc v0.11.0-alpha.5
github.com/miekg/dns => github.com/miekg/dns v1.1.25
golang.org/x/crypto => golang.org/x/crypto v0.32.0
golang.org/x/image => golang.org/x/image v0.23.0
golang.org/x/sys => golang.org/x/sys v0.0.0-20220823224334-20c2bfdbfe24

)
12 changes: 10 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/hvedati/moc v0.11.0-alpha.3 h1:j92P8dubAZWCDPqT9biL7uf8uJyMXXIeN5wJh7d1DKY=
github.com/hvedati/moc v0.11.0-alpha.3/go.mod h1:ZZ4/WPkZCkm3I0UWRiO5P4uR9kpMG9/iGoiAs3K8Cjo=
github.com/hvedati/moc v0.11.0-alpha.5 h1:W+6AA83jRhm6qfyo9F1Val4/VrbwcUoZtrk02WP5ed0=
github.com/hvedati/moc v0.11.0-alpha.5/go.mod h1:h/tslUhMoPTK8nJZwlOQ91Ru3Vqhm8pKjYkBX0ECQsE=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
Expand All @@ -168,8 +172,6 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/microsoft/moc v0.28.7 h1:ib7Hpq3Tl5/LuGviW2GI9tJP42cHNfONqhtgBsvbjuw=
github.com/microsoft/moc v0.28.7/go.mod h1:ZZ4/WPkZCkm3I0UWRiO5P4uR9kpMG9/iGoiAs3K8Cjo=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
Expand Down Expand Up @@ -326,6 +328,8 @@ golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY=
golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E=
golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw=
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -376,6 +380,8 @@ golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0=
golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU=
golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=
golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down Expand Up @@ -499,6 +505,8 @@ google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6D
google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250428153025-10db94c68c34 h1:h6p3mQqrmT1XkHVTfzLdNz1u7IhINeZkz67/xTbOuWs=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250428153025-10db94c68c34/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 h1:fc6jSaCT0vBduLYZHYrBBNY4dsWuvgyff9noRNDdBeE=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
Expand Down
4 changes: 2 additions & 2 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func GetServerAddress(cc *grpc.ClientConn) string {
defer mux.Unlock()

Choose a reason for hiding this comment

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

probably can just remove this file to keep the commit history simple

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed in new pr.


for key, value := range connectionCache {
if value == cc {
if value == cc {
return key
}
}
Expand All @@ -109,7 +109,7 @@ func AddNodeNameToErrorMessageInterceptor() grpc.UnaryClientInterceptor {
serverAddressPort := GetServerAddress(cc)
if len(serverAddressPort) != 0 {
serverAddress := (strings.Split(serverAddressPort, ":"))[0]
err = errors.Wrapf(err, "nodename = %s", serverAddress)
err = errors.Wrapf(err, "nodename = %s", serverAddress)
}
}

Expand Down
8 changes: 8 additions & 0 deletions services/compute/compute.go
Original file line number Diff line number Diff line change
Expand Up @@ -727,3 +727,11 @@ type ZoneConfiguration struct {
// Strict Placement
StrictPlacement *bool `json:"strictPlacement,omitempty"`
}

type VirtualMachineHyperVVmId struct {
HyperVVmId *string `json:"hyperVVmId ,omitempty"`
}

type VirtualMachineHostNodeName struct {
HostNodeName *string `json:"hostNodeName ,omitempty"`
}
5 changes: 5 additions & 0 deletions services/compute/virtualmachine/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type Service interface {
RepairGuestAgent(context.Context, string, string) error
RunCommand(context.Context, string, string, *compute.VirtualMachineRunCommandRequest) (*compute.VirtualMachineRunCommandResponse, error)
Validate(context.Context, string, string) error
GetHyperVVmId(context.Context, string, string) (*compute.VirtualMachineHyperVVmId, error)
}

type VirtualMachineClient struct {
Expand Down Expand Up @@ -277,6 +278,10 @@ func (c *VirtualMachineClient) RunCommand(ctx context.Context, group, vmName str
return c.internal.RunCommand(ctx, group, vmName, request)
}

func (c *VirtualMachineClient) GetHyperVVmId(ctx context.Context, group string, name string) (*compute.VirtualMachineHyperVVmId, error) {
return c.internal.GetHyperVVmId(ctx, group, name)
}

func isDifferentVmSize(oldSizeType, newSizeType compute.VirtualMachineSizeTypes, oldCustomSize, newCustomSize *compute.VirtualMachineCustomSize) bool {
if oldSizeType != newSizeType {
return true
Expand Down
17 changes: 17 additions & 0 deletions services/compute/virtualmachine/internal/wssd.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,23 @@ func (c *client) Hydrate(ctx context.Context, group, name string, sg *compute.Vi
return &(*vms)[0], nil
}

func (c *client) GetHyperVVmId(ctx context.Context, group, name string) (*compute.VirtualMachineHyperVVmId, error) {
vm, err := c.get(ctx, group, name)
if err != nil {
return nil, err
}

mocResponse, err := c.VirtualMachineAgentClient.GetHyperVVmId(ctx, vm[0])

Choose a reason for hiding this comment

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

Just to be safe, can we make sure the vm list is non-empty before accessing it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in new pr.

Choose a reason for hiding this comment

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

Is there a specific reason we aren’t using the INVOKE function for the calls to cloudAgent? It already has RBAC, redaction, and common logging built in.

Would it make sense to embed these new function calls within INVOKE to take advantage of those built-in features?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These functions are not running operations on the VM, they are simply getting and passing up information from set fields.

if err != nil {
return nil, err
}
response := &compute.VirtualMachineHyperVVmId{
HyperVVmId: &mocResponse.HyperVVmId,
}

return response, nil
}

func (c *client) Start(ctx context.Context, group, name string) (err error) {
request, err := c.getVirtualMachineOperationRequest(ctx, wssdcommonproto.VirtualMachineOperation_START, name)
if err != nil {
Expand Down
Loading