File tree Expand file tree Collapse file tree 3 files changed +43
-0
lines changed Expand file tree Collapse file tree 3 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,11 @@ func (image *CustomerImage) GetOS() OperatingSystem {
91
91
return image .Guest .OperatingSystem
92
92
}
93
93
94
+ // RequiresCustomization determines whether the image requires guest OS customisation during deployment.
95
+ func (image * CustomerImage ) RequiresCustomization () bool {
96
+ return image .Guest .OSCustomization
97
+ }
98
+
94
99
// ApplyTo applies the CustomerImage to the specified ServerDeploymentConfiguration.
95
100
func (image * CustomerImage ) ApplyTo (config * ServerDeploymentConfiguration ) {
96
101
config .ImageID = image .ID
@@ -102,6 +107,20 @@ func (image *CustomerImage) ApplyTo(config *ServerDeploymentConfiguration) {
102
107
}
103
108
}
104
109
110
+ // ApplyToUncustomized applies the CustomerImage to the specified UncustomizedServerDeploymentConfiguration.
111
+ func (image * CustomerImage ) ApplyToUncustomized (config * UncustomizedServerDeploymentConfiguration ) {
112
+ config .ImageID = image .ID
113
+ config .CPU = image .CPU
114
+ config .MemoryGB = image .MemoryGB
115
+ if len (image .SCSIControllers ) == 0 {
116
+ return
117
+ }
118
+ config .Disks = make (VirtualMachineDisks , len (image .SCSIControllers [0 ].Disks ))
119
+ for index , disk := range image .SCSIControllers [0 ].Disks {
120
+ config .Disks [index ] = disk
121
+ }
122
+ }
123
+
105
124
var _ Image = & CustomerImage {}
106
125
107
126
// Request body when exporting a customer image to an OVF package.
Original file line number Diff line number Diff line change @@ -39,6 +39,12 @@ type Image interface {
39
39
// GetOS retrieves information about the image's operating system.
40
40
GetOS () OperatingSystem
41
41
42
+ // RequiresCustomization determines whether the image requires guest OS customisation during deployment.
43
+ RequiresCustomization () bool
44
+
42
45
// ApplyTo applies the Image to the specified ServerDeploymentConfiguration.
43
46
ApplyTo (config * ServerDeploymentConfiguration )
47
+
48
+ // ApplyToUncustomized applies the Image to the specified UncustomizedServerDeploymentConfiguration.
49
+ ApplyToUncustomized (config * UncustomizedServerDeploymentConfiguration )
44
50
}
Original file line number Diff line number Diff line change @@ -74,6 +74,11 @@ func (image *OSImage) GetOS() OperatingSystem {
74
74
return image .Guest .OperatingSystem
75
75
}
76
76
77
+ // RequiresCustomization determines whether the image requires guest OS customisation during deployment.
78
+ func (image * OSImage ) RequiresCustomization () bool {
79
+ return image .Guest .OSCustomization
80
+ }
81
+
77
82
// ApplyTo applies the OSImage to the specified ServerDeploymentConfiguration.
78
83
func (image * OSImage ) ApplyTo (config * ServerDeploymentConfiguration ) {
79
84
config .ImageID = image .ID
@@ -83,7 +88,20 @@ func (image *OSImage) ApplyTo(config *ServerDeploymentConfiguration) {
83
88
for index , scsiController := range image .SCSIControllers {
84
89
config .SCSIControllers [index ] = scsiController
85
90
}
91
+ }
86
92
93
+ // ApplyToUncustomized applies the OSImage to the specified UncustomizedServerDeploymentConfiguration.
94
+ func (image * OSImage ) ApplyToUncustomized (config * UncustomizedServerDeploymentConfiguration ) {
95
+ config .ImageID = image .ID
96
+ config .CPU = image .CPU
97
+ config .MemoryGB = image .MemoryGB
98
+ if len (image .SCSIControllers ) == 0 {
99
+ return
100
+ }
101
+ config .Disks = make (VirtualMachineDisks , len (image .SCSIControllers [0 ].Disks ))
102
+ for index , disk := range image .SCSIControllers [0 ].Disks {
103
+ config .Disks [index ] = disk
104
+ }
87
105
}
88
106
89
107
var _ Image = & OSImage {}
You can’t perform that action at this time.
0 commit comments