File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change 1
1
## v0.4.4
2
2
3
+ BUG FIXES:
3
4
5
+ * resource/virtual_environment_vm: Fix watchdog deserialization issue
4
6
5
7
## v0.4.3
6
8
Original file line number Diff line number Diff line change @@ -201,7 +201,7 @@ type CustomVirtualIODevices []CustomVirtualIODevice
201
201
// CustomWatchdogDevice handles QEMU watchdog device parameters.
202
202
type CustomWatchdogDevice struct {
203
203
Action * string `json:"action,omitempty" url:"action,omitempty"`
204
- Model string `json:"model" url:"model"`
204
+ Model * string `json:"model" url:"model"`
205
205
}
206
206
207
207
// VirtualEnvironmentVMCloneRequestBody contains the data for an virtual machine clone request.
@@ -1615,3 +1615,37 @@ func (r *CustomVGADevice) UnmarshalJSON(b []byte) error {
1615
1615
1616
1616
return nil
1617
1617
}
1618
+
1619
+ // UnmarshalJSON converts a CustomWatchdogDevice string to an object.
1620
+ func (r * CustomWatchdogDevice ) UnmarshalJSON (b []byte ) error {
1621
+ var s string
1622
+
1623
+ err := json .Unmarshal (b , & s )
1624
+
1625
+ if err != nil {
1626
+ return err
1627
+ }
1628
+
1629
+ if s == "" {
1630
+ return nil
1631
+ }
1632
+
1633
+ pairs := strings .Split (s , "," )
1634
+
1635
+ for _ , p := range pairs {
1636
+ v := strings .Split (strings .TrimSpace (p ), "=" )
1637
+
1638
+ if len (v ) == 1 {
1639
+ r .Model = & v [0 ]
1640
+ } else if len (v ) == 2 {
1641
+ switch v [0 ] {
1642
+ case "action" :
1643
+ r .Action = & v [1 ]
1644
+ case "model" :
1645
+ r .Model = & v [1 ]
1646
+ }
1647
+ }
1648
+ }
1649
+
1650
+ return nil
1651
+ }
You can’t perform that action at this time.
0 commit comments