@@ -161,48 +161,35 @@ virCHMonitorBuildPTYJson(virJSONValuePtr content, virDomainDefPtr vmdef)
161161 return -1 ;
162162}
163163
164-
165164static int
166- virCHMonitorBuildKernelJson (virJSONValuePtr content , virDomainDefPtr vmdef )
165+ virCHMonitorBuildPayloadJson (virJSONValuePtr content , virDomainDefPtr vmdef )
167166{
168- virJSONValuePtr kernel ;
167+ virJSONValuePtr payload ;
169168
170169 if (vmdef -> os .kernel == NULL ) {
171170 virReportError (VIR_ERR_INTERNAL_ERROR , "%s" ,
172171 _ ("Kernel image path in this domain is not defined" ));
173172 return -1 ;
174- } else {
175- kernel = virJSONValueNewObject ();
176- if (virJSONValueObjectAppendString (kernel , "path" , vmdef -> os .kernel ) < 0 )
177- goto cleanup ;
178- if (virJSONValueObjectAppend (content , "kernel" , kernel ) < 0 )
179- goto cleanup ;
180173 }
181174
182- return 0 ;
183-
184- cleanup :
185- virJSONValueFree (kernel );
186- return -1 ;
187- }
188-
189- static int
190- virCHMonitorBuildCmdlineJson (virJSONValuePtr content , virDomainDefPtr vmdef )
191- {
192- virJSONValuePtr cmdline ;
193-
194- cmdline = virJSONValueNewObject ();
175+ payload = virJSONValueNewObject ();
176+ if (virJSONValueObjectAppendString (payload , "kernel" , vmdef -> os .kernel ) < 0 )
177+ goto cleanup ;
195178 if (vmdef -> os .cmdline ) {
196- if (virJSONValueObjectAppendString (cmdline , "args " , vmdef -> os .cmdline ) < 0 )
179+ if (virJSONValueObjectAppendString (payload , "cmdline " , vmdef -> os .cmdline ) < 0 )
197180 goto cleanup ;
198- if (virJSONValueObjectAppend (content , "cmdline" , cmdline ) < 0 )
181+ }
182+ if (vmdef -> os .initrd != NULL ) {
183+ if (virJSONValueObjectAppendString (payload , "initramfs" , vmdef -> os .initrd ) < 0 )
199184 goto cleanup ;
200185 }
186+ if (virJSONValueObjectAppend (content , "payload" , payload ) < 0 )
187+ goto cleanup ;
201188
202189 return 0 ;
203190
204191 cleanup :
205- virJSONValueFree (cmdline );
192+ virJSONValueFree (payload );
206193 return -1 ;
207194}
208195
@@ -227,26 +214,6 @@ virCHMonitorBuildMemoryJson(virJSONValuePtr content, virDomainDefPtr vmdef)
227214 return -1 ;
228215}
229216
230- static int
231- virCHMonitorBuildInitramfsJson (virJSONValuePtr content , virDomainDefPtr vmdef )
232- {
233- virJSONValuePtr initramfs ;
234-
235- if (vmdef -> os .initrd != NULL ) {
236- initramfs = virJSONValueNewObject ();
237- if (virJSONValueObjectAppendString (initramfs , "path" , vmdef -> os .initrd ) < 0 )
238- goto cleanup ;
239- if (virJSONValueObjectAppend (content , "initramfs" , initramfs ) < 0 )
240- goto cleanup ;
241- }
242-
243- return 0 ;
244-
245- cleanup :
246- virJSONValueFree (initramfs );
247- return -1 ;
248- }
249-
250217static int
251218virCHMonitorBuildDiskJson (virJSONValuePtr disks , virDomainDiskDefPtr diskdef )
252219{
@@ -546,13 +513,7 @@ virCHMonitorBuildVMJson(virDomainObjPtr vm, virDomainDefPtr vmdef, char **jsonst
546513 if (virCHMonitorBuildMemoryJson (content , vmdef ) < 0 )
547514 goto cleanup ;
548515
549- if (virCHMonitorBuildKernelJson (content , vmdef ) < 0 )
550- goto cleanup ;
551-
552- if (virCHMonitorBuildCmdlineJson (content , vmdef ) < 0 )
553- goto cleanup ;
554-
555- if (virCHMonitorBuildInitramfsJson (content , vmdef ) < 0 )
516+ if (virCHMonitorBuildPayloadJson (content , vmdef ) < 0 )
556517 goto cleanup ;
557518
558519 if (virCHMonitorBuildDisksJson (content , vmdef ) < 0 )
0 commit comments