libvirt.org/go/libvirtxml@v1.10003.0/domain.go (about) 1 /* 2 * This file is part of the libvirt-go-xml-module project 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a copy 5 * of this software and associated documentation files (the "Software"), to deal 6 * in the Software without restriction, including without limitation the rights 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 * copies of the Software, and to permit persons to whom the Software is 9 * furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included in 12 * all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 * THE SOFTWARE. 21 * 22 * Copyright (C) 2016 Red Hat, Inc. 23 * 24 */ 25 26 package libvirtxml 27 28 import ( 29 "encoding/xml" 30 "fmt" 31 "io" 32 "strconv" 33 "strings" 34 ) 35 36 type DomainControllerPCIHole64 struct { 37 Size uint64 `xml:",chardata"` 38 Unit string `xml:"unit,attr,omitempty"` 39 } 40 41 type DomainControllerPCIModel struct { 42 Name string `xml:"name,attr"` 43 } 44 45 type DomainControllerPCITarget struct { 46 ChassisNr *uint 47 Chassis *uint 48 Port *uint 49 BusNr *uint 50 Index *uint 51 NUMANode *uint 52 Hotplug string 53 MemReserve *uint64 54 } 55 56 type DomainControllerPCI struct { 57 Model *DomainControllerPCIModel `xml:"model"` 58 Target *DomainControllerPCITarget `xml:"target"` 59 Hole64 *DomainControllerPCIHole64 `xml:"pcihole64"` 60 } 61 62 type DomainControllerUSBMaster struct { 63 StartPort uint `xml:"startport,attr"` 64 } 65 66 type DomainControllerUSB struct { 67 Port *uint `xml:"ports,attr"` 68 Master *DomainControllerUSBMaster `xml:"master"` 69 } 70 71 type DomainControllerVirtIOSerial struct { 72 Ports *uint `xml:"ports,attr"` 73 Vectors *uint `xml:"vectors,attr"` 74 } 75 76 type DomainControllerXenBus struct { 77 MaxGrantFrames uint `xml:"maxGrantFrames,attr,omitempty"` 78 MaxEventChannels uint `xml:"maxEventChannels,attr,omitempty"` 79 } 80 81 type DomainControllerDriver struct { 82 Queues *uint `xml:"queues,attr"` 83 CmdPerLUN *uint `xml:"cmd_per_lun,attr"` 84 MaxSectors *uint `xml:"max_sectors,attr"` 85 IOEventFD string `xml:"ioeventfd,attr,omitempty"` 86 IOThread uint `xml:"iothread,attr,omitempty"` 87 IOMMU string `xml:"iommu,attr,omitempty"` 88 ATS string `xml:"ats,attr,omitempty"` 89 Packed string `xml:"packed,attr,omitempty"` 90 PagePerVQ string `xml:"page_per_vq,attr,omitempty"` 91 } 92 93 type DomainController struct { 94 XMLName xml.Name `xml:"controller"` 95 Type string `xml:"type,attr"` 96 Index *uint `xml:"index,attr"` 97 Model string `xml:"model,attr,omitempty"` 98 Driver *DomainControllerDriver `xml:"driver"` 99 PCI *DomainControllerPCI `xml:"-"` 100 USB *DomainControllerUSB `xml:"-"` 101 VirtIOSerial *DomainControllerVirtIOSerial `xml:"-"` 102 XenBus *DomainControllerXenBus `xml:"-"` 103 ACPI *DomainDeviceACPI `xml:"acpi"` 104 Alias *DomainAlias `xml:"alias"` 105 Address *DomainAddress `xml:"address"` 106 } 107 108 type DomainDiskSecret struct { 109 Type string `xml:"type,attr,omitempty"` 110 Usage string `xml:"usage,attr,omitempty"` 111 UUID string `xml:"uuid,attr,omitempty"` 112 } 113 114 type DomainDiskAuth struct { 115 Username string `xml:"username,attr,omitempty"` 116 Secret *DomainDiskSecret `xml:"secret"` 117 } 118 119 type DomainDiskSourceHost struct { 120 Transport string `xml:"transport,attr,omitempty"` 121 Name string `xml:"name,attr,omitempty"` 122 Port string `xml:"port,attr,omitempty"` 123 Socket string `xml:"socket,attr,omitempty"` 124 } 125 126 type DomainDiskSourceSSL struct { 127 Verify string `xml:"verify,attr"` 128 } 129 130 type DomainDiskCookie struct { 131 Name string `xml:"name,attr"` 132 Value string `xml:",chardata"` 133 } 134 135 type DomainDiskCookies struct { 136 Cookies []DomainDiskCookie `xml:"cookie"` 137 } 138 139 type DomainDiskSourceReadahead struct { 140 Size string `xml:"size,attr"` 141 } 142 143 type DomainDiskSourceTimeout struct { 144 Seconds string `xml:"seconds,attr"` 145 } 146 147 type DomainDiskReservationsSource DomainChardevSource 148 149 type DomainDiskReservations struct { 150 Enabled string `xml:"enabled,attr,omitempty"` 151 Managed string `xml:"managed,attr,omitempty"` 152 Source *DomainDiskReservationsSource `xml:"source"` 153 } 154 155 type DomainDiskSource struct { 156 File *DomainDiskSourceFile `xml:"-"` 157 Block *DomainDiskSourceBlock `xml:"-"` 158 Dir *DomainDiskSourceDir `xml:"-"` 159 Network *DomainDiskSourceNetwork `xml:"-"` 160 Volume *DomainDiskSourceVolume `xml:"-"` 161 NVME *DomainDiskSourceNVME `xml:"-"` 162 VHostUser *DomainDiskSourceVHostUser `xml:"-"` 163 VHostVDPA *DomainDiskSourceVHostVDPA `xml:"-"` 164 StartupPolicy string `xml:"startupPolicy,attr,omitempty"` 165 Index uint `xml:"index,attr,omitempty"` 166 Encryption *DomainDiskEncryption `xml:"encryption"` 167 Reservations *DomainDiskReservations `xml:"reservations"` 168 Slices *DomainDiskSlices `xml:"slices"` 169 SSL *DomainDiskSourceSSL `xml:"ssl"` 170 Cookies *DomainDiskCookies `xml:"cookies"` 171 Readahead *DomainDiskSourceReadahead `xml:"readahead"` 172 Timeout *DomainDiskSourceTimeout `xml:"timeout"` 173 } 174 175 type DomainDiskSlices struct { 176 Slices []DomainDiskSlice `xml:"slice"` 177 } 178 179 type DomainDiskSlice struct { 180 Type string `xml:"type,attr"` 181 Offset uint `xml:"offset,attr"` 182 Size uint `xml:"size,attr"` 183 } 184 185 type DomainDiskSourceFile struct { 186 File string `xml:"file,attr,omitempty"` 187 FDGroup string `xml:"fdgroup,attr,omitempty"` 188 SecLabel []DomainDeviceSecLabel `xml:"seclabel"` 189 } 190 191 type DomainDiskSourceNVME struct { 192 PCI *DomainDiskSourceNVMEPCI 193 } 194 195 type DomainDiskSourceNVMEPCI struct { 196 Managed string `xml:"managed,attr,omitempty"` 197 Namespace uint64 `xml:"namespace,attr,omitempty"` 198 Address *DomainAddressPCI `xml:"address"` 199 } 200 201 type DomainDiskSourceBlock struct { 202 Dev string `xml:"dev,attr,omitempty"` 203 SecLabel []DomainDeviceSecLabel `xml:"seclabel"` 204 } 205 206 type DomainDiskSourceDir struct { 207 Dir string `xml:"dir,attr,omitempty"` 208 } 209 210 type DomainDiskSourceNetwork struct { 211 Protocol string `xml:"protocol,attr,omitempty"` 212 Name string `xml:"name,attr,omitempty"` 213 Query string `xml:"query,attr,omitempty"` 214 TLS string `xml:"tls,attr,omitempty"` 215 TLSHostname string `xml:"tlsHostname,attr,omitempty"` 216 Hosts []DomainDiskSourceHost `xml:"host"` 217 Identity *DomainDiskSourceNetworkIdentity `xml:"identity"` 218 KnownHosts *DomainDiskSourceNetworkKnownHosts `xml:"knownHosts"` 219 Initiator *DomainDiskSourceNetworkInitiator `xml:"initiator"` 220 Snapshot *DomainDiskSourceNetworkSnapshot `xml:"snapshot"` 221 Config *DomainDiskSourceNetworkConfig `xml:"config"` 222 Reconnect *DomainDiskSourceNetworkReconnect `xml:"reconnect"` 223 Auth *DomainDiskAuth `xml:"auth"` 224 } 225 226 type DomainDiskSourceNetworkKnownHosts struct { 227 Path string `xml:"path,attr"` 228 } 229 230 type DomainDiskSourceNetworkIdentity struct { 231 User string `xml:"user,attr,omitempty"` 232 Group string `xml:"group,attr,omitempty"` 233 UserName string `xml:"username,attr,omitempty"` 234 Keyfile string `xml:"keyfile,attr,omitempty"` 235 AgentSock string `xml:"agentsock,attr,omitempty"` 236 } 237 238 type DomainDiskSourceNetworkInitiator struct { 239 IQN *DomainDiskSourceNetworkIQN `xml:"iqn"` 240 } 241 242 type DomainDiskSourceNetworkIQN struct { 243 Name string `xml:"name,attr,omitempty"` 244 } 245 246 type DomainDiskSourceNetworkSnapshot struct { 247 Name string `xml:"name,attr"` 248 } 249 250 type DomainDiskSourceNetworkConfig struct { 251 File string `xml:"file,attr"` 252 } 253 254 type DomainDiskSourceNetworkReconnect struct { 255 Delay string `xml:"delay,attr"` 256 } 257 258 type DomainDiskSourceVolume struct { 259 Pool string `xml:"pool,attr,omitempty"` 260 Volume string `xml:"volume,attr,omitempty"` 261 Mode string `xml:"mode,attr,omitempty"` 262 SecLabel []DomainDeviceSecLabel `xml:"seclabel"` 263 } 264 265 type DomainDiskSourceVHostUser DomainChardevSource 266 267 type DomainDiskSourceVHostVDPA struct { 268 Dev string `xml:"dev,attr"` 269 } 270 271 type DomainDiskMetadataCache struct { 272 MaxSize *DomainDiskMetadataCacheSize `xml:"max_size"` 273 } 274 275 type DomainDiskMetadataCacheSize struct { 276 Unit string `xml:"unit,attr,omitempty"` 277 Value int `xml:",cdata"` 278 } 279 280 type DomainDiskIOThreads struct { 281 IOThread []DomainDiskIOThread `xml:"iothread"` 282 } 283 284 type DomainDiskIOThread struct { 285 ID uint `xml:"id,attr"` 286 Queues []DomainDiskIOThreadQueue `xml:"queue"` 287 } 288 289 type DomainDiskIOThreadQueue struct { 290 ID uint `xml:"id,attr"` 291 } 292 293 type DomainDiskDriver struct { 294 Name string `xml:"name,attr,omitempty"` 295 Type string `xml:"type,attr,omitempty"` 296 Cache string `xml:"cache,attr,omitempty"` 297 ErrorPolicy string `xml:"error_policy,attr,omitempty"` 298 RErrorPolicy string `xml:"rerror_policy,attr,omitempty"` 299 IO string `xml:"io,attr,omitempty"` 300 IOEventFD string `xml:"ioeventfd,attr,omitempty"` 301 EventIDX string `xml:"event_idx,attr,omitempty"` 302 CopyOnRead string `xml:"copy_on_read,attr,omitempty"` 303 Discard string `xml:"discard,attr,omitempty"` 304 DiscardNoUnref string `xml:"discard_no_unref,attr,omitempty"` 305 IOThread *uint `xml:"iothread,attr"` 306 IOThreads *DomainDiskIOThreads `xml:"iothreads"` 307 DetectZeros string `xml:"detect_zeroes,attr,omitempty"` 308 Queues *uint `xml:"queues,attr"` 309 QueueSize *uint `xml:"queue_size,attr"` 310 IOMMU string `xml:"iommu,attr,omitempty"` 311 ATS string `xml:"ats,attr,omitempty"` 312 Packed string `xml:"packed,attr,omitempty"` 313 PagePerVQ string `xml:"page_per_vq,attr,omitempty"` 314 MetadataCache *DomainDiskMetadataCache `xml:"metadata_cache"` 315 } 316 317 type DomainDiskTarget struct { 318 Dev string `xml:"dev,attr,omitempty"` 319 Bus string `xml:"bus,attr,omitempty"` 320 Tray string `xml:"tray,attr,omitempty"` 321 Removable string `xml:"removable,attr,omitempty"` 322 RotationRate uint `xml:"rotation_rate,attr,omitempty"` 323 } 324 325 type DomainDiskEncryption struct { 326 Format string `xml:"format,attr,omitempty"` 327 Engine string `xml:"engine,attr,omitempty"` 328 Secrets []DomainDiskSecret `xml:"secret"` 329 } 330 331 type DomainDiskReadOnly struct { 332 } 333 334 type DomainDiskShareable struct { 335 } 336 337 type DomainDiskTransient struct { 338 ShareBacking string `xml:"shareBacking,attr,omitempty"` 339 } 340 341 type DomainDiskIOTune struct { 342 TotalBytesSec uint64 `xml:"total_bytes_sec,omitempty"` 343 ReadBytesSec uint64 `xml:"read_bytes_sec,omitempty"` 344 WriteBytesSec uint64 `xml:"write_bytes_sec,omitempty"` 345 TotalIopsSec uint64 `xml:"total_iops_sec,omitempty"` 346 ReadIopsSec uint64 `xml:"read_iops_sec,omitempty"` 347 WriteIopsSec uint64 `xml:"write_iops_sec,omitempty"` 348 TotalBytesSecMax uint64 `xml:"total_bytes_sec_max,omitempty"` 349 ReadBytesSecMax uint64 `xml:"read_bytes_sec_max,omitempty"` 350 WriteBytesSecMax uint64 `xml:"write_bytes_sec_max,omitempty"` 351 TotalIopsSecMax uint64 `xml:"total_iops_sec_max,omitempty"` 352 ReadIopsSecMax uint64 `xml:"read_iops_sec_max,omitempty"` 353 WriteIopsSecMax uint64 `xml:"write_iops_sec_max,omitempty"` 354 TotalBytesSecMaxLength uint64 `xml:"total_bytes_sec_max_length,omitempty"` 355 ReadBytesSecMaxLength uint64 `xml:"read_bytes_sec_max_length,omitempty"` 356 WriteBytesSecMaxLength uint64 `xml:"write_bytes_sec_max_length,omitempty"` 357 TotalIopsSecMaxLength uint64 `xml:"total_iops_sec_max_length,omitempty"` 358 ReadIopsSecMaxLength uint64 `xml:"read_iops_sec_max_length,omitempty"` 359 WriteIopsSecMaxLength uint64 `xml:"write_iops_sec_max_length,omitempty"` 360 SizeIopsSec uint64 `xml:"size_iops_sec,omitempty"` 361 GroupName string `xml:"group_name,omitempty"` 362 } 363 364 type DomainDiskGeometry struct { 365 Cylinders uint `xml:"cyls,attr"` 366 Headers uint `xml:"heads,attr"` 367 Sectors uint `xml:"secs,attr"` 368 Trans string `xml:"trans,attr,omitempty"` 369 } 370 371 type DomainDiskBlockIO struct { 372 LogicalBlockSize uint `xml:"logical_block_size,attr,omitempty"` 373 PhysicalBlockSize uint `xml:"physical_block_size,attr,omitempty"` 374 DiscardGranularity uint `xml:"discard_granularity,attr,omitempty"` 375 } 376 377 type DomainDiskFormat struct { 378 Type string `xml:"type,attr"` 379 MetadataCache *DomainDiskMetadataCache `xml:"metadata_cache"` 380 } 381 382 type DomainDiskBackingStore struct { 383 Index uint `xml:"index,attr,omitempty"` 384 Format *DomainDiskFormat `xml:"format"` 385 Source *DomainDiskSource `xml:"source"` 386 BackingStore *DomainDiskBackingStore `xml:"backingStore"` 387 } 388 389 type DomainDiskMirror struct { 390 Job string `xml:"job,attr,omitempty"` 391 Ready string `xml:"ready,attr,omitempty"` 392 Format *DomainDiskFormat `xml:"format"` 393 Source *DomainDiskSource `xml:"source"` 394 BackingStore *DomainDiskBackingStore `xml:"backingStore"` 395 } 396 397 type DomainBackendDomain struct { 398 Name string `xml:"name,attr"` 399 } 400 401 type DomainDisk struct { 402 XMLName xml.Name `xml:"disk"` 403 Device string `xml:"device,attr,omitempty"` 404 RawIO string `xml:"rawio,attr,omitempty"` 405 SGIO string `xml:"sgio,attr,omitempty"` 406 Snapshot string `xml:"snapshot,attr,omitempty"` 407 Model string `xml:"model,attr,omitempty"` 408 Driver *DomainDiskDriver `xml:"driver"` 409 Auth *DomainDiskAuth `xml:"auth"` 410 Source *DomainDiskSource `xml:"source"` 411 BackingStore *DomainDiskBackingStore `xml:"backingStore"` 412 BackendDomain *DomainBackendDomain `xml:"backenddomain"` 413 Geometry *DomainDiskGeometry `xml:"geometry"` 414 BlockIO *DomainDiskBlockIO `xml:"blockio"` 415 Mirror *DomainDiskMirror `xml:"mirror"` 416 Target *DomainDiskTarget `xml:"target"` 417 IOTune *DomainDiskIOTune `xml:"iotune"` 418 ReadOnly *DomainDiskReadOnly `xml:"readonly"` 419 Shareable *DomainDiskShareable `xml:"shareable"` 420 Transient *DomainDiskTransient `xml:"transient"` 421 Serial string `xml:"serial,omitempty"` 422 WWN string `xml:"wwn,omitempty"` 423 Vendor string `xml:"vendor,omitempty"` 424 Product string `xml:"product,omitempty"` 425 Encryption *DomainDiskEncryption `xml:"encryption"` 426 Boot *DomainDeviceBoot `xml:"boot"` 427 ACPI *DomainDeviceACPI `xml:"acpi"` 428 Alias *DomainAlias `xml:"alias"` 429 Address *DomainAddress `xml:"address"` 430 } 431 432 type DomainFilesystemDriver struct { 433 Type string `xml:"type,attr,omitempty"` 434 Format string `xml:"format,attr,omitempty"` 435 Name string `xml:"name,attr,omitempty"` 436 WRPolicy string `xml:"wrpolicy,attr,omitempty"` 437 IOMMU string `xml:"iommu,attr,omitempty"` 438 ATS string `xml:"ats,attr,omitempty"` 439 Packed string `xml:"packed,attr,omitempty"` 440 PagePerVQ string `xml:"page_per_vq,attr,omitempty"` 441 Queue uint `xml:"queue,attr,omitempty"` 442 } 443 444 type DomainFilesystemSource struct { 445 Mount *DomainFilesystemSourceMount `xml:"-"` 446 Block *DomainFilesystemSourceBlock `xml:"-"` 447 File *DomainFilesystemSourceFile `xml:"-"` 448 Template *DomainFilesystemSourceTemplate `xml:"-"` 449 RAM *DomainFilesystemSourceRAM `xml:"-"` 450 Bind *DomainFilesystemSourceBind `xml:"-"` 451 Volume *DomainFilesystemSourceVolume `xml:"-"` 452 } 453 454 type DomainFilesystemSourceMount struct { 455 Dir string `xml:"dir,attr,omitempty"` 456 Socket string `xml:"socket,attr,omitempty"` 457 } 458 459 type DomainFilesystemSourceBlock struct { 460 Dev string `xml:"dev,attr"` 461 } 462 463 type DomainFilesystemSourceFile struct { 464 File string `xml:"file,attr"` 465 } 466 467 type DomainFilesystemSourceTemplate struct { 468 Name string `xml:"name,attr"` 469 } 470 471 type DomainFilesystemSourceRAM struct { 472 Usage uint `xml:"usage,attr"` 473 Units string `xml:"units,attr,omitempty"` 474 } 475 476 type DomainFilesystemSourceBind struct { 477 Dir string `xml:"dir,attr"` 478 } 479 480 type DomainFilesystemSourceVolume struct { 481 Pool string `xml:"pool,attr"` 482 Volume string `xml:"volume,attr"` 483 } 484 485 type DomainFilesystemTarget struct { 486 Dir string `xml:"dir,attr"` 487 } 488 489 type DomainFilesystemReadOnly struct { 490 } 491 492 type DomainFilesystemSpaceHardLimit struct { 493 Value uint `xml:",chardata"` 494 Unit string `xml:"unit,attr,omitempty"` 495 } 496 497 type DomainFilesystemSpaceSoftLimit struct { 498 Value uint `xml:",chardata"` 499 Unit string `xml:"unit,attr,omitempty"` 500 } 501 502 type DomainFilesystemBinaryCache struct { 503 Mode string `xml:"mode,attr"` 504 } 505 506 type DomainFilesystemBinarySandbox struct { 507 Mode string `xml:"mode,attr"` 508 } 509 510 type DomainFilesystemBinaryLock struct { 511 POSIX string `xml:"posix,attr,omitempty"` 512 Flock string `xml:"flock,attr,omitempty"` 513 } 514 515 type DomainFilesystemBinaryThreadPool struct { 516 Size uint `xml:"size,attr,omitempty"` 517 } 518 519 type DomainFilesystemBinary struct { 520 Path string `xml:"path,attr,omitempty"` 521 XAttr string `xml:"xattr,attr,omitempty"` 522 Cache *DomainFilesystemBinaryCache `xml:"cache"` 523 Sandbox *DomainFilesystemBinarySandbox `xml:"sandbox"` 524 Lock *DomainFilesystemBinaryLock `xml:"lock"` 525 ThreadPool *DomainFilesystemBinaryThreadPool `xml:"thread_pool"` 526 } 527 528 type DomainFilesystemIDMapEntry struct { 529 Start uint `xml:"start,attr"` 530 Target uint `xml:"target,attr"` 531 Count uint `xml:"count,attr"` 532 } 533 534 type DomainFilesystemIDMap struct { 535 UID []DomainFilesystemIDMapEntry `xml:"uid"` 536 GID []DomainFilesystemIDMapEntry `xml:"gid"` 537 } 538 539 type DomainFilesystem struct { 540 XMLName xml.Name `xml:"filesystem"` 541 AccessMode string `xml:"accessmode,attr,omitempty"` 542 Model string `xml:"model,attr,omitempty"` 543 MultiDevs string `xml:"multidevs,attr,omitempty"` 544 FMode string `xml:"fmode,attr,omitempty"` 545 DMode string `xml:"dmode,attr,omitempty"` 546 Driver *DomainFilesystemDriver `xml:"driver"` 547 Binary *DomainFilesystemBinary `xml:"binary"` 548 IDMap *DomainFilesystemIDMap `xml:"idmap"` 549 Source *DomainFilesystemSource `xml:"source"` 550 Target *DomainFilesystemTarget `xml:"target"` 551 ReadOnly *DomainFilesystemReadOnly `xml:"readonly"` 552 SpaceHardLimit *DomainFilesystemSpaceHardLimit `xml:"space_hard_limit"` 553 SpaceSoftLimit *DomainFilesystemSpaceSoftLimit `xml:"space_soft_limit"` 554 Boot *DomainDeviceBoot `xml:"boot"` 555 ACPI *DomainDeviceACPI `xml:"acpi"` 556 Alias *DomainAlias `xml:"alias"` 557 Address *DomainAddress `xml:"address"` 558 } 559 560 type DomainInterfaceMAC struct { 561 Address string `xml:"address,attr"` 562 Type string `xml:"type,attr,omitempty"` 563 Check string `xml:"check,attr,omitempty"` 564 } 565 566 type DomainInterfaceModel struct { 567 Type string `xml:"type,attr"` 568 } 569 570 type DomainInterfaceSource struct { 571 User *DomainInterfaceSourceUser `xml:"-"` 572 Ethernet *DomainInterfaceSourceEthernet `xml:"-"` 573 VHostUser *DomainChardevSource `xml:"-"` 574 Server *DomainInterfaceSourceServer `xml:"-"` 575 Client *DomainInterfaceSourceClient `xml:"-"` 576 MCast *DomainInterfaceSourceMCast `xml:"-"` 577 Network *DomainInterfaceSourceNetwork `xml:"-"` 578 Bridge *DomainInterfaceSourceBridge `xml:"-"` 579 Internal *DomainInterfaceSourceInternal `xml:"-"` 580 Direct *DomainInterfaceSourceDirect `xml:"-"` 581 Hostdev *DomainInterfaceSourceHostdev `xml:"-"` 582 UDP *DomainInterfaceSourceUDP `xml:"-"` 583 VDPA *DomainInterfaceSourceVDPA `xml:"-"` 584 Null *DomainInterfaceSourceNull `xml:"-"` 585 VDS *DomainInterfaceSourceVDS `xml:"-"` 586 } 587 588 type DomainInterfaceSourceUser struct { 589 Dev string `xml:"dev,attr,omitempty"` 590 } 591 592 type DomainInterfaceSourcePortForward struct { 593 Proto string `xml:"proto,attr"` 594 Address string `xml:"address,attr,omitempty"` 595 Dev string `xml:"dev,attr,omitempty"` 596 Ranges []DomainInterfaceSourcePortForwardRange `xml:"range"` 597 } 598 599 type DomainInterfaceSourcePortForwardRange struct { 600 Start uint `xml:"start,attr"` 601 End uint `xml:"end,attr,omitempty"` 602 To uint `xml:"to,attr,omitempty"` 603 Exclude string `xml:"exclude,attr,omitempty"` 604 } 605 606 type DomainInterfaceSourceEthernet struct { 607 IP []DomainInterfaceIP `xml:"ip"` 608 Route []DomainInterfaceRoute `xml:"route"` 609 } 610 611 type DomainInterfaceSourceServer struct { 612 Address string `xml:"address,attr,omitempty"` 613 Port uint `xml:"port,attr,omitempty"` 614 Local *DomainInterfaceSourceLocal `xml:"local"` 615 } 616 617 type DomainInterfaceSourceClient struct { 618 Address string `xml:"address,attr,omitempty"` 619 Port uint `xml:"port,attr,omitempty"` 620 Local *DomainInterfaceSourceLocal `xml:"local"` 621 } 622 623 type DomainInterfaceSourceMCast struct { 624 Address string `xml:"address,attr,omitempty"` 625 Port uint `xml:"port,attr,omitempty"` 626 Local *DomainInterfaceSourceLocal `xml:"local"` 627 } 628 629 type DomainInterfaceSourceNetwork struct { 630 Network string `xml:"network,attr,omitempty"` 631 PortGroup string `xml:"portgroup,attr,omitempty"` 632 Bridge string `xml:"bridge,attr,omitempty"` 633 PortID string `xml:"portid,attr,omitempty"` 634 } 635 636 type DomainInterfaceSourceBridge struct { 637 Bridge string `xml:"bridge,attr"` 638 } 639 640 type DomainInterfaceSourceInternal struct { 641 Name string `xml:"name,attr,omitempty"` 642 } 643 644 type DomainInterfaceSourceDirect struct { 645 Dev string `xml:"dev,attr,omitempty"` 646 Mode string `xml:"mode,attr,omitempty"` 647 } 648 649 type DomainInterfaceSourceHostdev struct { 650 PCI *DomainHostdevSubsysPCISource `xml:"-"` 651 USB *DomainHostdevSubsysUSBSource `xml:"-"` 652 } 653 654 type DomainInterfaceSourceUDP struct { 655 Address string `xml:"address,attr,omitempty"` 656 Port uint `xml:"port,attr,omitempty"` 657 Local *DomainInterfaceSourceLocal `xml:"local"` 658 } 659 660 type DomainInterfaceSourceVDPA struct { 661 Device string `xml:"dev,attr,omitempty"` 662 } 663 664 type DomainInterfaceSourceNull struct { 665 } 666 667 type DomainInterfaceSourceVDS struct { 668 SwitchID string `xml:"switchid,attr"` 669 PortID int `xml:"portid,attr"` 670 PortGroupID string `xml:"portgroupid,attr"` 671 ConnectionID int `xml:"connectionid,attr"` 672 } 673 674 type DomainInterfaceSourceLocal struct { 675 Address string `xml:"address,attr,omitempty"` 676 Port uint `xml:"port,attr,omitempty"` 677 } 678 679 type DomainInterfaceTarget struct { 680 Dev string `xml:"dev,attr"` 681 Managed string `xml:"managed,attr,omitempty"` 682 } 683 684 type DomainInterfaceLink struct { 685 State string `xml:"state,attr"` 686 } 687 688 type DomainDeviceBoot struct { 689 Order uint `xml:"order,attr"` 690 LoadParm string `xml:"loadparm,attr,omitempty"` 691 } 692 693 type DomainInterfaceScript struct { 694 Path string `xml:"path,attr"` 695 } 696 697 type DomainInterfaceDriver struct { 698 Name string `xml:"name,attr,omitempty"` 699 TXMode string `xml:"txmode,attr,omitempty"` 700 IOEventFD string `xml:"ioeventfd,attr,omitempty"` 701 EventIDX string `xml:"event_idx,attr,omitempty"` 702 Queues uint `xml:"queues,attr,omitempty"` 703 RXQueueSize uint `xml:"rx_queue_size,attr,omitempty"` 704 TXQueueSize uint `xml:"tx_queue_size,attr,omitempty"` 705 IOMMU string `xml:"iommu,attr,omitempty"` 706 ATS string `xml:"ats,attr,omitempty"` 707 Packed string `xml:"packed,attr,omitempty"` 708 PagePerVQ string `xml:"page_per_vq,attr,omitempty"` 709 RSS string `xml:"rss,attr,omitempty"` 710 RSSHashReport string `xml:"rss_hash_report,attr,omitempty"` 711 Host *DomainInterfaceDriverHost `xml:"host"` 712 Guest *DomainInterfaceDriverGuest `xml:"guest"` 713 } 714 715 type DomainInterfaceDriverHost struct { 716 CSum string `xml:"csum,attr,omitempty"` 717 GSO string `xml:"gso,attr,omitempty"` 718 TSO4 string `xml:"tso4,attr,omitempty"` 719 TSO6 string `xml:"tso6,attr,omitempty"` 720 ECN string `xml:"ecn,attr,omitempty"` 721 UFO string `xml:"ufo,attr,omitempty"` 722 MrgRXBuf string `xml:"mrg_rxbuf,attr,omitempty"` 723 } 724 725 type DomainInterfaceDriverGuest struct { 726 CSum string `xml:"csum,attr,omitempty"` 727 TSO4 string `xml:"tso4,attr,omitempty"` 728 TSO6 string `xml:"tso6,attr,omitempty"` 729 ECN string `xml:"ecn,attr,omitempty"` 730 UFO string `xml:"ufo,attr,omitempty"` 731 } 732 733 type DomainInterfaceVirtualPort struct { 734 Params *DomainInterfaceVirtualPortParams `xml:"parameters"` 735 } 736 737 type DomainInterfaceVirtualPortParams struct { 738 Any *DomainInterfaceVirtualPortParamsAny `xml:"-"` 739 VEPA8021QBG *DomainInterfaceVirtualPortParamsVEPA8021QBG `xml:"-"` 740 VNTag8011QBH *DomainInterfaceVirtualPortParamsVNTag8021QBH `xml:"-"` 741 OpenVSwitch *DomainInterfaceVirtualPortParamsOpenVSwitch `xml:"-"` 742 MidoNet *DomainInterfaceVirtualPortParamsMidoNet `xml:"-"` 743 } 744 745 type DomainInterfaceVirtualPortParamsAny struct { 746 ManagerID *uint `xml:"managerid,attr"` 747 TypeID *uint `xml:"typeid,attr"` 748 TypeIDVersion *uint `xml:"typeidversion,attr"` 749 InstanceID string `xml:"instanceid,attr,omitempty"` 750 ProfileID string `xml:"profileid,attr,omitempty"` 751 InterfaceID string `xml:"interfaceid,attr,omitempty"` 752 } 753 754 type DomainInterfaceVirtualPortParamsVEPA8021QBG struct { 755 ManagerID *uint `xml:"managerid,attr"` 756 TypeID *uint `xml:"typeid,attr"` 757 TypeIDVersion *uint `xml:"typeidversion,attr"` 758 InstanceID string `xml:"instanceid,attr,omitempty"` 759 } 760 761 type DomainInterfaceVirtualPortParamsVNTag8021QBH struct { 762 ProfileID string `xml:"profileid,attr,omitempty"` 763 } 764 765 type DomainInterfaceVirtualPortParamsOpenVSwitch struct { 766 InterfaceID string `xml:"interfaceid,attr,omitempty"` 767 ProfileID string `xml:"profileid,attr,omitempty"` 768 } 769 770 type DomainInterfaceVirtualPortParamsMidoNet struct { 771 InterfaceID string `xml:"interfaceid,attr,omitempty"` 772 } 773 774 type DomainInterfaceBandwidthParams struct { 775 Average *int `xml:"average,attr"` 776 Peak *int `xml:"peak,attr"` 777 Burst *int `xml:"burst,attr"` 778 Floor *int `xml:"floor,attr"` 779 } 780 781 type DomainInterfaceBandwidth struct { 782 Inbound *DomainInterfaceBandwidthParams `xml:"inbound"` 783 Outbound *DomainInterfaceBandwidthParams `xml:"outbound"` 784 } 785 786 type DomainInterfaceVLan struct { 787 Trunk string `xml:"trunk,attr,omitempty"` 788 Tags []DomainInterfaceVLanTag `xml:"tag"` 789 } 790 791 type DomainInterfaceVLanTag struct { 792 ID uint `xml:"id,attr"` 793 NativeMode string `xml:"nativeMode,attr,omitempty"` 794 } 795 796 type DomainInterfaceGuest struct { 797 Dev string `xml:"dev,attr,omitempty"` 798 Actual string `xml:"actual,attr,omitempty"` 799 } 800 801 type DomainInterfaceFilterRef struct { 802 Filter string `xml:"filter,attr"` 803 Parameters []DomainInterfaceFilterParam `xml:"parameter"` 804 } 805 806 type DomainInterfaceFilterParam struct { 807 Name string `xml:"name,attr"` 808 Value string `xml:"value,attr"` 809 } 810 811 type DomainInterfaceBackend struct { 812 Type string `xml:"type,attr,omitempty"` 813 Tap string `xml:"tap,attr,omitempty"` 814 VHost string `xml:"vhost,attr,omitempty"` 815 LogFile string `xml:"logFile,attr,omitempty"` 816 } 817 818 type DomainInterfaceTune struct { 819 SndBuf uint `xml:"sndbuf"` 820 } 821 822 type DomainInterfaceMTU struct { 823 Size uint `xml:"size,attr"` 824 } 825 826 type DomainInterfaceCoalesce struct { 827 RX *DomainInterfaceCoalesceRX `xml:"rx"` 828 } 829 830 type DomainInterfaceCoalesceRX struct { 831 Frames *DomainInterfaceCoalesceRXFrames `xml:"frames"` 832 } 833 834 type DomainInterfaceCoalesceRXFrames struct { 835 Max *uint `xml:"max,attr"` 836 } 837 838 type DomainROM struct { 839 Bar string `xml:"bar,attr,omitempty"` 840 File *string `xml:"file,attr"` 841 Enabled string `xml:"enabled,attr,omitempty"` 842 } 843 844 type DomainInterfaceIP struct { 845 Address string `xml:"address,attr"` 846 Family string `xml:"family,attr,omitempty"` 847 Prefix uint `xml:"prefix,attr,omitempty"` 848 Peer string `xml:"peer,attr,omitempty"` 849 } 850 851 type DomainInterfaceRoute struct { 852 Family string `xml:"family,attr,omitempty"` 853 Address string `xml:"address,attr"` 854 Netmask string `xml:"netmask,attr,omitempty"` 855 Prefix uint `xml:"prefix,attr,omitempty"` 856 Gateway string `xml:"gateway,attr"` 857 Metric uint `xml:"metric,attr,omitempty"` 858 } 859 860 type DomainInterfaceTeaming struct { 861 Type string `xml:"type,attr"` 862 Persistent string `xml:"persistent,attr,omitempty"` 863 } 864 865 type DomainInterfacePortOptions struct { 866 Isolated string `xml:"isolated,attr,omitempty"` 867 } 868 869 type DomainInterface struct { 870 XMLName xml.Name `xml:"interface"` 871 Managed string `xml:"managed,attr,omitempty"` 872 TrustGuestRXFilters string `xml:"trustGuestRxFilters,attr,omitempty"` 873 MAC *DomainInterfaceMAC `xml:"mac"` 874 Source *DomainInterfaceSource `xml:"source"` 875 Boot *DomainDeviceBoot `xml:"boot"` 876 VLan *DomainInterfaceVLan `xml:"vlan"` 877 VirtualPort *DomainInterfaceVirtualPort `xml:"virtualport"` 878 IP []DomainInterfaceIP `xml:"ip"` 879 Route []DomainInterfaceRoute `xml:"route"` 880 PortForward []DomainInterfaceSourcePortForward `xml:"portForward"` 881 Script *DomainInterfaceScript `xml:"script"` 882 DownScript *DomainInterfaceScript `xml:"downscript"` 883 BackendDomain *DomainBackendDomain `xml:"backenddomain"` 884 Target *DomainInterfaceTarget `xml:"target"` 885 Guest *DomainInterfaceGuest `xml:"guest"` 886 Model *DomainInterfaceModel `xml:"model"` 887 Driver *DomainInterfaceDriver `xml:"driver"` 888 Backend *DomainInterfaceBackend `xml:"backend"` 889 FilterRef *DomainInterfaceFilterRef `xml:"filterref"` 890 Tune *DomainInterfaceTune `xml:"tune"` 891 Teaming *DomainInterfaceTeaming `xml:"teaming"` 892 Link *DomainInterfaceLink `xml:"link"` 893 MTU *DomainInterfaceMTU `xml:"mtu"` 894 Bandwidth *DomainInterfaceBandwidth `xml:"bandwidth"` 895 PortOptions *DomainInterfacePortOptions `xml:"port"` 896 Coalesce *DomainInterfaceCoalesce `xml:"coalesce"` 897 ROM *DomainROM `xml:"rom"` 898 ACPI *DomainDeviceACPI `xml:"acpi"` 899 Alias *DomainAlias `xml:"alias"` 900 Address *DomainAddress `xml:"address"` 901 } 902 903 type DomainChardevSource struct { 904 Null *DomainChardevSourceNull `xml:"-"` 905 VC *DomainChardevSourceVC `xml:"-"` 906 Pty *DomainChardevSourcePty `xml:"-"` 907 Dev *DomainChardevSourceDev `xml:"-"` 908 File *DomainChardevSourceFile `xml:"-"` 909 Pipe *DomainChardevSourcePipe `xml:"-"` 910 StdIO *DomainChardevSourceStdIO `xml:"-"` 911 UDP *DomainChardevSourceUDP `xml:"-"` 912 TCP *DomainChardevSourceTCP `xml:"-"` 913 UNIX *DomainChardevSourceUNIX `xml:"-"` 914 SpiceVMC *DomainChardevSourceSpiceVMC `xml:"-"` 915 SpicePort *DomainChardevSourceSpicePort `xml:"-"` 916 NMDM *DomainChardevSourceNMDM `xml:"-"` 917 QEMUVDAgent *DomainChardevSourceQEMUVDAgent `xml:"-"` 918 DBus *DomainChardevSourceDBus `xml:"-"` 919 } 920 921 type DomainChardevSourceNull struct { 922 } 923 924 type DomainChardevSourceVC struct { 925 } 926 927 type DomainChardevSourcePty struct { 928 Path string `xml:"path,attr"` 929 SecLabel []DomainDeviceSecLabel `xml:"seclabel"` 930 } 931 932 type DomainChardevSourceDev struct { 933 Path string `xml:"path,attr"` 934 SecLabel []DomainDeviceSecLabel `xml:"seclabel"` 935 } 936 937 type DomainChardevSourceFile struct { 938 Path string `xml:"path,attr"` 939 Append string `xml:"append,attr,omitempty"` 940 SecLabel []DomainDeviceSecLabel `xml:"seclabel"` 941 } 942 943 type DomainChardevSourcePipe struct { 944 Path string `xml:"path,attr"` 945 SecLabel []DomainDeviceSecLabel `xml:"seclabel"` 946 } 947 948 type DomainChardevSourceStdIO struct { 949 } 950 951 type DomainChardevSourceUDP struct { 952 BindHost string `xml:"-"` 953 BindService string `xml:"-"` 954 ConnectHost string `xml:"-"` 955 ConnectService string `xml:"-"` 956 } 957 958 type DomainChardevSourceReconnect struct { 959 Enabled string `xml:"enabled,attr"` 960 Timeout *uint `xml:"timeout,attr"` 961 } 962 963 type DomainChardevSourceTCP struct { 964 Mode string `xml:"mode,attr,omitempty"` 965 Host string `xml:"host,attr,omitempty"` 966 Service string `xml:"service,attr,omitempty"` 967 TLS string `xml:"tls,attr,omitempty"` 968 Reconnect *DomainChardevSourceReconnect `xml:"reconnect"` 969 } 970 971 type DomainChardevSourceUNIX struct { 972 Mode string `xml:"mode,attr,omitempty"` 973 Path string `xml:"path,attr,omitempty"` 974 Reconnect *DomainChardevSourceReconnect `xml:"reconnect"` 975 SecLabel []DomainDeviceSecLabel `xml:"seclabel"` 976 } 977 978 type DomainChardevSourceSpiceVMC struct { 979 } 980 981 type DomainChardevSourceSpicePort struct { 982 Channel string `xml:"channel,attr"` 983 } 984 985 type DomainChardevSourceNMDM struct { 986 Master string `xml:"master,attr"` 987 Slave string `xml:"slave,attr"` 988 } 989 990 type DomainChardevSourceQEMUVDAgentMouse struct { 991 Mode string `xml:"mode,attr"` 992 } 993 994 type DomainChardevSourceQEMUVDAgentClipBoard struct { 995 CopyPaste string `xml:"copypaste,attr"` 996 } 997 998 type DomainChardevSourceQEMUVDAgent struct { 999 Mouse *DomainChardevSourceQEMUVDAgentMouse `xml:"mouse"` 1000 ClipBoard *DomainChardevSourceQEMUVDAgentClipBoard `xml:"clipboard"` 1001 } 1002 1003 type DomainChardevSourceDBus struct { 1004 Channel string `xml:"channel,attr,omitempty"` 1005 } 1006 1007 type DomainChardevTarget struct { 1008 Type string `xml:"type,attr,omitempty"` 1009 Name string `xml:"name,attr,omitempty"` 1010 State string `xml:"state,attr,omitempty"` // is guest agent connected? 1011 Port *uint `xml:"port,attr"` 1012 } 1013 1014 type DomainConsoleTarget struct { 1015 Type string `xml:"type,attr,omitempty"` 1016 Port *uint `xml:"port,attr"` 1017 } 1018 1019 type DomainSerialTarget struct { 1020 Type string `xml:"type,attr,omitempty"` 1021 Port *uint `xml:"port,attr"` 1022 Model *DomainSerialTargetModel `xml:"model"` 1023 } 1024 1025 type DomainSerialTargetModel struct { 1026 Name string `xml:"name,attr,omitempty"` 1027 } 1028 1029 type DomainParallelTarget struct { 1030 Type string `xml:"type,attr,omitempty"` 1031 Port *uint `xml:"port,attr"` 1032 } 1033 1034 type DomainChannelTarget struct { 1035 VirtIO *DomainChannelTargetVirtIO `xml:"-"` 1036 Xen *DomainChannelTargetXen `xml:"-"` 1037 GuestFWD *DomainChannelTargetGuestFWD `xml:"-"` 1038 } 1039 1040 type DomainChannelTargetVirtIO struct { 1041 Name string `xml:"name,attr,omitempty"` 1042 State string `xml:"state,attr,omitempty"` // is guest agent connected? 1043 } 1044 1045 type DomainChannelTargetXen struct { 1046 Name string `xml:"name,attr,omitempty"` 1047 State string `xml:"state,attr,omitempty"` // is guest agent connected? 1048 } 1049 1050 type DomainChannelTargetGuestFWD struct { 1051 Address string `xml:"address,attr,omitempty"` 1052 Port string `xml:"port,attr,omitempty"` 1053 } 1054 1055 type DomainAlias struct { 1056 Name string `xml:"name,attr"` 1057 } 1058 1059 type DomainDeviceACPI struct { 1060 Index uint `xml:"index,attr,omitempty"` 1061 } 1062 1063 type DomainAddressPCI struct { 1064 Domain *uint `xml:"domain,attr"` 1065 Bus *uint `xml:"bus,attr"` 1066 Slot *uint `xml:"slot,attr"` 1067 Function *uint `xml:"function,attr"` 1068 MultiFunction string `xml:"multifunction,attr,omitempty"` 1069 ZPCI *DomainAddressZPCI `xml:"zpci"` 1070 } 1071 1072 type DomainAddressZPCI struct { 1073 UID *uint `xml:"uid,attr,omitempty"` 1074 FID *uint `xml:"fid,attr,omitempty"` 1075 } 1076 1077 type DomainAddressUSB struct { 1078 Bus *uint `xml:"bus,attr"` 1079 Port string `xml:"port,attr,omitempty"` 1080 Device *uint `xml:"device,attr"` 1081 } 1082 1083 type DomainAddressDrive struct { 1084 Controller *uint `xml:"controller,attr"` 1085 Bus *uint `xml:"bus,attr"` 1086 Target *uint `xml:"target,attr"` 1087 Unit *uint `xml:"unit,attr"` 1088 } 1089 1090 type DomainAddressDIMM struct { 1091 Slot *uint `xml:"slot,attr"` 1092 Base *uint64 `xml:"base,attr"` 1093 } 1094 1095 type DomainAddressISA struct { 1096 IOBase *uint `xml:"iobase,attr"` 1097 IRQ *uint `xml:"irq,attr"` 1098 } 1099 1100 type DomainAddressVirtioMMIO struct { 1101 } 1102 1103 type DomainAddressCCW struct { 1104 CSSID *uint `xml:"cssid,attr"` 1105 SSID *uint `xml:"ssid,attr"` 1106 DevNo *uint `xml:"devno,attr"` 1107 } 1108 1109 type DomainAddressVirtioSerial struct { 1110 Controller *uint `xml:"controller,attr"` 1111 Bus *uint `xml:"bus,attr"` 1112 Port *uint `xml:"port,attr"` 1113 } 1114 1115 type DomainAddressSpaprVIO struct { 1116 Reg *uint64 `xml:"reg,attr"` 1117 } 1118 1119 type DomainAddressCCID struct { 1120 Controller *uint `xml:"controller,attr"` 1121 Slot *uint `xml:"slot,attr"` 1122 } 1123 1124 type DomainAddressVirtioS390 struct { 1125 } 1126 1127 type DomainAddressUnassigned struct { 1128 } 1129 1130 type DomainAddress struct { 1131 PCI *DomainAddressPCI 1132 Drive *DomainAddressDrive 1133 VirtioSerial *DomainAddressVirtioSerial 1134 CCID *DomainAddressCCID 1135 USB *DomainAddressUSB 1136 SpaprVIO *DomainAddressSpaprVIO 1137 VirtioS390 *DomainAddressVirtioS390 1138 CCW *DomainAddressCCW 1139 VirtioMMIO *DomainAddressVirtioMMIO 1140 ISA *DomainAddressISA 1141 DIMM *DomainAddressDIMM 1142 Unassigned *DomainAddressUnassigned 1143 } 1144 1145 type DomainChardevLog struct { 1146 File string `xml:"file,attr"` 1147 Append string `xml:"append,attr,omitempty"` 1148 } 1149 1150 type DomainConsole struct { 1151 XMLName xml.Name `xml:"console"` 1152 TTY string `xml:"tty,attr,omitempty"` 1153 Source *DomainChardevSource `xml:"source"` 1154 Protocol *DomainChardevProtocol `xml:"protocol"` 1155 Target *DomainConsoleTarget `xml:"target"` 1156 Log *DomainChardevLog `xml:"log"` 1157 ACPI *DomainDeviceACPI `xml:"acpi"` 1158 Alias *DomainAlias `xml:"alias"` 1159 Address *DomainAddress `xml:"address"` 1160 } 1161 1162 type DomainSerial struct { 1163 XMLName xml.Name `xml:"serial"` 1164 Source *DomainChardevSource `xml:"source"` 1165 Protocol *DomainChardevProtocol `xml:"protocol"` 1166 Target *DomainSerialTarget `xml:"target"` 1167 Log *DomainChardevLog `xml:"log"` 1168 ACPI *DomainDeviceACPI `xml:"acpi"` 1169 Alias *DomainAlias `xml:"alias"` 1170 Address *DomainAddress `xml:"address"` 1171 } 1172 1173 type DomainParallel struct { 1174 XMLName xml.Name `xml:"parallel"` 1175 Source *DomainChardevSource `xml:"source"` 1176 Protocol *DomainChardevProtocol `xml:"protocol"` 1177 Target *DomainParallelTarget `xml:"target"` 1178 Log *DomainChardevLog `xml:"log"` 1179 ACPI *DomainDeviceACPI `xml:"acpi"` 1180 Alias *DomainAlias `xml:"alias"` 1181 Address *DomainAddress `xml:"address"` 1182 } 1183 1184 type DomainChardevProtocol struct { 1185 Type string `xml:"type,attr"` 1186 } 1187 1188 type DomainChannel struct { 1189 XMLName xml.Name `xml:"channel"` 1190 Source *DomainChardevSource `xml:"source"` 1191 Protocol *DomainChardevProtocol `xml:"protocol"` 1192 Target *DomainChannelTarget `xml:"target"` 1193 Log *DomainChardevLog `xml:"log"` 1194 ACPI *DomainDeviceACPI `xml:"acpi"` 1195 Alias *DomainAlias `xml:"alias"` 1196 Address *DomainAddress `xml:"address"` 1197 } 1198 1199 type DomainRedirDev struct { 1200 XMLName xml.Name `xml:"redirdev"` 1201 Bus string `xml:"bus,attr,omitempty"` 1202 Source *DomainChardevSource `xml:"source"` 1203 Protocol *DomainChardevProtocol `xml:"protocol"` 1204 Boot *DomainDeviceBoot `xml:"boot"` 1205 ACPI *DomainDeviceACPI `xml:"acpi"` 1206 Alias *DomainAlias `xml:"alias"` 1207 Address *DomainAddress `xml:"address"` 1208 } 1209 1210 type DomainRedirFilter struct { 1211 USB []DomainRedirFilterUSB `xml:"usbdev"` 1212 } 1213 1214 type DomainRedirFilterUSB struct { 1215 Class *uint `xml:"class,attr"` 1216 Vendor *uint `xml:"vendor,attr"` 1217 Product *uint `xml:"product,attr"` 1218 Version string `xml:"version,attr,omitempty"` 1219 Allow string `xml:"allow,attr"` 1220 } 1221 1222 type DomainInput struct { 1223 XMLName xml.Name `xml:"input"` 1224 Type string `xml:"type,attr"` 1225 Bus string `xml:"bus,attr,omitempty"` 1226 Model string `xml:"model,attr,omitempty"` 1227 Driver *DomainInputDriver `xml:"driver"` 1228 Source *DomainInputSource `xml:"source"` 1229 ACPI *DomainDeviceACPI `xml:"acpi"` 1230 Alias *DomainAlias `xml:"alias"` 1231 Address *DomainAddress `xml:"address"` 1232 } 1233 1234 type DomainInputDriver struct { 1235 IOMMU string `xml:"iommu,attr,omitempty"` 1236 ATS string `xml:"ats,attr,omitempty"` 1237 Packed string `xml:"packed,attr,omitempty"` 1238 PagePerVQ string `xml:"page_per_vq,attr,omitempty"` 1239 } 1240 1241 type DomainInputSource struct { 1242 Passthrough *DomainInputSourcePassthrough `xml:"-"` 1243 EVDev *DomainInputSourceEVDev `xml:"-"` 1244 } 1245 1246 type DomainInputSourcePassthrough struct { 1247 EVDev string `xml:"evdev,attr"` 1248 } 1249 1250 type DomainInputSourceEVDev struct { 1251 Dev string `xml:"dev,attr"` 1252 Grab string `xml:"grab,attr,omitempty"` 1253 GrabToggle string `xml:"grabToggle,attr,omitempty"` 1254 Repeat string `xml:"repeat,attr,omitempty"` 1255 } 1256 1257 type DomainGraphicListenerAddress struct { 1258 Address string `xml:"address,attr,omitempty"` 1259 } 1260 1261 type DomainGraphicListenerNetwork struct { 1262 Address string `xml:"address,attr,omitempty"` 1263 Network string `xml:"network,attr,omitempty"` 1264 } 1265 1266 type DomainGraphicListenerSocket struct { 1267 Socket string `xml:"socket,attr,omitempty"` 1268 } 1269 1270 type DomainGraphicListener struct { 1271 Address *DomainGraphicListenerAddress `xml:"-"` 1272 Network *DomainGraphicListenerNetwork `xml:"-"` 1273 Socket *DomainGraphicListenerSocket `xml:"-"` 1274 } 1275 1276 type DomainGraphicChannel struct { 1277 Name string `xml:"name,attr,omitempty"` 1278 Mode string `xml:"mode,attr,omitempty"` 1279 } 1280 1281 type DomainGraphicFileTransfer struct { 1282 Enable string `xml:"enable,attr,omitempty"` 1283 } 1284 1285 type DomainGraphicsSDLGL struct { 1286 Enable string `xml:"enable,attr,omitempty"` 1287 } 1288 1289 type DomainGraphicSDL struct { 1290 Display string `xml:"display,attr,omitempty"` 1291 XAuth string `xml:"xauth,attr,omitempty"` 1292 FullScreen string `xml:"fullscreen,attr,omitempty"` 1293 GL *DomainGraphicsSDLGL `xml:"gl"` 1294 } 1295 1296 type DomainGraphicVNC struct { 1297 Socket string `xml:"socket,attr,omitempty"` 1298 Port int `xml:"port,attr,omitempty"` 1299 AutoPort string `xml:"autoport,attr,omitempty"` 1300 WebSocket int `xml:"websocket,attr,omitempty"` 1301 Keymap string `xml:"keymap,attr,omitempty"` 1302 SharePolicy string `xml:"sharePolicy,attr,omitempty"` 1303 Passwd string `xml:"passwd,attr,omitempty"` 1304 PasswdValidTo string `xml:"passwdValidTo,attr,omitempty"` 1305 Connected string `xml:"connected,attr,omitempty"` 1306 PowerControl string `xml:"powerControl,attr,omitempty"` 1307 Listen string `xml:"listen,attr,omitempty"` 1308 Listeners []DomainGraphicListener `xml:"listen"` 1309 } 1310 1311 type DomainGraphicRDP struct { 1312 Port int `xml:"port,attr,omitempty"` 1313 AutoPort string `xml:"autoport,attr,omitempty"` 1314 ReplaceUser string `xml:"replaceUser,attr,omitempty"` 1315 MultiUser string `xml:"multiUser,attr,omitempty"` 1316 Listen string `xml:"listen,attr,omitempty"` 1317 Listeners []DomainGraphicListener `xml:"listen"` 1318 } 1319 1320 type DomainGraphicDesktop struct { 1321 Display string `xml:"display,attr,omitempty"` 1322 FullScreen string `xml:"fullscreen,attr,omitempty"` 1323 } 1324 1325 type DomainGraphicSpiceChannel struct { 1326 Name string `xml:"name,attr"` 1327 Mode string `xml:"mode,attr"` 1328 } 1329 1330 type DomainGraphicSpiceImage struct { 1331 Compression string `xml:"compression,attr"` 1332 } 1333 1334 type DomainGraphicSpiceJPEG struct { 1335 Compression string `xml:"compression,attr"` 1336 } 1337 1338 type DomainGraphicSpiceZLib struct { 1339 Compression string `xml:"compression,attr"` 1340 } 1341 1342 type DomainGraphicSpicePlayback struct { 1343 Compression string `xml:"compression,attr"` 1344 } 1345 1346 type DomainGraphicSpiceStreaming struct { 1347 Mode string `xml:"mode,attr"` 1348 } 1349 1350 type DomainGraphicSpiceMouse struct { 1351 Mode string `xml:"mode,attr"` 1352 } 1353 1354 type DomainGraphicSpiceClipBoard struct { 1355 CopyPaste string `xml:"copypaste,attr"` 1356 } 1357 1358 type DomainGraphicSpiceFileTransfer struct { 1359 Enable string `xml:"enable,attr"` 1360 } 1361 1362 type DomainGraphicSpiceGL struct { 1363 Enable string `xml:"enable,attr,omitempty"` 1364 RenderNode string `xml:"rendernode,attr,omitempty"` 1365 } 1366 1367 type DomainGraphicSpice struct { 1368 Port int `xml:"port,attr,omitempty"` 1369 TLSPort int `xml:"tlsPort,attr,omitempty"` 1370 AutoPort string `xml:"autoport,attr,omitempty"` 1371 Listen string `xml:"listen,attr,omitempty"` 1372 Keymap string `xml:"keymap,attr,omitempty"` 1373 DefaultMode string `xml:"defaultMode,attr,omitempty"` 1374 Passwd string `xml:"passwd,attr,omitempty"` 1375 PasswdValidTo string `xml:"passwdValidTo,attr,omitempty"` 1376 Connected string `xml:"connected,attr,omitempty"` 1377 Listeners []DomainGraphicListener `xml:"listen"` 1378 Channel []DomainGraphicSpiceChannel `xml:"channel"` 1379 Image *DomainGraphicSpiceImage `xml:"image"` 1380 JPEG *DomainGraphicSpiceJPEG `xml:"jpeg"` 1381 ZLib *DomainGraphicSpiceZLib `xml:"zlib"` 1382 Playback *DomainGraphicSpicePlayback `xml:"playback"` 1383 Streaming *DomainGraphicSpiceStreaming `xml:"streaming"` 1384 Mouse *DomainGraphicSpiceMouse `xml:"mouse"` 1385 ClipBoard *DomainGraphicSpiceClipBoard `xml:"clipboard"` 1386 FileTransfer *DomainGraphicSpiceFileTransfer `xml:"filetransfer"` 1387 GL *DomainGraphicSpiceGL `xml:"gl"` 1388 } 1389 1390 type DomainGraphicEGLHeadlessGL struct { 1391 RenderNode string `xml:"rendernode,attr,omitempty"` 1392 } 1393 1394 type DomainGraphicEGLHeadless struct { 1395 GL *DomainGraphicEGLHeadlessGL `xml:"gl"` 1396 } 1397 1398 type DomainGraphicDBusGL struct { 1399 Enable string `xml:"enable,attr,omitempty"` 1400 RenderNode string `xml:"rendernode,attr,omitempty"` 1401 } 1402 1403 type DomainGraphicDBus struct { 1404 Address string `xml:"address,attr,omitempty"` 1405 P2P string `xml:"p2p,attr,omitempty"` 1406 GL *DomainGraphicDBusGL `xml:"gl"` 1407 } 1408 1409 type DomainGraphicAudio struct { 1410 ID uint `xml:"id,attr,omitempty"` 1411 } 1412 1413 type DomainGraphic struct { 1414 XMLName xml.Name `xml:"graphics"` 1415 SDL *DomainGraphicSDL `xml:"-"` 1416 VNC *DomainGraphicVNC `xml:"-"` 1417 RDP *DomainGraphicRDP `xml:"-"` 1418 Desktop *DomainGraphicDesktop `xml:"-"` 1419 Spice *DomainGraphicSpice `xml:"-"` 1420 EGLHeadless *DomainGraphicEGLHeadless `xml:"-"` 1421 DBus *DomainGraphicDBus `xml:"-"` 1422 Audio *DomainGraphicAudio `xml:"audio"` 1423 } 1424 1425 type DomainVideoAccel struct { 1426 Accel3D string `xml:"accel3d,attr,omitempty"` 1427 Accel2D string `xml:"accel2d,attr,omitempty"` 1428 RenderNode string `xml:"rendernode,attr,omitempty"` 1429 } 1430 1431 type DomainVideoResolution struct { 1432 X uint `xml:"x,attr"` 1433 Y uint `xml:"y,attr"` 1434 } 1435 1436 type DomainVideoModel struct { 1437 Type string `xml:"type,attr"` 1438 Heads uint `xml:"heads,attr,omitempty"` 1439 Ram uint `xml:"ram,attr,omitempty"` 1440 VRam uint `xml:"vram,attr,omitempty"` 1441 VRam64 uint `xml:"vram64,attr,omitempty"` 1442 VGAMem uint `xml:"vgamem,attr,omitempty"` 1443 Primary string `xml:"primary,attr,omitempty"` 1444 Blob string `xml:"blob,attr,omitempty"` 1445 Accel *DomainVideoAccel `xml:"acceleration"` 1446 Resolution *DomainVideoResolution `xml:"resolution"` 1447 } 1448 1449 type DomainVideo struct { 1450 XMLName xml.Name `xml:"video"` 1451 Model DomainVideoModel `xml:"model"` 1452 Driver *DomainVideoDriver `xml:"driver"` 1453 ACPI *DomainDeviceACPI `xml:"acpi"` 1454 Alias *DomainAlias `xml:"alias"` 1455 Address *DomainAddress `xml:"address"` 1456 } 1457 1458 type DomainVideoDriver struct { 1459 Name string `xml:"name,attr,omitempty"` 1460 VGAConf string `xml:"vgaconf,attr,omitempty"` 1461 IOMMU string `xml:"iommu,attr,omitempty"` 1462 ATS string `xml:"ats,attr,omitempty"` 1463 Packed string `xml:"packed,attr,omitempty"` 1464 PagePerVQ string `xml:"page_per_vq,attr,omitempty"` 1465 } 1466 1467 type DomainMemBalloonStats struct { 1468 Period uint `xml:"period,attr"` 1469 } 1470 1471 type DomainMemBalloon struct { 1472 XMLName xml.Name `xml:"memballoon"` 1473 Model string `xml:"model,attr"` 1474 AutoDeflate string `xml:"autodeflate,attr,omitempty"` 1475 FreePageReporting string `xml:"freePageReporting,attr,omitempty"` 1476 Driver *DomainMemBalloonDriver `xml:"driver"` 1477 Stats *DomainMemBalloonStats `xml:"stats"` 1478 ACPI *DomainDeviceACPI `xml:"acpi"` 1479 Alias *DomainAlias `xml:"alias"` 1480 Address *DomainAddress `xml:"address"` 1481 } 1482 1483 type DomainVSockCID struct { 1484 Auto string `xml:"auto,attr,omitempty"` 1485 Address string `xml:"address,attr,omitempty"` 1486 } 1487 1488 type DomainVSockDriver struct { 1489 IOMMU string `xml:"iommu,attr,omitempty"` 1490 ATS string `xml:"ats,attr,omitempty"` 1491 Packed string `xml:"packed,attr,omitempty"` 1492 PagePerVQ string `xml:"page_per_vq,attr,omitempty"` 1493 } 1494 1495 type DomainVSock struct { 1496 XMLName xml.Name `xml:"vsock"` 1497 Model string `xml:"model,attr,omitempty"` 1498 CID *DomainVSockCID `xml:"cid"` 1499 Driver *DomainVSockDriver `xml:"driver"` 1500 ACPI *DomainDeviceACPI `xml:"acpi"` 1501 Alias *DomainAlias `xml:"alias"` 1502 Address *DomainAddress `xml:"address"` 1503 } 1504 1505 type DomainMemBalloonDriver struct { 1506 IOMMU string `xml:"iommu,attr,omitempty"` 1507 ATS string `xml:"ats,attr,omitempty"` 1508 Packed string `xml:"packed,attr,omitempty"` 1509 PagePerVQ string `xml:"page_per_vq,attr,omitempty"` 1510 } 1511 1512 type DomainPanic struct { 1513 XMLName xml.Name `xml:"panic"` 1514 Model string `xml:"model,attr,omitempty"` 1515 ACPI *DomainDeviceACPI `xml:"acpi"` 1516 Alias *DomainAlias `xml:"alias"` 1517 Address *DomainAddress `xml:"address"` 1518 } 1519 1520 type DomainSoundCodec struct { 1521 Type string `xml:"type,attr"` 1522 } 1523 1524 type DomainSound struct { 1525 XMLName xml.Name `xml:"sound"` 1526 Model string `xml:"model,attr"` 1527 MultiChannel string `xml:"multichannel,attr,omitempty"` 1528 Codec []DomainSoundCodec `xml:"codec"` 1529 Audio *DomainSoundAudio `xml:"audio"` 1530 ACPI *DomainDeviceACPI `xml:"acpi"` 1531 Alias *DomainAlias `xml:"alias"` 1532 Address *DomainAddress `xml:"address"` 1533 } 1534 1535 type DomainSoundAudio struct { 1536 ID uint `xml:"id,attr"` 1537 } 1538 1539 type DomainAudio struct { 1540 XMLName xml.Name `xml:"audio"` 1541 ID int `xml:"id,attr"` 1542 TimerPeriod uint `xml:"timerPeriod,attr,omitempty"` 1543 None *DomainAudioNone `xml:"-"` 1544 ALSA *DomainAudioALSA `xml:"-"` 1545 CoreAudio *DomainAudioCoreAudio `xml:"-"` 1546 Jack *DomainAudioJack `xml:"-"` 1547 OSS *DomainAudioOSS `xml:"-"` 1548 PulseAudio *DomainAudioPulseAudio `xml:"-"` 1549 SDL *DomainAudioSDL `xml:"-"` 1550 SPICE *DomainAudioSPICE `xml:"-"` 1551 File *DomainAudioFile `xml:"-"` 1552 DBus *DomainAudioDBus `xml:"-"` 1553 PipeWire *DomainAudioPipeWire `xml:"-"` 1554 } 1555 1556 type DomainAudioChannel struct { 1557 MixingEngine string `xml:"mixingEngine,attr,omitempty"` 1558 FixedSettings string `xml:"fixedSettings,attr,omitempty"` 1559 Voices uint `xml:"voices,attr,omitempty"` 1560 Settings *DomainAudioChannelSettings `xml:"settings"` 1561 BufferLength uint `xml:"bufferLength,attr,omitempty"` 1562 } 1563 1564 type DomainAudioChannelSettings struct { 1565 Frequency uint `xml:"frequency,attr,omitempty"` 1566 Channels uint `xml:"channels,attr,omitempty"` 1567 Format string `xml:"format,attr,omitempty"` 1568 } 1569 1570 type DomainAudioNone struct { 1571 Input *DomainAudioNoneChannel `xml:"input"` 1572 Output *DomainAudioNoneChannel `xml:"output"` 1573 } 1574 1575 type DomainAudioNoneChannel struct { 1576 DomainAudioChannel 1577 } 1578 1579 type DomainAudioALSA struct { 1580 Input *DomainAudioALSAChannel `xml:"input"` 1581 Output *DomainAudioALSAChannel `xml:"output"` 1582 } 1583 1584 type DomainAudioALSAChannel struct { 1585 DomainAudioChannel 1586 Dev string `xml:"dev,attr,omitempty"` 1587 } 1588 1589 type DomainAudioCoreAudio struct { 1590 Input *DomainAudioCoreAudioChannel `xml:"input"` 1591 Output *DomainAudioCoreAudioChannel `xml:"output"` 1592 } 1593 1594 type DomainAudioCoreAudioChannel struct { 1595 DomainAudioChannel 1596 BufferCount uint `xml:"bufferCount,attr,omitempty"` 1597 } 1598 1599 type DomainAudioJack struct { 1600 Input *DomainAudioJackChannel `xml:"input"` 1601 Output *DomainAudioJackChannel `xml:"output"` 1602 } 1603 1604 type DomainAudioJackChannel struct { 1605 DomainAudioChannel 1606 ServerName string `xml:"serverName,attr,omitempty"` 1607 ClientName string `xml:"clientName,attr,omitempty"` 1608 ConnectPorts string `xml:"connectPorts,attr,omitempty"` 1609 ExactName string `xml:"exactName,attr,omitempty"` 1610 } 1611 1612 type DomainAudioOSS struct { 1613 TryMMap string `xml:"tryMMap,attr,omitempty"` 1614 Exclusive string `xml:"exclusive,attr,omitempty"` 1615 DSPPolicy *int `xml:"dspPolicy,attr"` 1616 1617 Input *DomainAudioOSSChannel `xml:"input"` 1618 Output *DomainAudioOSSChannel `xml:"output"` 1619 } 1620 1621 type DomainAudioOSSChannel struct { 1622 DomainAudioChannel 1623 Dev string `xml:"dev,attr,omitempty"` 1624 BufferCount uint `xml:"bufferCount,attr,omitempty"` 1625 TryPoll string `xml:"tryPoll,attr,omitempty"` 1626 } 1627 1628 type DomainAudioPulseAudio struct { 1629 ServerName string `xml:"serverName,attr,omitempty"` 1630 Input *DomainAudioPulseAudioChannel `xml:"input"` 1631 Output *DomainAudioPulseAudioChannel `xml:"output"` 1632 } 1633 1634 type DomainAudioPulseAudioChannel struct { 1635 DomainAudioChannel 1636 Name string `xml:"name,attr,omitempty"` 1637 StreamName string `xml:"streamName,attr,omitempty"` 1638 Latency uint `xml:"latency,attr,omitempty"` 1639 } 1640 1641 type DomainAudioPipeWire struct { 1642 RuntimeDir string `xml:"runtimeDir,attr,omitempty"` 1643 Input *DomainAudioPulseAudioChannel `xml:"input"` 1644 Output *DomainAudioPulseAudioChannel `xml:"output"` 1645 } 1646 1647 type DomainAudioPipeWireChannel struct { 1648 DomainAudioChannel 1649 Name string `xml:"name,attr,omitempty"` 1650 StreamName string `xml:"streamName,attr,omitempty"` 1651 Latency uint `xml:"latency,attr,omitempty"` 1652 } 1653 1654 type DomainAudioSDL struct { 1655 Driver string `xml:"driver,attr,omitempty"` 1656 Input *DomainAudioSDLChannel `xml:"input"` 1657 Output *DomainAudioSDLChannel `xml:"output"` 1658 } 1659 1660 type DomainAudioSDLChannel struct { 1661 DomainAudioChannel 1662 BufferCount uint `xml:"bufferCount,attr,omitempty"` 1663 } 1664 1665 type DomainAudioSPICE struct { 1666 Input *DomainAudioSPICEChannel `xml:"input"` 1667 Output *DomainAudioSPICEChannel `xml:"output"` 1668 } 1669 1670 type DomainAudioSPICEChannel struct { 1671 DomainAudioChannel 1672 } 1673 1674 type DomainAudioFile struct { 1675 Path string `xml:"path,attr,omitempty"` 1676 Input *DomainAudioFileChannel `xml:"input"` 1677 Output *DomainAudioFileChannel `xml:"output"` 1678 } 1679 1680 type DomainAudioFileChannel struct { 1681 DomainAudioChannel 1682 } 1683 1684 type DomainAudioDBus struct { 1685 Input *DomainAudioDBusChannel `xml:"input"` 1686 Output *DomainAudioDBusChannel `xml:"output"` 1687 } 1688 1689 type DomainAudioDBusChannel struct { 1690 DomainAudioChannel 1691 } 1692 1693 type DomainRNGRate struct { 1694 Bytes uint `xml:"bytes,attr"` 1695 Period uint `xml:"period,attr,omitempty"` 1696 } 1697 1698 type DomainRNGBackend struct { 1699 Random *DomainRNGBackendRandom `xml:"-"` 1700 EGD *DomainRNGBackendEGD `xml:"-"` 1701 BuiltIn *DomainRNGBackendBuiltIn `xml:"-"` 1702 } 1703 1704 type DomainRNGBackendEGD struct { 1705 Source *DomainChardevSource `xml:"source"` 1706 Protocol *DomainChardevProtocol `xml:"protocol"` 1707 } 1708 1709 type DomainRNGBackendRandom struct { 1710 Device string `xml:",chardata"` 1711 } 1712 1713 type DomainRNGBackendBuiltIn struct { 1714 } 1715 1716 type DomainRNG struct { 1717 XMLName xml.Name `xml:"rng"` 1718 Model string `xml:"model,attr"` 1719 Driver *DomainRNGDriver `xml:"driver"` 1720 Rate *DomainRNGRate `xml:"rate"` 1721 Backend *DomainRNGBackend `xml:"backend"` 1722 ACPI *DomainDeviceACPI `xml:"acpi"` 1723 Alias *DomainAlias `xml:"alias"` 1724 Address *DomainAddress `xml:"address"` 1725 } 1726 1727 type DomainRNGDriver struct { 1728 IOMMU string `xml:"iommu,attr,omitempty"` 1729 ATS string `xml:"ats,attr,omitempty"` 1730 Packed string `xml:"packed,attr,omitempty"` 1731 PagePerVQ string `xml:"page_per_vq,attr,omitempty"` 1732 } 1733 1734 type DomainHostdevSubsysUSB struct { 1735 Source *DomainHostdevSubsysUSBSource `xml:"source"` 1736 } 1737 1738 type DomainHostdevSubsysUSBSource struct { 1739 GuestReset string `xml:"guestReset,attr,omitempty"` 1740 Address *DomainAddressUSB `xml:"address"` 1741 } 1742 1743 type DomainHostdevSubsysSCSI struct { 1744 SGIO string `xml:"sgio,attr,omitempty"` 1745 RawIO string `xml:"rawio,attr,omitempty"` 1746 Source *DomainHostdevSubsysSCSISource `xml:"source"` 1747 ReadOnly *DomainDiskReadOnly `xml:"readonly"` 1748 Shareable *DomainDiskShareable `xml:"shareable"` 1749 } 1750 1751 type DomainHostdevSubsysSCSISource struct { 1752 Host *DomainHostdevSubsysSCSISourceHost `xml:"-"` 1753 ISCSI *DomainHostdevSubsysSCSISourceISCSI `xml:"-"` 1754 } 1755 1756 type DomainHostdevSubsysSCSIAdapter struct { 1757 Name string `xml:"name,attr"` 1758 } 1759 1760 type DomainHostdevSubsysSCSISourceHost struct { 1761 Adapter *DomainHostdevSubsysSCSIAdapter `xml:"adapter"` 1762 Address *DomainAddressDrive `xml:"address"` 1763 } 1764 1765 type DomainHostdevSubsysSCSISourceISCSI struct { 1766 Name string `xml:"name,attr"` 1767 Host []DomainDiskSourceHost `xml:"host"` 1768 Auth *DomainDiskAuth `xml:"auth"` 1769 Initiator *DomainHostdevSubsysSCSISourceInitiator `xml:"initiator"` 1770 } 1771 1772 type DomainHostdevSubsysSCSISourceInitiator struct { 1773 IQN DomainHostdevSubsysSCSISourceIQN `xml:"iqn"` 1774 } 1775 1776 type DomainHostdevSubsysSCSISourceIQN struct { 1777 Name string `xml:"name,attr"` 1778 } 1779 1780 type DomainHostdevSubsysSCSIHost struct { 1781 Model string `xml:"model,attr,omitempty"` 1782 Source *DomainHostdevSubsysSCSIHostSource `xml:"source"` 1783 } 1784 1785 type DomainHostdevSubsysSCSIHostSource struct { 1786 Protocol string `xml:"protocol,attr,omitempty"` 1787 WWPN string `xml:"wwpn,attr,omitempty"` 1788 } 1789 1790 type DomainHostdevSubsysPCISource struct { 1791 WriteFiltering string `xml:"writeFiltering,attr,omitempty"` 1792 Address *DomainAddressPCI `xml:"address"` 1793 } 1794 1795 type DomainHostdevSubsysPCIDriver struct { 1796 Name string `xml:"name,attr,omitempty"` 1797 Model string `xml:"model,attr,omitempty"` 1798 } 1799 1800 type DomainHostdevSubsysPCI struct { 1801 Display string `xml:"display,attr,omitempty"` 1802 RamFB string `xml:"ramfb,attr,omitempty"` 1803 Driver *DomainHostdevSubsysPCIDriver `xml:"driver"` 1804 Source *DomainHostdevSubsysPCISource `xml:"source"` 1805 Teaming *DomainInterfaceTeaming `xml:"teaming"` 1806 } 1807 1808 type DomainAddressMDev struct { 1809 UUID string `xml:"uuid,attr"` 1810 } 1811 1812 type DomainHostdevSubsysMDevSource struct { 1813 Address *DomainAddressMDev `xml:"address"` 1814 } 1815 1816 type DomainHostdevSubsysMDev struct { 1817 Model string `xml:"model,attr,omitempty"` 1818 Display string `xml:"display,attr,omitempty"` 1819 RamFB string `xml:"ramfb,attr,omitempty"` 1820 Source *DomainHostdevSubsysMDevSource `xml:"source"` 1821 } 1822 1823 type DomainHostdevCapsStorage struct { 1824 Source *DomainHostdevCapsStorageSource `xml:"source"` 1825 } 1826 1827 type DomainHostdevCapsStorageSource struct { 1828 Block string `xml:"block"` 1829 } 1830 1831 type DomainHostdevCapsMisc struct { 1832 Source *DomainHostdevCapsMiscSource `xml:"source"` 1833 } 1834 1835 type DomainHostdevCapsMiscSource struct { 1836 Char string `xml:"char"` 1837 } 1838 1839 type DomainIP struct { 1840 Address string `xml:"address,attr,omitempty"` 1841 Family string `xml:"family,attr,omitempty"` 1842 Prefix *uint `xml:"prefix,attr"` 1843 } 1844 1845 type DomainRoute struct { 1846 Family string `xml:"family,attr,omitempty"` 1847 Address string `xml:"address,attr,omitempty"` 1848 Gateway string `xml:"gateway,attr,omitempty"` 1849 } 1850 1851 type DomainHostdevCapsNet struct { 1852 Source *DomainHostdevCapsNetSource `xml:"source"` 1853 IP []DomainIP `xml:"ip"` 1854 Route []DomainRoute `xml:"route"` 1855 } 1856 1857 type DomainHostdevCapsNetSource struct { 1858 Interface string `xml:"interface"` 1859 } 1860 1861 type DomainHostdev struct { 1862 Managed string `xml:"managed,attr,omitempty"` 1863 SubsysUSB *DomainHostdevSubsysUSB `xml:"-"` 1864 SubsysSCSI *DomainHostdevSubsysSCSI `xml:"-"` 1865 SubsysSCSIHost *DomainHostdevSubsysSCSIHost `xml:"-"` 1866 SubsysPCI *DomainHostdevSubsysPCI `xml:"-"` 1867 SubsysMDev *DomainHostdevSubsysMDev `xml:"-"` 1868 CapsStorage *DomainHostdevCapsStorage `xml:"-"` 1869 CapsMisc *DomainHostdevCapsMisc `xml:"-"` 1870 CapsNet *DomainHostdevCapsNet `xml:"-"` 1871 Boot *DomainDeviceBoot `xml:"boot"` 1872 ROM *DomainROM `xml:"rom"` 1873 ACPI *DomainDeviceACPI `xml:"acpi"` 1874 Alias *DomainAlias `xml:"alias"` 1875 Address *DomainAddress `xml:"address"` 1876 } 1877 1878 type DomainMemorydevSource struct { 1879 NodeMask string `xml:"nodemask,omitempty"` 1880 PageSize *DomainMemorydevSourcePagesize `xml:"pagesize"` 1881 Path string `xml:"path,omitempty"` 1882 AlignSize *DomainMemorydevSourceAlignsize `xml:"alignsize"` 1883 PMem *DomainMemorydevSourcePMem `xml:"pmem"` 1884 } 1885 1886 type DomainMemorydevSourcePMem struct { 1887 } 1888 1889 type DomainMemorydevSourcePagesize struct { 1890 Value uint64 `xml:",chardata"` 1891 Unit string `xml:"unit,attr,omitempty"` 1892 } 1893 1894 type DomainMemorydevSourceAlignsize struct { 1895 Value uint64 `xml:",chardata"` 1896 Unit string `xml:"unit,attr,omitempty"` 1897 } 1898 1899 type DomainMemorydevTargetNode struct { 1900 Value uint `xml:",chardata"` 1901 } 1902 1903 type DomainMemorydevTargetReadOnly struct { 1904 } 1905 1906 type DomainMemorydevTargetSize struct { 1907 Value uint `xml:",chardata"` 1908 Unit string `xml:"unit,attr,omitempty"` 1909 } 1910 1911 type DomainMemorydevTargetBlock struct { 1912 Value uint `xml:",chardata"` 1913 Unit string `xml:"unit,attr,omitempty"` 1914 } 1915 1916 type DomainMemorydevTargetRequested struct { 1917 Value uint `xml:",chardata"` 1918 Unit string `xml:"unit,attr,omitempty"` 1919 } 1920 1921 type DomainMemorydevTargetLabel struct { 1922 Size *DomainMemorydevTargetSize `xml:"size"` 1923 } 1924 1925 type DomainMemorydevTargetAddress struct { 1926 Base *uint `xml:"base,attr"` 1927 } 1928 1929 type DomainMemorydevTarget struct { 1930 DynamicMemslots string `xml:"dynamicMemslots,attr,omitempty"` 1931 Size *DomainMemorydevTargetSize `xml:"size"` 1932 Node *DomainMemorydevTargetNode `xml:"node"` 1933 Label *DomainMemorydevTargetLabel `xml:"label"` 1934 Block *DomainMemorydevTargetBlock `xml:"block"` 1935 Requested *DomainMemorydevTargetRequested `xml:"requested"` 1936 ReadOnly *DomainMemorydevTargetReadOnly `xml:"readonly"` 1937 Address *DomainMemorydevTargetAddress `xml:"address"` 1938 } 1939 1940 type DomainMemorydev struct { 1941 XMLName xml.Name `xml:"memory"` 1942 Model string `xml:"model,attr"` 1943 Access string `xml:"access,attr,omitempty"` 1944 Discard string `xml:"discard,attr,omitempty"` 1945 UUID string `xml:"uuid,omitempty"` 1946 Source *DomainMemorydevSource `xml:"source"` 1947 Target *DomainMemorydevTarget `xml:"target"` 1948 ACPI *DomainDeviceACPI `xml:"acpi"` 1949 Alias *DomainAlias `xml:"alias"` 1950 Address *DomainAddress `xml:"address"` 1951 } 1952 1953 type DomainWatchdog struct { 1954 XMLName xml.Name `xml:"watchdog"` 1955 Model string `xml:"model,attr"` 1956 Action string `xml:"action,attr,omitempty"` 1957 ACPI *DomainDeviceACPI `xml:"acpi"` 1958 Alias *DomainAlias `xml:"alias"` 1959 Address *DomainAddress `xml:"address"` 1960 } 1961 1962 type DomainHub struct { 1963 Type string `xml:"type,attr"` 1964 ACPI *DomainDeviceACPI `xml:"acpi"` 1965 Alias *DomainAlias `xml:"alias"` 1966 Address *DomainAddress `xml:"address"` 1967 } 1968 1969 type DomainIOMMU struct { 1970 Model string `xml:"model,attr"` 1971 Driver *DomainIOMMUDriver `xml:"driver"` 1972 ACPI *DomainDeviceACPI `xml:"acpi"` 1973 Alias *DomainAlias `xml:"alias"` 1974 Address *DomainAddress `xml:"address"` 1975 } 1976 1977 type DomainIOMMUDriver struct { 1978 IntRemap string `xml:"intremap,attr,omitempty"` 1979 CachingMode string `xml:"caching_mode,attr,omitempty"` 1980 EIM string `xml:"eim,attr,omitempty"` 1981 IOTLB string `xml:"iotlb,attr,omitempty"` 1982 AWBits uint `xml:"aw_bits,attr,omitempty"` 1983 } 1984 1985 type DomainNVRAM struct { 1986 ACPI *DomainDeviceACPI `xml:"acpi"` 1987 Alias *DomainAlias `xml:"alias"` 1988 Address *DomainAddress `xml:"address"` 1989 } 1990 1991 type DomainLease struct { 1992 Lockspace string `xml:"lockspace"` 1993 Key string `xml:"key"` 1994 Target *DomainLeaseTarget `xml:"target"` 1995 } 1996 1997 type DomainLeaseTarget struct { 1998 Path string `xml:"path,attr"` 1999 Offset uint64 `xml:"offset,attr,omitempty"` 2000 } 2001 2002 type DomainSmartcard struct { 2003 XMLName xml.Name `xml:"smartcard"` 2004 Passthrough *DomainChardevSource `xml:"source"` 2005 Protocol *DomainChardevProtocol `xml:"protocol"` 2006 Host *DomainSmartcardHost `xml:"-"` 2007 HostCerts []DomainSmartcardHostCert `xml:"certificate"` 2008 Database string `xml:"database,omitempty"` 2009 ACPI *DomainDeviceACPI `xml:"acpi"` 2010 Alias *DomainAlias `xml:"alias"` 2011 Address *DomainAddress `xml:"address"` 2012 } 2013 2014 type DomainSmartcardHost struct { 2015 } 2016 2017 type DomainSmartcardHostCert struct { 2018 File string `xml:",chardata"` 2019 } 2020 2021 type DomainTPM struct { 2022 XMLName xml.Name `xml:"tpm"` 2023 Model string `xml:"model,attr,omitempty"` 2024 Backend *DomainTPMBackend `xml:"backend"` 2025 ACPI *DomainDeviceACPI `xml:"acpi"` 2026 Alias *DomainAlias `xml:"alias"` 2027 Address *DomainAddress `xml:"address"` 2028 } 2029 2030 type DomainTPMBackend struct { 2031 Passthrough *DomainTPMBackendPassthrough `xml:"-"` 2032 Emulator *DomainTPMBackendEmulator `xml:"-"` 2033 External *DomainTPMBackendExternal `xml:"-"` 2034 } 2035 2036 type DomainTPMBackendPassthrough struct { 2037 Device *DomainTPMBackendDevice `xml:"device"` 2038 } 2039 2040 type DomainTPMBackendEmulator struct { 2041 Version string `xml:"version,attr,omitempty"` 2042 Encryption *DomainTPMBackendEncryption `xml:"encryption"` 2043 PersistentState string `xml:"persistent_state,attr,omitempty"` 2044 ActivePCRBanks *DomainTPMBackendPCRBanks `xml:"active_pcr_banks"` 2045 } 2046 2047 type DomainTPMBackendPCRBanks struct { 2048 SHA1 *DomainTPMBackendPCRBank `xml:"sha1"` 2049 SHA256 *DomainTPMBackendPCRBank `xml:"sha256"` 2050 SHA384 *DomainTPMBackendPCRBank `xml:"sha384"` 2051 SHA512 *DomainTPMBackendPCRBank `xml:"sha512"` 2052 } 2053 2054 type DomainTPMBackendPCRBank struct { 2055 } 2056 2057 type DomainTPMBackendEncryption struct { 2058 Secret string `xml:"secret,attr"` 2059 } 2060 2061 type DomainTPMBackendDevice struct { 2062 Path string `xml:"path,attr"` 2063 } 2064 2065 type DomainTPMBackendExternalSource DomainChardevSource 2066 2067 type DomainTPMBackendExternal struct { 2068 Source *DomainTPMBackendExternalSource `xml:"source"` 2069 } 2070 2071 type DomainShmem struct { 2072 XMLName xml.Name `xml:"shmem"` 2073 Name string `xml:"name,attr"` 2074 Role string `xml:"role,attr,omitempty"` 2075 Size *DomainShmemSize `xml:"size"` 2076 Model *DomainShmemModel `xml:"model"` 2077 Server *DomainShmemServer `xml:"server"` 2078 MSI *DomainShmemMSI `xml:"msi"` 2079 ACPI *DomainDeviceACPI `xml:"acpi"` 2080 Alias *DomainAlias `xml:"alias"` 2081 Address *DomainAddress `xml:"address"` 2082 } 2083 2084 type DomainShmemSize struct { 2085 Value uint `xml:",chardata"` 2086 Unit string `xml:"unit,attr,omitempty"` 2087 } 2088 2089 type DomainShmemModel struct { 2090 Type string `xml:"type,attr"` 2091 } 2092 2093 type DomainShmemServer struct { 2094 Path string `xml:"path,attr,omitempty"` 2095 } 2096 2097 type DomainShmemMSI struct { 2098 Enabled string `xml:"enabled,attr,omitempty"` 2099 Vectors uint `xml:"vectors,attr,omitempty"` 2100 IOEventFD string `xml:"ioeventfd,attr,omitempty"` 2101 } 2102 2103 type DomainCrypto struct { 2104 Model string `xml:"model,attr,omitempty"` 2105 Type string `xml:"type,attr,omitempty"` 2106 Backend *DomainCryptoBackend `xml:"backend"` 2107 Alias *DomainAlias `xml:"alias"` 2108 Address *DomainAddress `xml:"address"` 2109 } 2110 2111 type DomainCryptoBackend struct { 2112 BuiltIn *DomainCryptoBackendBuiltIn `xml:"-"` 2113 LKCF *DomainCryptoBackendLKCF `xml:"-"` 2114 Queues uint `xml:"queues,attr,omitempty"` 2115 } 2116 2117 type DomainCryptoBackendBuiltIn struct { 2118 } 2119 2120 type DomainCryptoBackendLKCF struct { 2121 } 2122 2123 type DomainDeviceList struct { 2124 Emulator string `xml:"emulator,omitempty"` 2125 Disks []DomainDisk `xml:"disk"` 2126 Controllers []DomainController `xml:"controller"` 2127 Leases []DomainLease `xml:"lease"` 2128 Filesystems []DomainFilesystem `xml:"filesystem"` 2129 Interfaces []DomainInterface `xml:"interface"` 2130 Smartcards []DomainSmartcard `xml:"smartcard"` 2131 Serials []DomainSerial `xml:"serial"` 2132 Parallels []DomainParallel `xml:"parallel"` 2133 Consoles []DomainConsole `xml:"console"` 2134 Channels []DomainChannel `xml:"channel"` 2135 Inputs []DomainInput `xml:"input"` 2136 TPMs []DomainTPM `xml:"tpm"` 2137 Graphics []DomainGraphic `xml:"graphics"` 2138 Sounds []DomainSound `xml:"sound"` 2139 Audios []DomainAudio `xml:"audio"` 2140 Videos []DomainVideo `xml:"video"` 2141 Hostdevs []DomainHostdev `xml:"hostdev"` 2142 RedirDevs []DomainRedirDev `xml:"redirdev"` 2143 RedirFilters []DomainRedirFilter `xml:"redirfilter"` 2144 Hubs []DomainHub `xml:"hub"` 2145 Watchdogs []DomainWatchdog `xml:"watchdog"` 2146 MemBalloon *DomainMemBalloon `xml:"memballoon"` 2147 RNGs []DomainRNG `xml:"rng"` 2148 NVRAM *DomainNVRAM `xml:"nvram"` 2149 Panics []DomainPanic `xml:"panic"` 2150 Shmems []DomainShmem `xml:"shmem"` 2151 Memorydevs []DomainMemorydev `xml:"memory"` 2152 IOMMU *DomainIOMMU `xml:"iommu"` 2153 VSock *DomainVSock `xml:"vsock"` 2154 Crypto []DomainCrypto `xml:"crypto"` 2155 } 2156 2157 type DomainMemory struct { 2158 Value uint `xml:",chardata"` 2159 Unit string `xml:"unit,attr,omitempty"` 2160 DumpCore string `xml:"dumpCore,attr,omitempty"` 2161 } 2162 2163 type DomainCurrentMemory struct { 2164 Value uint `xml:",chardata"` 2165 Unit string `xml:"unit,attr,omitempty"` 2166 } 2167 2168 type DomainMaxMemory struct { 2169 Value uint `xml:",chardata"` 2170 Unit string `xml:"unit,attr,omitempty"` 2171 Slots uint `xml:"slots,attr,omitempty"` 2172 } 2173 2174 type DomainMemoryHugepage struct { 2175 Size uint `xml:"size,attr"` 2176 Unit string `xml:"unit,attr,omitempty"` 2177 Nodeset string `xml:"nodeset,attr,omitempty"` 2178 } 2179 2180 type DomainMemoryHugepages struct { 2181 Hugepages []DomainMemoryHugepage `xml:"page"` 2182 } 2183 2184 type DomainMemoryNosharepages struct { 2185 } 2186 2187 type DomainMemoryLocked struct { 2188 } 2189 2190 type DomainMemorySource struct { 2191 Type string `xml:"type,attr,omitempty"` 2192 } 2193 2194 type DomainMemoryAccess struct { 2195 Mode string `xml:"mode,attr,omitempty"` 2196 } 2197 2198 type DomainMemoryAllocation struct { 2199 Mode string `xml:"mode,attr,omitempty"` 2200 Threads uint `xml:"threads,attr,omitempty"` 2201 } 2202 2203 type DomainMemoryDiscard struct { 2204 } 2205 2206 type DomainMemoryBacking struct { 2207 MemoryHugePages *DomainMemoryHugepages `xml:"hugepages"` 2208 MemoryNosharepages *DomainMemoryNosharepages `xml:"nosharepages"` 2209 MemoryLocked *DomainMemoryLocked `xml:"locked"` 2210 MemorySource *DomainMemorySource `xml:"source"` 2211 MemoryAccess *DomainMemoryAccess `xml:"access"` 2212 MemoryAllocation *DomainMemoryAllocation `xml:"allocation"` 2213 MemoryDiscard *DomainMemoryDiscard `xml:"discard"` 2214 } 2215 2216 type DomainOSType struct { 2217 Arch string `xml:"arch,attr,omitempty"` 2218 Machine string `xml:"machine,attr,omitempty"` 2219 Type string `xml:",chardata"` 2220 } 2221 2222 type DomainSMBios struct { 2223 Mode string `xml:"mode,attr"` 2224 } 2225 2226 type DomainNVRam struct { 2227 NVRam string `xml:",chardata"` 2228 Source *DomainDiskSource `xml:"source"` 2229 Template string `xml:"template,attr,omitempty"` 2230 Format string `xml:"format,attr,omitempty"` 2231 } 2232 2233 type DomainBootDevice struct { 2234 Dev string `xml:"dev,attr"` 2235 } 2236 2237 type DomainBootMenu struct { 2238 Enable string `xml:"enable,attr,omitempty"` 2239 Timeout string `xml:"timeout,attr,omitempty"` 2240 } 2241 2242 type DomainSysInfoBIOS struct { 2243 Entry []DomainSysInfoEntry `xml:"entry"` 2244 } 2245 2246 type DomainSysInfoSystem struct { 2247 Entry []DomainSysInfoEntry `xml:"entry"` 2248 } 2249 2250 type DomainSysInfoBaseBoard struct { 2251 Entry []DomainSysInfoEntry `xml:"entry"` 2252 } 2253 2254 type DomainSysInfoProcessor struct { 2255 Entry []DomainSysInfoEntry `xml:"entry"` 2256 } 2257 2258 type DomainSysInfoMemory struct { 2259 Entry []DomainSysInfoEntry `xml:"entry"` 2260 } 2261 2262 type DomainSysInfoChassis struct { 2263 Entry []DomainSysInfoEntry `xml:"entry"` 2264 } 2265 2266 type DomainSysInfoOEMStrings struct { 2267 Entry []string `xml:"entry"` 2268 } 2269 2270 type DomainSysInfoSMBIOS struct { 2271 BIOS *DomainSysInfoBIOS `xml:"bios"` 2272 System *DomainSysInfoSystem `xml:"system"` 2273 BaseBoard []DomainSysInfoBaseBoard `xml:"baseBoard"` 2274 Chassis *DomainSysInfoChassis `xml:"chassis"` 2275 Processor []DomainSysInfoProcessor `xml:"processor"` 2276 Memory []DomainSysInfoMemory `xml:"memory"` 2277 OEMStrings *DomainSysInfoOEMStrings `xml:"oemStrings"` 2278 } 2279 2280 type DomainSysInfoFWCfg struct { 2281 Entry []DomainSysInfoEntry `xml:"entry"` 2282 } 2283 2284 type DomainSysInfo struct { 2285 SMBIOS *DomainSysInfoSMBIOS `xml:"-"` 2286 FWCfg *DomainSysInfoFWCfg `xml:"-"` 2287 } 2288 2289 type DomainSysInfoEntry struct { 2290 Name string `xml:"name,attr"` 2291 File string `xml:"file,attr,omitempty"` 2292 Value string `xml:",chardata"` 2293 } 2294 2295 type DomainBIOS struct { 2296 UseSerial string `xml:"useserial,attr,omitempty"` 2297 RebootTimeout *int `xml:"rebootTimeout,attr"` 2298 } 2299 2300 type DomainLoader struct { 2301 Path string `xml:",chardata"` 2302 Readonly string `xml:"readonly,attr,omitempty"` 2303 Secure string `xml:"secure,attr,omitempty"` 2304 Stateless string `xml:"stateless,attr,omitempty"` 2305 Type string `xml:"type,attr,omitempty"` 2306 Format string `xml:"format,attr,omitempty"` 2307 } 2308 2309 type DomainACPI struct { 2310 Tables []DomainACPITable `xml:"table"` 2311 } 2312 2313 type DomainACPITable struct { 2314 Type string `xml:"type,attr"` 2315 Path string `xml:",chardata"` 2316 } 2317 2318 type DomainOSInitEnv struct { 2319 Name string `xml:"name,attr"` 2320 Value string `xml:",chardata"` 2321 } 2322 2323 type DomainOSFirmwareInfo struct { 2324 Features []DomainOSFirmwareFeature `xml:"feature"` 2325 } 2326 2327 type DomainOSFirmwareFeature struct { 2328 Enabled string `xml:"enabled,attr,omitempty"` 2329 Name string `xml:"name,attr,omitempty"` 2330 } 2331 2332 type DomainOS struct { 2333 Type *DomainOSType `xml:"type"` 2334 Firmware string `xml:"firmware,attr,omitempty"` 2335 FirmwareInfo *DomainOSFirmwareInfo `xml:"firmware"` 2336 Init string `xml:"init,omitempty"` 2337 InitArgs []string `xml:"initarg"` 2338 InitEnv []DomainOSInitEnv `xml:"initenv"` 2339 InitDir string `xml:"initdir,omitempty"` 2340 InitUser string `xml:"inituser,omitempty"` 2341 InitGroup string `xml:"initgroup,omitempty"` 2342 Loader *DomainLoader `xml:"loader"` 2343 NVRam *DomainNVRam `xml:"nvram"` 2344 Kernel string `xml:"kernel,omitempty"` 2345 Initrd string `xml:"initrd,omitempty"` 2346 Cmdline string `xml:"cmdline,omitempty"` 2347 DTB string `xml:"dtb,omitempty"` 2348 ACPI *DomainACPI `xml:"acpi"` 2349 BootDevices []DomainBootDevice `xml:"boot"` 2350 BootMenu *DomainBootMenu `xml:"bootmenu"` 2351 BIOS *DomainBIOS `xml:"bios"` 2352 SMBios *DomainSMBios `xml:"smbios"` 2353 } 2354 2355 type DomainResource struct { 2356 Partition string `xml:"partition,omitempty"` 2357 FibreChannel *DomainResourceFibreChannel `xml:"fibrechannel"` 2358 } 2359 2360 type DomainResourceFibreChannel struct { 2361 AppID string `xml:"appid,attr"` 2362 } 2363 2364 type DomainVCPU struct { 2365 Placement string `xml:"placement,attr,omitempty"` 2366 CPUSet string `xml:"cpuset,attr,omitempty"` 2367 Current uint `xml:"current,attr,omitempty"` 2368 Value uint `xml:",chardata"` 2369 } 2370 2371 type DomainVCPUsVCPU struct { 2372 Id *uint `xml:"id,attr"` 2373 Enabled string `xml:"enabled,attr,omitempty"` 2374 Hotpluggable string `xml:"hotpluggable,attr,omitempty"` 2375 Order *uint `xml:"order,attr"` 2376 } 2377 2378 type DomainVCPUs struct { 2379 VCPU []DomainVCPUsVCPU `xml:"vcpu"` 2380 } 2381 2382 type DomainCPUModel struct { 2383 Fallback string `xml:"fallback,attr,omitempty"` 2384 Value string `xml:",chardata"` 2385 VendorID string `xml:"vendor_id,attr,omitempty"` 2386 } 2387 2388 type DomainCPUTopology struct { 2389 Sockets int `xml:"sockets,attr,omitempty"` 2390 Dies int `xml:"dies,attr,omitempty"` 2391 Clusters int `xml:"clusters,attr,omitempty"` 2392 Cores int `xml:"cores,attr,omitempty"` 2393 Threads int `xml:"threads,attr,omitempty"` 2394 } 2395 2396 type DomainCPUFeature struct { 2397 Policy string `xml:"policy,attr,omitempty"` 2398 Name string `xml:"name,attr,omitempty"` 2399 } 2400 2401 type DomainCPUCache struct { 2402 Level uint `xml:"level,attr,omitempty"` 2403 Mode string `xml:"mode,attr"` 2404 } 2405 2406 type DomainCPUMaxPhysAddr struct { 2407 Mode string `xml:"mode,attr"` 2408 Bits uint `xml:"bits,attr,omitempty"` 2409 Limit uint `xml:"limit,attr,omitempty"` 2410 } 2411 2412 type DomainCPU struct { 2413 XMLName xml.Name `xml:"cpu"` 2414 Match string `xml:"match,attr,omitempty"` 2415 Mode string `xml:"mode,attr,omitempty"` 2416 Check string `xml:"check,attr,omitempty"` 2417 Migratable string `xml:"migratable,attr,omitempty"` 2418 Model *DomainCPUModel `xml:"model"` 2419 Vendor string `xml:"vendor,omitempty"` 2420 Topology *DomainCPUTopology `xml:"topology"` 2421 Cache *DomainCPUCache `xml:"cache"` 2422 MaxPhysAddr *DomainCPUMaxPhysAddr `xml:"maxphysaddr"` 2423 Features []DomainCPUFeature `xml:"feature"` 2424 Numa *DomainNuma `xml:"numa"` 2425 } 2426 2427 type DomainNuma struct { 2428 Cell []DomainCell `xml:"cell"` 2429 Interconnects *DomainNUMAInterconnects `xml:"interconnects"` 2430 } 2431 2432 type DomainCell struct { 2433 ID *uint `xml:"id,attr"` 2434 CPUs string `xml:"cpus,attr,omitempty"` 2435 Memory uint `xml:"memory,attr"` 2436 Unit string `xml:"unit,attr,omitempty"` 2437 MemAccess string `xml:"memAccess,attr,omitempty"` 2438 Discard string `xml:"discard,attr,omitempty"` 2439 Distances *DomainCellDistances `xml:"distances"` 2440 Caches []DomainCellCache `xml:"cache"` 2441 } 2442 2443 type DomainCellDistances struct { 2444 Siblings []DomainCellSibling `xml:"sibling"` 2445 } 2446 2447 type DomainCellSibling struct { 2448 ID uint `xml:"id,attr"` 2449 Value uint `xml:"value,attr"` 2450 } 2451 2452 type DomainCellCache struct { 2453 Level uint `xml:"level,attr"` 2454 Associativity string `xml:"associativity,attr"` 2455 Policy string `xml:"policy,attr"` 2456 Size DomainCellCacheSize `xml:"size"` 2457 Line DomainCellCacheLine `xml:"line"` 2458 } 2459 2460 type DomainCellCacheSize struct { 2461 Value string `xml:"value,attr"` 2462 Unit string `xml:"unit,attr"` 2463 } 2464 2465 type DomainCellCacheLine struct { 2466 Value string `xml:"value,attr"` 2467 Unit string `xml:"unit,attr"` 2468 } 2469 2470 type DomainNUMAInterconnects struct { 2471 Latencies []DomainNUMAInterconnectLatency `xml:"latency"` 2472 Bandwidths []DomainNUMAInterconnectBandwidth `xml:"bandwidth"` 2473 } 2474 2475 type DomainNUMAInterconnectLatency struct { 2476 Initiator uint `xml:"initiator,attr"` 2477 Target uint `xml:"target,attr"` 2478 Cache uint `xml:"cache,attr,omitempty"` 2479 Type string `xml:"type,attr"` 2480 Value uint `xml:"value,attr"` 2481 } 2482 2483 type DomainNUMAInterconnectBandwidth struct { 2484 Initiator uint `xml:"initiator,attr"` 2485 Target uint `xml:"target,attr"` 2486 Cache uint `xml:"cache,attr,omitempty"` 2487 Type string `xml:"type,attr"` 2488 Value uint `xml:"value,attr"` 2489 Unit string `xml:"unit,attr"` 2490 } 2491 2492 type DomainClock struct { 2493 Offset string `xml:"offset,attr,omitempty"` 2494 Basis string `xml:"basis,attr,omitempty"` 2495 Adjustment string `xml:"adjustment,attr,omitempty"` 2496 TimeZone string `xml:"timezone,attr,omitempty"` 2497 Start uint `xml:"start,attr,omitempty"` 2498 Timer []DomainTimer `xml:"timer"` 2499 } 2500 2501 type DomainTimer struct { 2502 Name string `xml:"name,attr"` 2503 Track string `xml:"track,attr,omitempty"` 2504 TickPolicy string `xml:"tickpolicy,attr,omitempty"` 2505 CatchUp *DomainTimerCatchUp `xml:"catchup"` 2506 Frequency uint64 `xml:"frequency,attr,omitempty"` 2507 Mode string `xml:"mode,attr,omitempty"` 2508 Present string `xml:"present,attr,omitempty"` 2509 } 2510 2511 type DomainTimerCatchUp struct { 2512 Threshold uint `xml:"threshold,attr,omitempty"` 2513 Slew uint `xml:"slew,attr,omitempty"` 2514 Limit uint `xml:"limit,attr,omitempty"` 2515 } 2516 2517 type DomainFeature struct { 2518 } 2519 2520 type DomainFeatureState struct { 2521 State string `xml:"state,attr,omitempty"` 2522 } 2523 2524 type DomainFeatureAPIC struct { 2525 EOI string `xml:"eoi,attr,omitempty"` 2526 } 2527 2528 type DomainFeatureHyperVVendorId struct { 2529 DomainFeatureState 2530 Value string `xml:"value,attr,omitempty"` 2531 } 2532 2533 type DomainFeatureHyperVSpinlocks struct { 2534 DomainFeatureState 2535 Retries uint `xml:"retries,attr,omitempty"` 2536 } 2537 2538 type DomainFeatureHyperVSTimer struct { 2539 DomainFeatureState 2540 Direct *DomainFeatureState `xml:"direct"` 2541 } 2542 2543 type DomainFeatureHyperV struct { 2544 DomainFeature 2545 Mode string `xml:"mode,attr,omitempty"` 2546 Relaxed *DomainFeatureState `xml:"relaxed"` 2547 VAPIC *DomainFeatureState `xml:"vapic"` 2548 Spinlocks *DomainFeatureHyperVSpinlocks `xml:"spinlocks"` 2549 VPIndex *DomainFeatureState `xml:"vpindex"` 2550 Runtime *DomainFeatureState `xml:"runtime"` 2551 Synic *DomainFeatureState `xml:"synic"` 2552 STimer *DomainFeatureHyperVSTimer `xml:"stimer"` 2553 Reset *DomainFeatureState `xml:"reset"` 2554 VendorId *DomainFeatureHyperVVendorId `xml:"vendor_id"` 2555 Frequencies *DomainFeatureState `xml:"frequencies"` 2556 ReEnlightenment *DomainFeatureState `xml:"reenlightenment"` 2557 TLBFlush *DomainFeatureState `xml:"tlbflush"` 2558 IPI *DomainFeatureState `xml:"ipi"` 2559 EVMCS *DomainFeatureState `xml:"evmcs"` 2560 AVIC *DomainFeatureState `xml:"avic"` 2561 } 2562 2563 type DomainFeatureKVMDirtyRing struct { 2564 DomainFeatureState 2565 Size uint `xml:"size,attr,omitempty"` 2566 } 2567 2568 type DomainFeatureKVM struct { 2569 Hidden *DomainFeatureState `xml:"hidden"` 2570 HintDedicated *DomainFeatureState `xml:"hint-dedicated"` 2571 PollControl *DomainFeatureState `xml:"poll-control"` 2572 PVIPI *DomainFeatureState `xml:"pv-ipi"` 2573 DirtyRing *DomainFeatureKVMDirtyRing `xml:"dirty-ring"` 2574 } 2575 2576 type DomainFeatureTCGTBCache struct { 2577 Unit string `xml:"unit,attr,omitempty"` 2578 Size uint `xml:",chardata"` 2579 } 2580 2581 type DomainFeatureTCG struct { 2582 TBCache *DomainFeatureTCGTBCache `xml:"tb-cache"` 2583 } 2584 2585 type DomainFeatureXenPassthrough struct { 2586 State string `xml:"state,attr,omitempty"` 2587 Mode string `xml:"mode,attr,omitempty"` 2588 } 2589 2590 type DomainFeatureXenE820Host struct { 2591 State string `xml:"state,attr"` 2592 } 2593 2594 type DomainFeatureXen struct { 2595 E820Host *DomainFeatureXenE820Host `xml:"e820_host"` 2596 Passthrough *DomainFeatureXenPassthrough `xml:"passthrough"` 2597 } 2598 2599 type DomainFeatureGIC struct { 2600 Version string `xml:"version,attr,omitempty"` 2601 } 2602 2603 type DomainFeatureIOAPIC struct { 2604 Driver string `xml:"driver,attr,omitempty"` 2605 } 2606 2607 type DomainFeatureHPT struct { 2608 Resizing string `xml:"resizing,attr,omitempty"` 2609 MaxPageSize *DomainFeatureHPTPageSize `xml:"maxpagesize"` 2610 } 2611 2612 type DomainFeatureHPTPageSize struct { 2613 Unit string `xml:"unit,attr,omitempty"` 2614 Value string `xml:",chardata"` 2615 } 2616 2617 type DomainFeatureSMM struct { 2618 State string `xml:"state,attr,omitempty"` 2619 TSeg *DomainFeatureSMMTSeg `xml:"tseg"` 2620 } 2621 2622 type DomainFeatureSMMTSeg struct { 2623 Unit string `xml:"unit,attr,omitempty"` 2624 Value uint `xml:",chardata"` 2625 } 2626 2627 type DomainFeatureCapability struct { 2628 State string `xml:"state,attr,omitempty"` 2629 } 2630 2631 type DomainLaunchSecurity struct { 2632 SEV *DomainLaunchSecuritySEV `xml:"-"` 2633 S390PV *DomainLaunchSecurityS390PV `xml:"-"` 2634 } 2635 2636 type DomainLaunchSecuritySEV struct { 2637 KernelHashes string `xml:"kernelHashes,attr,omitempty"` 2638 CBitPos *uint `xml:"cbitpos"` 2639 ReducedPhysBits *uint `xml:"reducedPhysBits"` 2640 Policy *uint `xml:"policy"` 2641 DHCert string `xml:"dhCert"` 2642 Session string `xml:"sesion"` 2643 } 2644 2645 type DomainLaunchSecurityS390PV struct { 2646 } 2647 2648 type DomainFeatureCapabilities struct { 2649 Policy string `xml:"policy,attr,omitempty"` 2650 AuditControl *DomainFeatureCapability `xml:"audit_control"` 2651 AuditWrite *DomainFeatureCapability `xml:"audit_write"` 2652 BlockSuspend *DomainFeatureCapability `xml:"block_suspend"` 2653 Chown *DomainFeatureCapability `xml:"chown"` 2654 DACOverride *DomainFeatureCapability `xml:"dac_override"` 2655 DACReadSearch *DomainFeatureCapability `xml:"dac_read_Search"` 2656 FOwner *DomainFeatureCapability `xml:"fowner"` 2657 FSetID *DomainFeatureCapability `xml:"fsetid"` 2658 IPCLock *DomainFeatureCapability `xml:"ipc_lock"` 2659 IPCOwner *DomainFeatureCapability `xml:"ipc_owner"` 2660 Kill *DomainFeatureCapability `xml:"kill"` 2661 Lease *DomainFeatureCapability `xml:"lease"` 2662 LinuxImmutable *DomainFeatureCapability `xml:"linux_immutable"` 2663 MACAdmin *DomainFeatureCapability `xml:"mac_admin"` 2664 MACOverride *DomainFeatureCapability `xml:"mac_override"` 2665 MkNod *DomainFeatureCapability `xml:"mknod"` 2666 NetAdmin *DomainFeatureCapability `xml:"net_admin"` 2667 NetBindService *DomainFeatureCapability `xml:"net_bind_service"` 2668 NetBroadcast *DomainFeatureCapability `xml:"net_broadcast"` 2669 NetRaw *DomainFeatureCapability `xml:"net_raw"` 2670 SetGID *DomainFeatureCapability `xml:"setgid"` 2671 SetFCap *DomainFeatureCapability `xml:"setfcap"` 2672 SetPCap *DomainFeatureCapability `xml:"setpcap"` 2673 SetUID *DomainFeatureCapability `xml:"setuid"` 2674 SysAdmin *DomainFeatureCapability `xml:"sys_admin"` 2675 SysBoot *DomainFeatureCapability `xml:"sys_boot"` 2676 SysChRoot *DomainFeatureCapability `xml:"sys_chroot"` 2677 SysModule *DomainFeatureCapability `xml:"sys_module"` 2678 SysNice *DomainFeatureCapability `xml:"sys_nice"` 2679 SysPAcct *DomainFeatureCapability `xml:"sys_pacct"` 2680 SysPTrace *DomainFeatureCapability `xml:"sys_ptrace"` 2681 SysRawIO *DomainFeatureCapability `xml:"sys_rawio"` 2682 SysResource *DomainFeatureCapability `xml:"sys_resource"` 2683 SysTime *DomainFeatureCapability `xml:"sys_time"` 2684 SysTTYCnofig *DomainFeatureCapability `xml:"sys_tty_config"` 2685 SysLog *DomainFeatureCapability `xml:"syslog"` 2686 WakeAlarm *DomainFeatureCapability `xml:"wake_alarm"` 2687 } 2688 2689 type DomainFeatureMSRS struct { 2690 Unknown string `xml:"unknown,attr"` 2691 } 2692 2693 type DomainFeatureCFPC struct { 2694 Value string `xml:"value,attr"` 2695 } 2696 2697 type DomainFeatureSBBC struct { 2698 Value string `xml:"value,attr"` 2699 } 2700 2701 type DomainFeatureIBS struct { 2702 Value string `xml:"value,attr"` 2703 } 2704 2705 type DomainFeatureAsyncTeardown struct { 2706 Enabled string `xml:"enabled,attr,omitempty"` 2707 } 2708 2709 type DomainFeatureList struct { 2710 PAE *DomainFeature `xml:"pae"` 2711 ACPI *DomainFeature `xml:"acpi"` 2712 APIC *DomainFeatureAPIC `xml:"apic"` 2713 HAP *DomainFeatureState `xml:"hap"` 2714 Viridian *DomainFeature `xml:"viridian"` 2715 PrivNet *DomainFeature `xml:"privnet"` 2716 HyperV *DomainFeatureHyperV `xml:"hyperv"` 2717 KVM *DomainFeatureKVM `xml:"kvm"` 2718 Xen *DomainFeatureXen `xml:"xen"` 2719 PVSpinlock *DomainFeatureState `xml:"pvspinlock"` 2720 PMU *DomainFeatureState `xml:"pmu"` 2721 VMPort *DomainFeatureState `xml:"vmport"` 2722 GIC *DomainFeatureGIC `xml:"gic"` 2723 SMM *DomainFeatureSMM `xml:"smm"` 2724 IOAPIC *DomainFeatureIOAPIC `xml:"ioapic"` 2725 HPT *DomainFeatureHPT `xml:"hpt"` 2726 HTM *DomainFeatureState `xml:"htm"` 2727 NestedHV *DomainFeatureState `xml:"nested-hv"` 2728 Capabilities *DomainFeatureCapabilities `xml:"capabilities"` 2729 VMCoreInfo *DomainFeatureState `xml:"vmcoreinfo"` 2730 MSRS *DomainFeatureMSRS `xml:"msrs"` 2731 CCFAssist *DomainFeatureState `xml:"ccf-assist"` 2732 CFPC *DomainFeatureCFPC `xml:"cfpc"` 2733 SBBC *DomainFeatureSBBC `xml:"sbbc"` 2734 IBS *DomainFeatureIBS `xml:"ibs"` 2735 TCG *DomainFeatureTCG `xml:"tcg"` 2736 AsyncTeardown *DomainFeatureAsyncTeardown `xml:"async-teardown"` 2737 } 2738 2739 type DomainCPUTuneShares struct { 2740 Value uint `xml:",chardata"` 2741 } 2742 2743 type DomainCPUTunePeriod struct { 2744 Value uint64 `xml:",chardata"` 2745 } 2746 2747 type DomainCPUTuneQuota struct { 2748 Value int64 `xml:",chardata"` 2749 } 2750 2751 type DomainCPUTuneVCPUPin struct { 2752 VCPU uint `xml:"vcpu,attr"` 2753 CPUSet string `xml:"cpuset,attr"` 2754 } 2755 2756 type DomainCPUTuneEmulatorPin struct { 2757 CPUSet string `xml:"cpuset,attr"` 2758 } 2759 2760 type DomainCPUTuneIOThreadPin struct { 2761 IOThread uint `xml:"iothread,attr"` 2762 CPUSet string `xml:"cpuset,attr"` 2763 } 2764 2765 type DomainCPUTuneVCPUSched struct { 2766 VCPUs string `xml:"vcpus,attr"` 2767 Scheduler string `xml:"scheduler,attr,omitempty"` 2768 Priority *int `xml:"priority,attr"` 2769 } 2770 2771 type DomainCPUTuneIOThreadSched struct { 2772 IOThreads string `xml:"iothreads,attr"` 2773 Scheduler string `xml:"scheduler,attr,omitempty"` 2774 Priority *int `xml:"priority,attr"` 2775 } 2776 2777 type DomainCPUTuneEmulatorSched struct { 2778 Scheduler string `xml:"scheduler,attr,omitempty"` 2779 Priority *int `xml:"priority,attr"` 2780 } 2781 2782 type DomainCPUCacheTune struct { 2783 VCPUs string `xml:"vcpus,attr,omitempty"` 2784 ID string `xml:"id,attr,omitempty"` 2785 Cache []DomainCPUCacheTuneCache `xml:"cache"` 2786 Monitor []DomainCPUCacheTuneMonitor `xml:"monitor"` 2787 } 2788 2789 type DomainCPUCacheTuneCache struct { 2790 ID uint `xml:"id,attr"` 2791 Level uint `xml:"level,attr"` 2792 Type string `xml:"type,attr"` 2793 Size uint `xml:"size,attr"` 2794 Unit string `xml:"unit,attr"` 2795 } 2796 2797 type DomainCPUCacheTuneMonitor struct { 2798 Level uint `xml:"level,attr,omitempty"` 2799 VCPUs string `xml:"vcpus,attr,omitempty"` 2800 } 2801 2802 type DomainCPUMemoryTune struct { 2803 VCPUs string `xml:"vcpus,attr"` 2804 Nodes []DomainCPUMemoryTuneNode `xml:"node"` 2805 Monitor []DomainCPUMemoryTuneMonitor `xml:"monitor"` 2806 } 2807 2808 type DomainCPUMemoryTuneNode struct { 2809 ID uint `xml:"id,attr"` 2810 Bandwidth uint `xml:"bandwidth,attr"` 2811 } 2812 2813 type DomainCPUMemoryTuneMonitor struct { 2814 Level uint `xml:"level,attr,omitempty"` 2815 VCPUs string `xml:"vcpus,attr,omitempty"` 2816 } 2817 2818 type DomainCPUTune struct { 2819 Shares *DomainCPUTuneShares `xml:"shares"` 2820 Period *DomainCPUTunePeriod `xml:"period"` 2821 Quota *DomainCPUTuneQuota `xml:"quota"` 2822 GlobalPeriod *DomainCPUTunePeriod `xml:"global_period"` 2823 GlobalQuota *DomainCPUTuneQuota `xml:"global_quota"` 2824 EmulatorPeriod *DomainCPUTunePeriod `xml:"emulator_period"` 2825 EmulatorQuota *DomainCPUTuneQuota `xml:"emulator_quota"` 2826 IOThreadPeriod *DomainCPUTunePeriod `xml:"iothread_period"` 2827 IOThreadQuota *DomainCPUTuneQuota `xml:"iothread_quota"` 2828 VCPUPin []DomainCPUTuneVCPUPin `xml:"vcpupin"` 2829 EmulatorPin *DomainCPUTuneEmulatorPin `xml:"emulatorpin"` 2830 IOThreadPin []DomainCPUTuneIOThreadPin `xml:"iothreadpin"` 2831 VCPUSched []DomainCPUTuneVCPUSched `xml:"vcpusched"` 2832 EmulatorSched *DomainCPUTuneEmulatorSched `xml:"emulatorsched"` 2833 IOThreadSched []DomainCPUTuneIOThreadSched `xml:"iothreadsched"` 2834 CacheTune []DomainCPUCacheTune `xml:"cachetune"` 2835 MemoryTune []DomainCPUMemoryTune `xml:"memorytune"` 2836 } 2837 2838 type DomainQEMUCommandlineArg struct { 2839 Value string `xml:"value,attr"` 2840 } 2841 2842 type DomainQEMUCommandlineEnv struct { 2843 Name string `xml:"name,attr"` 2844 Value string `xml:"value,attr,omitempty"` 2845 } 2846 2847 type DomainQEMUCommandline struct { 2848 XMLName xml.Name `xml:"http://libvirt.org/schemas/domain/qemu/1.0 commandline"` 2849 Args []DomainQEMUCommandlineArg `xml:"arg"` 2850 Envs []DomainQEMUCommandlineEnv `xml:"env"` 2851 } 2852 2853 type DomainQEMUCapabilitiesEntry struct { 2854 Name string `xml:"capability,attr"` 2855 } 2856 type DomainQEMUCapabilities struct { 2857 XMLName xml.Name `xml:"http://libvirt.org/schemas/domain/qemu/1.0 capabilities"` 2858 Add []DomainQEMUCapabilitiesEntry `xml:"add"` 2859 Del []DomainQEMUCapabilitiesEntry `xml:"del"` 2860 } 2861 2862 type DomainQEMUDeprecation struct { 2863 XMLName xml.Name `xml:"http://libvirt.org/schemas/domain/qemu/1.0 deprecation"` 2864 Behavior string `xml:"behavior,attr,omitempty"` 2865 } 2866 2867 type DomainQEMUOverride struct { 2868 XMLName xml.Name `xml:"http://libvirt.org/schemas/domain/qemu/1.0 override"` 2869 Devices []DomainQEMUOverrideDevice `xml:"device"` 2870 } 2871 2872 type DomainQEMUOverrideDevice struct { 2873 Alias string `xml:"alias,attr"` 2874 Frontend DomainQEMUOverrideFrontend `xml:"frontend"` 2875 } 2876 2877 type DomainQEMUOverrideFrontend struct { 2878 Properties []DomainQEMUOverrideProperty `xml:"property"` 2879 } 2880 2881 type DomainQEMUOverrideProperty struct { 2882 Name string `xml:"name,attr"` 2883 Type string `xml:"type,attr,omitempty"` 2884 Value string `xml:"value,attr,omitempty"` 2885 } 2886 2887 type DomainLXCNamespace struct { 2888 XMLName xml.Name `xml:"http://libvirt.org/schemas/domain/lxc/1.0 namespace"` 2889 ShareNet *DomainLXCNamespaceMap `xml:"sharenet"` 2890 ShareIPC *DomainLXCNamespaceMap `xml:"shareipc"` 2891 ShareUTS *DomainLXCNamespaceMap `xml:"shareuts"` 2892 } 2893 2894 type DomainLXCNamespaceMap struct { 2895 Type string `xml:"type,attr"` 2896 Value string `xml:"value,attr"` 2897 } 2898 2899 type DomainBHyveCommandlineArg struct { 2900 Value string `xml:"value,attr"` 2901 } 2902 2903 type DomainBHyveCommandlineEnv struct { 2904 Name string `xml:"name,attr"` 2905 Value string `xml:"value,attr,omitempty"` 2906 } 2907 2908 type DomainBHyveCommandline struct { 2909 XMLName xml.Name `xml:"http://libvirt.org/schemas/domain/bhyve/1.0 commandline"` 2910 Args []DomainBHyveCommandlineArg `xml:"arg"` 2911 Envs []DomainBHyveCommandlineEnv `xml:"env"` 2912 } 2913 2914 type DomainXenCommandlineArg struct { 2915 Value string `xml:"value,attr"` 2916 } 2917 2918 type DomainXenCommandline struct { 2919 XMLName xml.Name `xml:"http://libvirt.org/schemas/domain/xen/1.0 commandline"` 2920 Args []DomainXenCommandlineArg `xml:"arg"` 2921 } 2922 2923 type DomainBlockIOTune struct { 2924 Weight uint `xml:"weight,omitempty"` 2925 Device []DomainBlockIOTuneDevice `xml:"device"` 2926 } 2927 2928 type DomainBlockIOTuneDevice struct { 2929 Path string `xml:"path"` 2930 Weight uint `xml:"weight,omitempty"` 2931 ReadIopsSec uint `xml:"read_iops_sec,omitempty"` 2932 WriteIopsSec uint `xml:"write_iops_sec,omitempty"` 2933 ReadBytesSec uint `xml:"read_bytes_sec,omitempty"` 2934 WriteBytesSec uint `xml:"write_bytes_sec,omitempty"` 2935 } 2936 2937 type DomainPM struct { 2938 SuspendToMem *DomainPMPolicy `xml:"suspend-to-mem"` 2939 SuspendToDisk *DomainPMPolicy `xml:"suspend-to-disk"` 2940 } 2941 2942 type DomainPMPolicy struct { 2943 Enabled string `xml:"enabled,attr"` 2944 } 2945 2946 type DomainSecLabel struct { 2947 Type string `xml:"type,attr,omitempty"` 2948 Model string `xml:"model,attr,omitempty"` 2949 Relabel string `xml:"relabel,attr,omitempty"` 2950 Label string `xml:"label,omitempty"` 2951 ImageLabel string `xml:"imagelabel,omitempty"` 2952 BaseLabel string `xml:"baselabel,omitempty"` 2953 } 2954 2955 type DomainDeviceSecLabel struct { 2956 Model string `xml:"model,attr,omitempty"` 2957 LabelSkip string `xml:"labelskip,attr,omitempty"` 2958 Relabel string `xml:"relabel,attr,omitempty"` 2959 Label string `xml:"label,omitempty"` 2960 } 2961 2962 type DomainNUMATune struct { 2963 Memory *DomainNUMATuneMemory `xml:"memory"` 2964 MemNodes []DomainNUMATuneMemNode `xml:"memnode"` 2965 } 2966 2967 type DomainNUMATuneMemory struct { 2968 Mode string `xml:"mode,attr,omitempty"` 2969 Nodeset string `xml:"nodeset,attr,omitempty"` 2970 Placement string `xml:"placement,attr,omitempty"` 2971 } 2972 2973 type DomainNUMATuneMemNode struct { 2974 CellID uint `xml:"cellid,attr"` 2975 Mode string `xml:"mode,attr"` 2976 Nodeset string `xml:"nodeset,attr"` 2977 } 2978 2979 type DomainIOThreadIDs struct { 2980 IOThreads []DomainIOThread `xml:"iothread"` 2981 } 2982 2983 type DomainIOThreadPoll struct { 2984 Max *uint `xml:"max,attr"` 2985 Grow *uint `xml:"grow,attr"` 2986 Shrink *uint `xml:"shrink,attr"` 2987 } 2988 2989 type DomainIOThread struct { 2990 ID uint `xml:"id,attr"` 2991 PoolMin *uint `xml:"thread_pool_min,attr"` 2992 PoolMax *uint `xml:"thread_pool_max,attr"` 2993 Poll *DomainIOThreadPoll `xml:"poll"` 2994 } 2995 2996 type DomainDefaultIOThread struct { 2997 PoolMin *uint `xml:"thread_pool_min,attr"` 2998 PoolMax *uint `xml:"thread_pool_max,attr"` 2999 } 3000 3001 type DomainKeyWrap struct { 3002 Ciphers []DomainKeyWrapCipher `xml:"cipher"` 3003 } 3004 3005 type DomainKeyWrapCipher struct { 3006 Name string `xml:"name,attr"` 3007 State string `xml:"state,attr"` 3008 } 3009 3010 type DomainIDMap struct { 3011 UIDs []DomainIDMapRange `xml:"uid"` 3012 GIDs []DomainIDMapRange `xml:"gid"` 3013 } 3014 3015 type DomainIDMapRange struct { 3016 Start uint `xml:"start,attr"` 3017 Target uint `xml:"target,attr"` 3018 Count uint `xml:"count,attr"` 3019 } 3020 3021 type DomainMemoryTuneLimit struct { 3022 Value uint64 `xml:",chardata"` 3023 Unit string `xml:"unit,attr,omitempty"` 3024 } 3025 3026 type DomainMemoryTune struct { 3027 HardLimit *DomainMemoryTuneLimit `xml:"hard_limit"` 3028 SoftLimit *DomainMemoryTuneLimit `xml:"soft_limit"` 3029 MinGuarantee *DomainMemoryTuneLimit `xml:"min_guarantee"` 3030 SwapHardLimit *DomainMemoryTuneLimit `xml:"swap_hard_limit"` 3031 } 3032 3033 type DomainMetadata struct { 3034 XML string `xml:",innerxml"` 3035 } 3036 3037 type DomainVMWareDataCenterPath struct { 3038 XMLName xml.Name `xml:"http://libvirt.org/schemas/domain/vmware/1.0 datacenterpath"` 3039 Value string `xml:",chardata"` 3040 } 3041 3042 type DomainPerf struct { 3043 Events []DomainPerfEvent `xml:"event"` 3044 } 3045 3046 type DomainPerfEvent struct { 3047 Name string `xml:"name,attr"` 3048 Enabled string `xml:"enabled,attr"` 3049 } 3050 3051 type DomainGenID struct { 3052 Value string `xml:",chardata"` 3053 } 3054 3055 // NB, try to keep the order of fields in this struct 3056 // matching the order of XML elements that libvirt 3057 // will generate when dumping XML. 3058 type Domain struct { 3059 XMLName xml.Name `xml:"domain"` 3060 Type string `xml:"type,attr,omitempty"` 3061 ID *int `xml:"id,attr"` 3062 Name string `xml:"name,omitempty"` 3063 UUID string `xml:"uuid,omitempty"` 3064 GenID *DomainGenID `xml:"genid"` 3065 Title string `xml:"title,omitempty"` 3066 Description string `xml:"description,omitempty"` 3067 Metadata *DomainMetadata `xml:"metadata"` 3068 MaximumMemory *DomainMaxMemory `xml:"maxMemory"` 3069 Memory *DomainMemory `xml:"memory"` 3070 CurrentMemory *DomainCurrentMemory `xml:"currentMemory"` 3071 BlockIOTune *DomainBlockIOTune `xml:"blkiotune"` 3072 MemoryTune *DomainMemoryTune `xml:"memtune"` 3073 MemoryBacking *DomainMemoryBacking `xml:"memoryBacking"` 3074 VCPU *DomainVCPU `xml:"vcpu"` 3075 VCPUs *DomainVCPUs `xml:"vcpus"` 3076 IOThreads uint `xml:"iothreads,omitempty"` 3077 IOThreadIDs *DomainIOThreadIDs `xml:"iothreadids"` 3078 DefaultIOThread *DomainDefaultIOThread `xml:"defaultiothread"` 3079 CPUTune *DomainCPUTune `xml:"cputune"` 3080 NUMATune *DomainNUMATune `xml:"numatune"` 3081 Resource *DomainResource `xml:"resource"` 3082 SysInfo []DomainSysInfo `xml:"sysinfo"` 3083 Bootloader string `xml:"bootloader,omitempty"` 3084 BootloaderArgs string `xml:"bootloader_args,omitempty"` 3085 OS *DomainOS `xml:"os"` 3086 IDMap *DomainIDMap `xml:"idmap"` 3087 Features *DomainFeatureList `xml:"features"` 3088 CPU *DomainCPU `xml:"cpu"` 3089 Clock *DomainClock `xml:"clock"` 3090 OnPoweroff string `xml:"on_poweroff,omitempty"` 3091 OnReboot string `xml:"on_reboot,omitempty"` 3092 OnCrash string `xml:"on_crash,omitempty"` 3093 PM *DomainPM `xml:"pm"` 3094 Perf *DomainPerf `xml:"perf"` 3095 Devices *DomainDeviceList `xml:"devices"` 3096 SecLabel []DomainSecLabel `xml:"seclabel"` 3097 KeyWrap *DomainKeyWrap `xml:"keywrap"` 3098 LaunchSecurity *DomainLaunchSecurity `xml:"launchSecurity"` 3099 3100 /* Hypervisor namespaces must all be last */ 3101 QEMUCommandline *DomainQEMUCommandline 3102 QEMUCapabilities *DomainQEMUCapabilities 3103 QEMUOverride *DomainQEMUOverride 3104 QEMUDeprecation *DomainQEMUDeprecation 3105 LXCNamespace *DomainLXCNamespace 3106 BHyveCommandline *DomainBHyveCommandline 3107 VMWareDataCenterPath *DomainVMWareDataCenterPath 3108 XenCommandline *DomainXenCommandline 3109 } 3110 3111 func (d *Domain) Unmarshal(doc string) error { 3112 return xml.Unmarshal([]byte(doc), d) 3113 } 3114 3115 func (d *Domain) Marshal() (string, error) { 3116 doc, err := xml.MarshalIndent(d, "", " ") 3117 if err != nil { 3118 return "", err 3119 } 3120 return string(doc), nil 3121 } 3122 3123 type domainController DomainController 3124 3125 type domainControllerPCI struct { 3126 DomainControllerPCI 3127 domainController 3128 } 3129 3130 type domainControllerUSB struct { 3131 DomainControllerUSB 3132 domainController 3133 } 3134 3135 type domainControllerVirtIOSerial struct { 3136 DomainControllerVirtIOSerial 3137 domainController 3138 } 3139 3140 type domainControllerXenBus struct { 3141 DomainControllerXenBus 3142 domainController 3143 } 3144 3145 func (a *DomainControllerPCITarget) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 3146 marshalUintAttr(&start, "chassisNr", a.ChassisNr, "%d") 3147 marshalUintAttr(&start, "chassis", a.Chassis, "%d") 3148 marshalUintAttr(&start, "port", a.Port, "%d") 3149 marshalUintAttr(&start, "busNr", a.BusNr, "%d") 3150 marshalUintAttr(&start, "index", a.Index, "%d") 3151 marshalUint64Attr(&start, "memReserve", a.MemReserve, "%d") 3152 if a.Hotplug != "" { 3153 start.Attr = append(start.Attr, xml.Attr{ 3154 xml.Name{Local: "hotplug"}, a.Hotplug, 3155 }) 3156 } 3157 e.EncodeToken(start) 3158 if a.NUMANode != nil { 3159 node := xml.StartElement{ 3160 Name: xml.Name{Local: "node"}, 3161 } 3162 e.EncodeToken(node) 3163 e.EncodeToken(xml.CharData(fmt.Sprintf("%d", *a.NUMANode))) 3164 e.EncodeToken(node.End()) 3165 } 3166 e.EncodeToken(start.End()) 3167 return nil 3168 } 3169 3170 func (a *DomainControllerPCITarget) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 3171 for _, attr := range start.Attr { 3172 if attr.Name.Local == "chassisNr" { 3173 if err := unmarshalUintAttr(attr.Value, &a.ChassisNr, 10); err != nil { 3174 return err 3175 } 3176 } else if attr.Name.Local == "chassis" { 3177 if err := unmarshalUintAttr(attr.Value, &a.Chassis, 10); err != nil { 3178 return err 3179 } 3180 } else if attr.Name.Local == "port" { 3181 if err := unmarshalUintAttr(attr.Value, &a.Port, 0); err != nil { 3182 return err 3183 } 3184 } else if attr.Name.Local == "busNr" { 3185 if err := unmarshalUintAttr(attr.Value, &a.BusNr, 10); err != nil { 3186 return err 3187 } 3188 } else if attr.Name.Local == "index" { 3189 if err := unmarshalUintAttr(attr.Value, &a.Index, 10); err != nil { 3190 return err 3191 } 3192 } else if attr.Name.Local == "memReserve" { 3193 if err := unmarshalUint64Attr(attr.Value, &a.MemReserve, 10); err != nil { 3194 return err 3195 } 3196 } else if attr.Name.Local == "hotplug" { 3197 a.Hotplug = attr.Value 3198 } 3199 } 3200 for { 3201 tok, err := d.Token() 3202 if err == io.EOF { 3203 break 3204 } 3205 if err != nil { 3206 return err 3207 } 3208 3209 switch tok := tok.(type) { 3210 case xml.StartElement: 3211 if tok.Name.Local == "node" { 3212 data, err := d.Token() 3213 if err != nil { 3214 return err 3215 } 3216 switch data := data.(type) { 3217 case xml.CharData: 3218 val, err := strconv.ParseUint(string(data), 10, 64) 3219 if err != nil { 3220 return err 3221 } 3222 vali := uint(val) 3223 a.NUMANode = &vali 3224 } 3225 } 3226 } 3227 } 3228 return nil 3229 } 3230 3231 func (a *DomainController) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 3232 start.Name.Local = "controller" 3233 if a.Type == "pci" { 3234 pci := domainControllerPCI{} 3235 pci.domainController = domainController(*a) 3236 if a.PCI != nil { 3237 pci.DomainControllerPCI = *a.PCI 3238 } 3239 return e.EncodeElement(pci, start) 3240 } else if a.Type == "usb" { 3241 usb := domainControllerUSB{} 3242 usb.domainController = domainController(*a) 3243 if a.USB != nil { 3244 usb.DomainControllerUSB = *a.USB 3245 } 3246 return e.EncodeElement(usb, start) 3247 } else if a.Type == "virtio-serial" { 3248 vioserial := domainControllerVirtIOSerial{} 3249 vioserial.domainController = domainController(*a) 3250 if a.VirtIOSerial != nil { 3251 vioserial.DomainControllerVirtIOSerial = *a.VirtIOSerial 3252 } 3253 return e.EncodeElement(vioserial, start) 3254 } else if a.Type == "xenbus" { 3255 xenbus := domainControllerXenBus{} 3256 xenbus.domainController = domainController(*a) 3257 if a.XenBus != nil { 3258 xenbus.DomainControllerXenBus = *a.XenBus 3259 } 3260 return e.EncodeElement(xenbus, start) 3261 } else { 3262 gen := domainController(*a) 3263 return e.EncodeElement(gen, start) 3264 } 3265 } 3266 3267 func getAttr(attrs []xml.Attr, name string) (string, bool) { 3268 for _, attr := range attrs { 3269 if attr.Name.Local == name { 3270 return attr.Value, true 3271 } 3272 } 3273 return "", false 3274 } 3275 3276 func (a *DomainController) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 3277 typ, ok := getAttr(start.Attr, "type") 3278 if !ok { 3279 return fmt.Errorf("Missing 'type' attribute on domain controller") 3280 } 3281 if typ == "pci" { 3282 var pci domainControllerPCI 3283 err := d.DecodeElement(&pci, &start) 3284 if err != nil { 3285 return err 3286 } 3287 *a = DomainController(pci.domainController) 3288 a.PCI = &pci.DomainControllerPCI 3289 return nil 3290 } else if typ == "usb" { 3291 var usb domainControllerUSB 3292 err := d.DecodeElement(&usb, &start) 3293 if err != nil { 3294 return err 3295 } 3296 *a = DomainController(usb.domainController) 3297 a.USB = &usb.DomainControllerUSB 3298 return nil 3299 } else if typ == "virtio-serial" { 3300 var vioserial domainControllerVirtIOSerial 3301 err := d.DecodeElement(&vioserial, &start) 3302 if err != nil { 3303 return err 3304 } 3305 *a = DomainController(vioserial.domainController) 3306 a.VirtIOSerial = &vioserial.DomainControllerVirtIOSerial 3307 return nil 3308 } else if typ == "xenbus" { 3309 var xenbus domainControllerXenBus 3310 err := d.DecodeElement(&xenbus, &start) 3311 if err != nil { 3312 return err 3313 } 3314 *a = DomainController(xenbus.domainController) 3315 a.XenBus = &xenbus.DomainControllerXenBus 3316 return nil 3317 } else { 3318 var gen domainController 3319 err := d.DecodeElement(&gen, &start) 3320 if err != nil { 3321 return err 3322 } 3323 *a = DomainController(gen) 3324 return nil 3325 } 3326 } 3327 3328 func (d *DomainGraphic) Unmarshal(doc string) error { 3329 return xml.Unmarshal([]byte(doc), d) 3330 } 3331 3332 func (d *DomainGraphic) Marshal() (string, error) { 3333 doc, err := xml.MarshalIndent(d, "", " ") 3334 if err != nil { 3335 return "", err 3336 } 3337 return string(doc), nil 3338 } 3339 3340 func (d *DomainController) Unmarshal(doc string) error { 3341 return xml.Unmarshal([]byte(doc), d) 3342 } 3343 3344 func (d *DomainController) Marshal() (string, error) { 3345 doc, err := xml.MarshalIndent(d, "", " ") 3346 if err != nil { 3347 return "", err 3348 } 3349 return string(doc), nil 3350 } 3351 3352 func (a *DomainDiskReservationsSource) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 3353 start.Name.Local = "source" 3354 src := DomainChardevSource(*a) 3355 typ := getChardevSourceType(&src) 3356 if typ != "" { 3357 start.Attr = append(start.Attr, xml.Attr{ 3358 xml.Name{Local: "type"}, typ, 3359 }) 3360 } 3361 return e.EncodeElement(&src, start) 3362 } 3363 3364 func (a *DomainDiskReservationsSource) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 3365 typ, ok := getAttr(start.Attr, "type") 3366 if !ok { 3367 typ = "unix" 3368 } 3369 src := createChardevSource(typ) 3370 err := d.DecodeElement(&src, &start) 3371 if err != nil { 3372 return err 3373 } 3374 *a = DomainDiskReservationsSource(*src) 3375 return nil 3376 } 3377 3378 func (a *DomainDiskSourceVHostUser) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 3379 start.Name.Local = "source" 3380 src := DomainChardevSource(*a) 3381 typ := getChardevSourceType(&src) 3382 if typ != "" { 3383 start.Attr = append(start.Attr, xml.Attr{ 3384 xml.Name{Local: "type"}, typ, 3385 }) 3386 } 3387 return e.EncodeElement(&src, start) 3388 } 3389 3390 func (a *DomainDiskSourceVHostUser) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 3391 typ, ok := getAttr(start.Attr, "type") 3392 if !ok { 3393 typ = "unix" 3394 } 3395 src := createChardevSource(typ) 3396 err := d.DecodeElement(&src, &start) 3397 if err != nil { 3398 return err 3399 } 3400 *a = DomainDiskSourceVHostUser(*src) 3401 return nil 3402 } 3403 3404 type domainDiskSource DomainDiskSource 3405 3406 type domainDiskSourceFile struct { 3407 DomainDiskSourceFile 3408 domainDiskSource 3409 } 3410 3411 type domainDiskSourceBlock struct { 3412 DomainDiskSourceBlock 3413 domainDiskSource 3414 } 3415 3416 type domainDiskSourceDir struct { 3417 DomainDiskSourceDir 3418 domainDiskSource 3419 } 3420 3421 type domainDiskSourceNetwork struct { 3422 DomainDiskSourceNetwork 3423 domainDiskSource 3424 } 3425 3426 type domainDiskSourceVolume struct { 3427 DomainDiskSourceVolume 3428 domainDiskSource 3429 } 3430 3431 type domainDiskSourceNVMEPCI struct { 3432 DomainDiskSourceNVMEPCI 3433 domainDiskSource 3434 } 3435 3436 type domainDiskSourceVHostUser struct { 3437 DomainDiskSourceVHostUser 3438 domainDiskSource 3439 } 3440 3441 type domainDiskSourceVHostVDPA struct { 3442 DomainDiskSourceVHostVDPA 3443 domainDiskSource 3444 } 3445 3446 func (a *DomainDiskSource) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 3447 if a.File != nil { 3448 if a.StartupPolicy == "" && a.Encryption == nil && a.File.File == "" { 3449 return nil 3450 } 3451 file := domainDiskSourceFile{ 3452 *a.File, domainDiskSource(*a), 3453 } 3454 return e.EncodeElement(&file, start) 3455 } else if a.Block != nil { 3456 if a.StartupPolicy == "" && a.Encryption == nil && a.Block.Dev == "" { 3457 return nil 3458 } 3459 block := domainDiskSourceBlock{ 3460 *a.Block, domainDiskSource(*a), 3461 } 3462 return e.EncodeElement(&block, start) 3463 } else if a.Dir != nil { 3464 dir := domainDiskSourceDir{ 3465 *a.Dir, domainDiskSource(*a), 3466 } 3467 return e.EncodeElement(&dir, start) 3468 } else if a.Network != nil { 3469 network := domainDiskSourceNetwork{ 3470 *a.Network, domainDiskSource(*a), 3471 } 3472 return e.EncodeElement(&network, start) 3473 } else if a.Volume != nil { 3474 if a.StartupPolicy == "" && a.Encryption == nil && a.Volume.Pool == "" && a.Volume.Volume == "" { 3475 return nil 3476 } 3477 volume := domainDiskSourceVolume{ 3478 *a.Volume, domainDiskSource(*a), 3479 } 3480 return e.EncodeElement(&volume, start) 3481 } else if a.NVME != nil { 3482 if a.NVME.PCI != nil { 3483 nvme := domainDiskSourceNVMEPCI{ 3484 *a.NVME.PCI, domainDiskSource(*a), 3485 } 3486 start.Attr = append(start.Attr, xml.Attr{ 3487 xml.Name{Local: "type"}, "pci", 3488 }) 3489 return e.EncodeElement(&nvme, start) 3490 } 3491 } else if a.VHostUser != nil { 3492 vhost := domainDiskSourceVHostUser{ 3493 *a.VHostUser, domainDiskSource(*a), 3494 } 3495 return e.EncodeElement(&vhost, start) 3496 } else if a.VHostVDPA != nil { 3497 vhost := domainDiskSourceVHostVDPA{ 3498 *a.VHostVDPA, domainDiskSource(*a), 3499 } 3500 return e.EncodeElement(&vhost, start) 3501 } 3502 return nil 3503 } 3504 3505 func (a *DomainDiskSource) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 3506 if a.File != nil { 3507 file := domainDiskSourceFile{ 3508 *a.File, domainDiskSource(*a), 3509 } 3510 err := d.DecodeElement(&file, &start) 3511 if err != nil { 3512 return err 3513 } 3514 *a = DomainDiskSource(file.domainDiskSource) 3515 a.File = &file.DomainDiskSourceFile 3516 } else if a.Block != nil { 3517 block := domainDiskSourceBlock{ 3518 *a.Block, domainDiskSource(*a), 3519 } 3520 err := d.DecodeElement(&block, &start) 3521 if err != nil { 3522 return err 3523 } 3524 *a = DomainDiskSource(block.domainDiskSource) 3525 a.Block = &block.DomainDiskSourceBlock 3526 } else if a.Dir != nil { 3527 dir := domainDiskSourceDir{ 3528 *a.Dir, domainDiskSource(*a), 3529 } 3530 err := d.DecodeElement(&dir, &start) 3531 if err != nil { 3532 return err 3533 } 3534 *a = DomainDiskSource(dir.domainDiskSource) 3535 a.Dir = &dir.DomainDiskSourceDir 3536 } else if a.Network != nil { 3537 network := domainDiskSourceNetwork{ 3538 *a.Network, domainDiskSource(*a), 3539 } 3540 err := d.DecodeElement(&network, &start) 3541 if err != nil { 3542 return err 3543 } 3544 *a = DomainDiskSource(network.domainDiskSource) 3545 a.Network = &network.DomainDiskSourceNetwork 3546 } else if a.Volume != nil { 3547 volume := domainDiskSourceVolume{ 3548 *a.Volume, domainDiskSource(*a), 3549 } 3550 err := d.DecodeElement(&volume, &start) 3551 if err != nil { 3552 return err 3553 } 3554 *a = DomainDiskSource(volume.domainDiskSource) 3555 a.Volume = &volume.DomainDiskSourceVolume 3556 } else if a.NVME != nil { 3557 typ, ok := getAttr(start.Attr, "type") 3558 if !ok { 3559 return fmt.Errorf("Missing nvme source type") 3560 } 3561 if typ == "pci" { 3562 a.NVME.PCI = &DomainDiskSourceNVMEPCI{} 3563 nvme := domainDiskSourceNVMEPCI{ 3564 *a.NVME.PCI, domainDiskSource(*a), 3565 } 3566 err := d.DecodeElement(&nvme, &start) 3567 if err != nil { 3568 return err 3569 } 3570 *a = DomainDiskSource(nvme.domainDiskSource) 3571 a.NVME.PCI = &nvme.DomainDiskSourceNVMEPCI 3572 } 3573 } else if a.VHostUser != nil { 3574 vhost := domainDiskSourceVHostUser{ 3575 *a.VHostUser, domainDiskSource(*a), 3576 } 3577 err := d.DecodeElement(&vhost, &start) 3578 if err != nil { 3579 return err 3580 } 3581 *a = DomainDiskSource(vhost.domainDiskSource) 3582 a.VHostUser = &vhost.DomainDiskSourceVHostUser 3583 } else if a.VHostVDPA != nil { 3584 vhost := domainDiskSourceVHostVDPA{ 3585 *a.VHostVDPA, domainDiskSource(*a), 3586 } 3587 err := d.DecodeElement(&vhost, &start) 3588 if err != nil { 3589 return err 3590 } 3591 *a = DomainDiskSource(vhost.domainDiskSource) 3592 a.VHostVDPA = &vhost.DomainDiskSourceVHostVDPA 3593 } 3594 return nil 3595 } 3596 3597 type domainDiskBackingStore DomainDiskBackingStore 3598 3599 func (a *DomainDiskBackingStore) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 3600 start.Name.Local = "backingStore" 3601 if a.Source != nil { 3602 if a.Source.File != nil { 3603 start.Attr = append(start.Attr, xml.Attr{ 3604 xml.Name{Local: "type"}, "file", 3605 }) 3606 } else if a.Source.Block != nil { 3607 start.Attr = append(start.Attr, xml.Attr{ 3608 xml.Name{Local: "type"}, "block", 3609 }) 3610 } else if a.Source.Dir != nil { 3611 start.Attr = append(start.Attr, xml.Attr{ 3612 xml.Name{Local: "type"}, "dir", 3613 }) 3614 } else if a.Source.Network != nil { 3615 start.Attr = append(start.Attr, xml.Attr{ 3616 xml.Name{Local: "type"}, "network", 3617 }) 3618 } else if a.Source.Volume != nil { 3619 start.Attr = append(start.Attr, xml.Attr{ 3620 xml.Name{Local: "type"}, "volume", 3621 }) 3622 } else if a.Source.VHostUser != nil { 3623 start.Attr = append(start.Attr, xml.Attr{ 3624 xml.Name{Local: "type"}, "vhostuser", 3625 }) 3626 } else if a.Source.VHostVDPA != nil { 3627 start.Attr = append(start.Attr, xml.Attr{ 3628 xml.Name{Local: "type"}, "vhostvdpa", 3629 }) 3630 } 3631 } 3632 disk := domainDiskBackingStore(*a) 3633 return e.EncodeElement(disk, start) 3634 } 3635 3636 func (a *DomainDiskBackingStore) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 3637 typ, ok := getAttr(start.Attr, "type") 3638 if !ok { 3639 typ = "file" 3640 } 3641 a.Source = &DomainDiskSource{} 3642 if typ == "file" { 3643 a.Source.File = &DomainDiskSourceFile{} 3644 } else if typ == "block" { 3645 a.Source.Block = &DomainDiskSourceBlock{} 3646 } else if typ == "network" { 3647 a.Source.Network = &DomainDiskSourceNetwork{} 3648 } else if typ == "dir" { 3649 a.Source.Dir = &DomainDiskSourceDir{} 3650 } else if typ == "volume" { 3651 a.Source.Volume = &DomainDiskSourceVolume{} 3652 } else if typ == "vhostuser" { 3653 a.Source.VHostUser = &DomainDiskSourceVHostUser{} 3654 } else if typ == "vhostvdpa" { 3655 a.Source.VHostVDPA = &DomainDiskSourceVHostVDPA{} 3656 } 3657 disk := domainDiskBackingStore(*a) 3658 err := d.DecodeElement(&disk, &start) 3659 if err != nil { 3660 return err 3661 } 3662 *a = DomainDiskBackingStore(disk) 3663 if !ok && a.Source.File.File == "" { 3664 a.Source.File = nil 3665 } 3666 return nil 3667 } 3668 3669 type domainDiskMirror DomainDiskMirror 3670 3671 func (a *DomainDiskMirror) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 3672 start.Name.Local = "mirror" 3673 if a.Source != nil { 3674 if a.Source.File != nil { 3675 start.Attr = append(start.Attr, xml.Attr{ 3676 xml.Name{Local: "type"}, "file", 3677 }) 3678 if a.Source.File.File != "" { 3679 start.Attr = append(start.Attr, xml.Attr{ 3680 xml.Name{Local: "file"}, a.Source.File.File, 3681 }) 3682 } 3683 if a.Format != nil && a.Format.Type != "" { 3684 start.Attr = append(start.Attr, xml.Attr{ 3685 xml.Name{Local: "format"}, a.Format.Type, 3686 }) 3687 } 3688 } else if a.Source.Block != nil { 3689 start.Attr = append(start.Attr, xml.Attr{ 3690 xml.Name{Local: "type"}, "block", 3691 }) 3692 } else if a.Source.Dir != nil { 3693 start.Attr = append(start.Attr, xml.Attr{ 3694 xml.Name{Local: "type"}, "dir", 3695 }) 3696 } else if a.Source.Network != nil { 3697 start.Attr = append(start.Attr, xml.Attr{ 3698 xml.Name{Local: "type"}, "network", 3699 }) 3700 } else if a.Source.Volume != nil { 3701 start.Attr = append(start.Attr, xml.Attr{ 3702 xml.Name{Local: "type"}, "volume", 3703 }) 3704 } else if a.Source.VHostUser != nil { 3705 start.Attr = append(start.Attr, xml.Attr{ 3706 xml.Name{Local: "type"}, "vhostuser", 3707 }) 3708 } else if a.Source.VHostVDPA != nil { 3709 start.Attr = append(start.Attr, xml.Attr{ 3710 xml.Name{Local: "type"}, "vhostvdpa", 3711 }) 3712 } 3713 } 3714 disk := domainDiskMirror(*a) 3715 return e.EncodeElement(disk, start) 3716 } 3717 3718 func (a *DomainDiskMirror) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 3719 typ, ok := getAttr(start.Attr, "type") 3720 if !ok { 3721 typ = "file" 3722 } 3723 a.Source = &DomainDiskSource{} 3724 if typ == "file" { 3725 a.Source.File = &DomainDiskSourceFile{} 3726 } else if typ == "block" { 3727 a.Source.Block = &DomainDiskSourceBlock{} 3728 } else if typ == "network" { 3729 a.Source.Network = &DomainDiskSourceNetwork{} 3730 } else if typ == "dir" { 3731 a.Source.Dir = &DomainDiskSourceDir{} 3732 } else if typ == "volume" { 3733 a.Source.Volume = &DomainDiskSourceVolume{} 3734 } else if typ == "vhostuser" { 3735 a.Source.VHostUser = &DomainDiskSourceVHostUser{} 3736 } else if typ == "vhostvdpa" { 3737 a.Source.VHostVDPA = &DomainDiskSourceVHostVDPA{} 3738 } 3739 disk := domainDiskMirror(*a) 3740 err := d.DecodeElement(&disk, &start) 3741 if err != nil { 3742 return err 3743 } 3744 *a = DomainDiskMirror(disk) 3745 if !ok { 3746 if a.Source.File.File == "" { 3747 file, ok := getAttr(start.Attr, "file") 3748 if ok { 3749 a.Source.File.File = file 3750 } else { 3751 a.Source.File = nil 3752 } 3753 } 3754 if a.Format == nil { 3755 format, ok := getAttr(start.Attr, "format") 3756 if ok { 3757 a.Format = &DomainDiskFormat{ 3758 Type: format, 3759 } 3760 } 3761 } 3762 } 3763 return nil 3764 } 3765 3766 type domainDisk DomainDisk 3767 3768 func (a *DomainDisk) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 3769 start.Name.Local = "disk" 3770 if a.Source != nil { 3771 if a.Source.File != nil { 3772 start.Attr = append(start.Attr, xml.Attr{ 3773 xml.Name{Local: "type"}, "file", 3774 }) 3775 } else if a.Source.Block != nil { 3776 start.Attr = append(start.Attr, xml.Attr{ 3777 xml.Name{Local: "type"}, "block", 3778 }) 3779 } else if a.Source.Dir != nil { 3780 start.Attr = append(start.Attr, xml.Attr{ 3781 xml.Name{Local: "type"}, "dir", 3782 }) 3783 } else if a.Source.Network != nil { 3784 start.Attr = append(start.Attr, xml.Attr{ 3785 xml.Name{Local: "type"}, "network", 3786 }) 3787 } else if a.Source.Volume != nil { 3788 start.Attr = append(start.Attr, xml.Attr{ 3789 xml.Name{Local: "type"}, "volume", 3790 }) 3791 } else if a.Source.NVME != nil { 3792 start.Attr = append(start.Attr, xml.Attr{ 3793 xml.Name{Local: "type"}, "nvme", 3794 }) 3795 } else if a.Source.VHostUser != nil { 3796 start.Attr = append(start.Attr, xml.Attr{ 3797 xml.Name{Local: "type"}, "vhostuser", 3798 }) 3799 } else if a.Source.VHostVDPA != nil { 3800 start.Attr = append(start.Attr, xml.Attr{ 3801 xml.Name{Local: "type"}, "vhostvdpa", 3802 }) 3803 } 3804 } 3805 disk := domainDisk(*a) 3806 return e.EncodeElement(disk, start) 3807 } 3808 3809 func (a *DomainDisk) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 3810 typ, ok := getAttr(start.Attr, "type") 3811 if !ok { 3812 typ = "file" 3813 } 3814 a.Source = &DomainDiskSource{} 3815 if typ == "file" { 3816 a.Source.File = &DomainDiskSourceFile{} 3817 } else if typ == "block" { 3818 a.Source.Block = &DomainDiskSourceBlock{} 3819 } else if typ == "network" { 3820 a.Source.Network = &DomainDiskSourceNetwork{} 3821 } else if typ == "dir" { 3822 a.Source.Dir = &DomainDiskSourceDir{} 3823 } else if typ == "volume" { 3824 a.Source.Volume = &DomainDiskSourceVolume{} 3825 } else if typ == "nvme" { 3826 a.Source.NVME = &DomainDiskSourceNVME{} 3827 } else if typ == "vhostuser" { 3828 a.Source.VHostUser = &DomainDiskSourceVHostUser{} 3829 } else if typ == "vhostvdpa" { 3830 a.Source.VHostVDPA = &DomainDiskSourceVHostVDPA{} 3831 } 3832 disk := domainDisk(*a) 3833 err := d.DecodeElement(&disk, &start) 3834 if err != nil { 3835 return err 3836 } 3837 *a = DomainDisk(disk) 3838 return nil 3839 } 3840 3841 func (d *DomainDisk) Unmarshal(doc string) error { 3842 return xml.Unmarshal([]byte(doc), d) 3843 } 3844 3845 func (d *DomainDisk) Marshal() (string, error) { 3846 doc, err := xml.MarshalIndent(d, "", " ") 3847 if err != nil { 3848 return "", err 3849 } 3850 return string(doc), nil 3851 } 3852 3853 type domainInputSource DomainInputSource 3854 3855 type domainInputSourcePassthrough struct { 3856 DomainInputSourcePassthrough 3857 domainInputSource 3858 } 3859 3860 type domainInputSourceEVDev struct { 3861 DomainInputSourceEVDev 3862 domainInputSource 3863 } 3864 3865 func (a *DomainInputSource) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 3866 if a.Passthrough != nil { 3867 passthrough := domainInputSourcePassthrough{ 3868 *a.Passthrough, domainInputSource(*a), 3869 } 3870 return e.EncodeElement(&passthrough, start) 3871 } else if a.EVDev != nil { 3872 evdev := domainInputSourceEVDev{ 3873 *a.EVDev, domainInputSource(*a), 3874 } 3875 return e.EncodeElement(&evdev, start) 3876 } 3877 return nil 3878 } 3879 3880 func (a *DomainInputSource) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 3881 if a.Passthrough != nil { 3882 passthrough := domainInputSourcePassthrough{ 3883 *a.Passthrough, domainInputSource(*a), 3884 } 3885 err := d.DecodeElement(&passthrough, &start) 3886 if err != nil { 3887 return err 3888 } 3889 *a = DomainInputSource(passthrough.domainInputSource) 3890 a.Passthrough = &passthrough.DomainInputSourcePassthrough 3891 } else if a.EVDev != nil { 3892 evdev := domainInputSourceEVDev{ 3893 *a.EVDev, domainInputSource(*a), 3894 } 3895 err := d.DecodeElement(&evdev, &start) 3896 if err != nil { 3897 return err 3898 } 3899 *a = DomainInputSource(evdev.domainInputSource) 3900 a.EVDev = &evdev.DomainInputSourceEVDev 3901 } 3902 return nil 3903 } 3904 3905 type domainInput DomainInput 3906 3907 func (a *DomainInput) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 3908 start.Name.Local = "input" 3909 input := domainInput(*a) 3910 return e.EncodeElement(input, start) 3911 } 3912 3913 func (a *DomainInput) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 3914 typ, ok := getAttr(start.Attr, "type") 3915 if ok { 3916 a.Source = &DomainInputSource{} 3917 if typ == "passthrough" { 3918 a.Source.Passthrough = &DomainInputSourcePassthrough{} 3919 } else if typ == "evdev" { 3920 a.Source.EVDev = &DomainInputSourceEVDev{} 3921 } 3922 } 3923 input := domainInput(*a) 3924 err := d.DecodeElement(&input, &start) 3925 if err != nil { 3926 return err 3927 } 3928 *a = DomainInput(input) 3929 return nil 3930 } 3931 3932 func (a *DomainFilesystemSource) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 3933 if a.Mount != nil { 3934 return e.EncodeElement(a.Mount, start) 3935 } else if a.Block != nil { 3936 return e.EncodeElement(a.Block, start) 3937 } else if a.File != nil { 3938 return e.EncodeElement(a.File, start) 3939 } else if a.Template != nil { 3940 return e.EncodeElement(a.Template, start) 3941 } else if a.RAM != nil { 3942 return e.EncodeElement(a.RAM, start) 3943 } else if a.Bind != nil { 3944 return e.EncodeElement(a.Bind, start) 3945 } else if a.Volume != nil { 3946 return e.EncodeElement(a.Volume, start) 3947 } 3948 return nil 3949 } 3950 3951 func (a *DomainFilesystemSource) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 3952 if a.Mount != nil { 3953 return d.DecodeElement(a.Mount, &start) 3954 } else if a.Block != nil { 3955 return d.DecodeElement(a.Block, &start) 3956 } else if a.File != nil { 3957 return d.DecodeElement(a.File, &start) 3958 } else if a.Template != nil { 3959 return d.DecodeElement(a.Template, &start) 3960 } else if a.RAM != nil { 3961 return d.DecodeElement(a.RAM, &start) 3962 } else if a.Bind != nil { 3963 return d.DecodeElement(a.Bind, &start) 3964 } else if a.Volume != nil { 3965 return d.DecodeElement(a.Volume, &start) 3966 } 3967 return nil 3968 } 3969 3970 type domainFilesystem DomainFilesystem 3971 3972 func (a *DomainFilesystem) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 3973 start.Name.Local = "filesystem" 3974 if a.Source != nil { 3975 if a.Source.Mount != nil { 3976 start.Attr = append(start.Attr, xml.Attr{ 3977 xml.Name{Local: "type"}, "mount", 3978 }) 3979 } else if a.Source.Block != nil { 3980 start.Attr = append(start.Attr, xml.Attr{ 3981 xml.Name{Local: "type"}, "block", 3982 }) 3983 } else if a.Source.File != nil { 3984 start.Attr = append(start.Attr, xml.Attr{ 3985 xml.Name{Local: "type"}, "file", 3986 }) 3987 } else if a.Source.Template != nil { 3988 start.Attr = append(start.Attr, xml.Attr{ 3989 xml.Name{Local: "type"}, "template", 3990 }) 3991 } else if a.Source.RAM != nil { 3992 start.Attr = append(start.Attr, xml.Attr{ 3993 xml.Name{Local: "type"}, "ram", 3994 }) 3995 } else if a.Source.Bind != nil { 3996 start.Attr = append(start.Attr, xml.Attr{ 3997 xml.Name{Local: "type"}, "bind", 3998 }) 3999 } else if a.Source.Volume != nil { 4000 start.Attr = append(start.Attr, xml.Attr{ 4001 xml.Name{Local: "type"}, "volume", 4002 }) 4003 } 4004 } 4005 fs := domainFilesystem(*a) 4006 return e.EncodeElement(fs, start) 4007 } 4008 4009 func (a *DomainFilesystem) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 4010 typ, ok := getAttr(start.Attr, "type") 4011 if !ok { 4012 typ = "mount" 4013 } 4014 a.Source = &DomainFilesystemSource{} 4015 if typ == "mount" { 4016 a.Source.Mount = &DomainFilesystemSourceMount{} 4017 } else if typ == "block" { 4018 a.Source.Block = &DomainFilesystemSourceBlock{} 4019 } else if typ == "file" { 4020 a.Source.File = &DomainFilesystemSourceFile{} 4021 } else if typ == "template" { 4022 a.Source.Template = &DomainFilesystemSourceTemplate{} 4023 } else if typ == "ram" { 4024 a.Source.RAM = &DomainFilesystemSourceRAM{} 4025 } else if typ == "bind" { 4026 a.Source.Bind = &DomainFilesystemSourceBind{} 4027 } else if typ == "volume" { 4028 a.Source.Volume = &DomainFilesystemSourceVolume{} 4029 } 4030 fs := domainFilesystem(*a) 4031 err := d.DecodeElement(&fs, &start) 4032 if err != nil { 4033 return err 4034 } 4035 *a = DomainFilesystem(fs) 4036 return nil 4037 } 4038 4039 func (d *DomainFilesystem) Unmarshal(doc string) error { 4040 return xml.Unmarshal([]byte(doc), d) 4041 } 4042 4043 func (d *DomainFilesystem) Marshal() (string, error) { 4044 doc, err := xml.MarshalIndent(d, "", " ") 4045 if err != nil { 4046 return "", err 4047 } 4048 return string(doc), nil 4049 } 4050 4051 func (a *DomainInterfaceVirtualPortParams) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 4052 start.Name.Local = "parameters" 4053 if a.Any != nil { 4054 return e.EncodeElement(a.Any, start) 4055 } else if a.VEPA8021QBG != nil { 4056 return e.EncodeElement(a.VEPA8021QBG, start) 4057 } else if a.VNTag8011QBH != nil { 4058 return e.EncodeElement(a.VNTag8011QBH, start) 4059 } else if a.OpenVSwitch != nil { 4060 return e.EncodeElement(a.OpenVSwitch, start) 4061 } else if a.MidoNet != nil { 4062 return e.EncodeElement(a.MidoNet, start) 4063 } 4064 return nil 4065 } 4066 4067 func (a *DomainInterfaceVirtualPortParams) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 4068 if a.Any != nil { 4069 return d.DecodeElement(a.Any, &start) 4070 } else if a.VEPA8021QBG != nil { 4071 return d.DecodeElement(a.VEPA8021QBG, &start) 4072 } else if a.VNTag8011QBH != nil { 4073 return d.DecodeElement(a.VNTag8011QBH, &start) 4074 } else if a.OpenVSwitch != nil { 4075 return d.DecodeElement(a.OpenVSwitch, &start) 4076 } else if a.MidoNet != nil { 4077 return d.DecodeElement(a.MidoNet, &start) 4078 } 4079 return nil 4080 } 4081 4082 type domainInterfaceVirtualPort DomainInterfaceVirtualPort 4083 4084 func (a *DomainInterfaceVirtualPort) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 4085 start.Name.Local = "virtualport" 4086 if a.Params != nil { 4087 if a.Params.Any != nil { 4088 /* no type attr wanted */ 4089 } else if a.Params.VEPA8021QBG != nil { 4090 start.Attr = append(start.Attr, xml.Attr{ 4091 xml.Name{Local: "type"}, "802.1Qbg", 4092 }) 4093 } else if a.Params.VNTag8011QBH != nil { 4094 start.Attr = append(start.Attr, xml.Attr{ 4095 xml.Name{Local: "type"}, "802.1Qbh", 4096 }) 4097 } else if a.Params.OpenVSwitch != nil { 4098 start.Attr = append(start.Attr, xml.Attr{ 4099 xml.Name{Local: "type"}, "openvswitch", 4100 }) 4101 } else if a.Params.MidoNet != nil { 4102 start.Attr = append(start.Attr, xml.Attr{ 4103 xml.Name{Local: "type"}, "midonet", 4104 }) 4105 } 4106 } 4107 vp := domainInterfaceVirtualPort(*a) 4108 return e.EncodeElement(&vp, start) 4109 } 4110 4111 func (a *DomainInterfaceVirtualPort) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 4112 typ, ok := getAttr(start.Attr, "type") 4113 a.Params = &DomainInterfaceVirtualPortParams{} 4114 if !ok { 4115 var any DomainInterfaceVirtualPortParamsAny 4116 a.Params.Any = &any 4117 } else if typ == "802.1Qbg" { 4118 var vepa DomainInterfaceVirtualPortParamsVEPA8021QBG 4119 a.Params.VEPA8021QBG = &vepa 4120 } else if typ == "802.1Qbh" { 4121 var vntag DomainInterfaceVirtualPortParamsVNTag8021QBH 4122 a.Params.VNTag8011QBH = &vntag 4123 } else if typ == "openvswitch" { 4124 var ovs DomainInterfaceVirtualPortParamsOpenVSwitch 4125 a.Params.OpenVSwitch = &ovs 4126 } else if typ == "midonet" { 4127 var mido DomainInterfaceVirtualPortParamsMidoNet 4128 a.Params.MidoNet = &mido 4129 } 4130 4131 vp := domainInterfaceVirtualPort(*a) 4132 err := d.DecodeElement(&vp, &start) 4133 if err != nil { 4134 return err 4135 } 4136 *a = DomainInterfaceVirtualPort(vp) 4137 return nil 4138 } 4139 4140 func (a *DomainInterfaceSourceHostdev) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 4141 e.EncodeToken(start) 4142 if a.PCI != nil { 4143 addr := xml.StartElement{ 4144 Name: xml.Name{Local: "address"}, 4145 } 4146 addr.Attr = append(addr.Attr, xml.Attr{ 4147 xml.Name{Local: "type"}, "pci", 4148 }) 4149 e.EncodeElement(a.PCI.Address, addr) 4150 } else if a.USB != nil { 4151 addr := xml.StartElement{ 4152 Name: xml.Name{Local: "address"}, 4153 } 4154 addr.Attr = append(addr.Attr, xml.Attr{ 4155 xml.Name{Local: "type"}, "usb", 4156 }) 4157 e.EncodeElement(a.USB.Address, addr) 4158 } 4159 e.EncodeToken(start.End()) 4160 return nil 4161 } 4162 4163 func (a *DomainInterfaceSourceHostdev) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 4164 for { 4165 tok, err := d.Token() 4166 if err != nil { 4167 if err == io.EOF { 4168 break 4169 } 4170 return err 4171 } 4172 4173 switch tok := tok.(type) { 4174 case xml.StartElement: 4175 if tok.Name.Local == "address" { 4176 typ, ok := getAttr(tok.Attr, "type") 4177 if !ok { 4178 return fmt.Errorf("Missing hostdev address type attribute") 4179 } 4180 4181 if typ == "pci" { 4182 a.PCI = &DomainHostdevSubsysPCISource{ 4183 "", 4184 &DomainAddressPCI{}, 4185 } 4186 err := d.DecodeElement(a.PCI.Address, &tok) 4187 if err != nil { 4188 return err 4189 } 4190 } else if typ == "usb" { 4191 a.USB = &DomainHostdevSubsysUSBSource{ 4192 "", 4193 &DomainAddressUSB{}, 4194 } 4195 err := d.DecodeElement(a.USB, &tok) 4196 if err != nil { 4197 return err 4198 } 4199 } 4200 } 4201 } 4202 } 4203 d.Skip() 4204 return nil 4205 } 4206 4207 func (a *DomainInterfaceSource) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 4208 if a.User != nil { 4209 if a.User.Dev != "" { 4210 return e.EncodeElement(a.User, start) 4211 } else { 4212 return nil 4213 } 4214 } else if a.Ethernet != nil { 4215 if len(a.Ethernet.IP) > 0 && len(a.Ethernet.Route) > 0 { 4216 return e.EncodeElement(a.Ethernet, start) 4217 } 4218 return nil 4219 } else if a.VHostUser != nil { 4220 typ := getChardevSourceType(a.VHostUser) 4221 if typ != "" { 4222 start.Attr = append(start.Attr, xml.Attr{ 4223 xml.Name{Local: "type"}, typ, 4224 }) 4225 } 4226 return e.EncodeElement(a.VHostUser, start) 4227 } else if a.Server != nil { 4228 return e.EncodeElement(a.Server, start) 4229 } else if a.Client != nil { 4230 return e.EncodeElement(a.Client, start) 4231 } else if a.MCast != nil { 4232 return e.EncodeElement(a.MCast, start) 4233 } else if a.Network != nil { 4234 return e.EncodeElement(a.Network, start) 4235 } else if a.Bridge != nil { 4236 return e.EncodeElement(a.Bridge, start) 4237 } else if a.Internal != nil { 4238 return e.EncodeElement(a.Internal, start) 4239 } else if a.Direct != nil { 4240 return e.EncodeElement(a.Direct, start) 4241 } else if a.Hostdev != nil { 4242 return e.EncodeElement(a.Hostdev, start) 4243 } else if a.UDP != nil { 4244 return e.EncodeElement(a.UDP, start) 4245 } else if a.VDPA != nil { 4246 return e.EncodeElement(a.VDPA, start) 4247 } else if a.Null != nil { 4248 return e.EncodeElement(a.Null, start) 4249 } else if a.VDS != nil { 4250 return e.EncodeElement(a.VDS, start) 4251 } 4252 return nil 4253 } 4254 4255 func (a *DomainInterfaceSource) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 4256 if a.User != nil { 4257 return d.DecodeElement(a.User, &start) 4258 } else if a.Ethernet != nil { 4259 return d.DecodeElement(a.Ethernet, &start) 4260 } else if a.VHostUser != nil { 4261 typ, ok := getAttr(start.Attr, "type") 4262 if !ok { 4263 typ = "pty" 4264 } 4265 a.VHostUser = createChardevSource(typ) 4266 return d.DecodeElement(a.VHostUser, &start) 4267 } else if a.Server != nil { 4268 return d.DecodeElement(a.Server, &start) 4269 } else if a.Client != nil { 4270 return d.DecodeElement(a.Client, &start) 4271 } else if a.MCast != nil { 4272 return d.DecodeElement(a.MCast, &start) 4273 } else if a.Network != nil { 4274 return d.DecodeElement(a.Network, &start) 4275 } else if a.Bridge != nil { 4276 return d.DecodeElement(a.Bridge, &start) 4277 } else if a.Internal != nil { 4278 return d.DecodeElement(a.Internal, &start) 4279 } else if a.Direct != nil { 4280 return d.DecodeElement(a.Direct, &start) 4281 } else if a.Hostdev != nil { 4282 return d.DecodeElement(a.Hostdev, &start) 4283 } else if a.UDP != nil { 4284 return d.DecodeElement(a.UDP, &start) 4285 } else if a.VDPA != nil { 4286 return d.DecodeElement(a.VDPA, &start) 4287 } else if a.Null != nil { 4288 return d.DecodeElement(a.Null, &start) 4289 } else if a.VDS != nil { 4290 return d.DecodeElement(a.VDS, &start) 4291 } 4292 return nil 4293 } 4294 4295 type domainInterface DomainInterface 4296 4297 func (a *DomainInterface) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 4298 start.Name.Local = "interface" 4299 if a.Source != nil { 4300 if a.Source.User != nil { 4301 start.Attr = append(start.Attr, xml.Attr{ 4302 xml.Name{Local: "type"}, "user", 4303 }) 4304 } else if a.Source.Ethernet != nil { 4305 start.Attr = append(start.Attr, xml.Attr{ 4306 xml.Name{Local: "type"}, "ethernet", 4307 }) 4308 } else if a.Source.VHostUser != nil { 4309 start.Attr = append(start.Attr, xml.Attr{ 4310 xml.Name{Local: "type"}, "vhostuser", 4311 }) 4312 } else if a.Source.Server != nil { 4313 start.Attr = append(start.Attr, xml.Attr{ 4314 xml.Name{Local: "type"}, "server", 4315 }) 4316 } else if a.Source.Client != nil { 4317 start.Attr = append(start.Attr, xml.Attr{ 4318 xml.Name{Local: "type"}, "client", 4319 }) 4320 } else if a.Source.MCast != nil { 4321 start.Attr = append(start.Attr, xml.Attr{ 4322 xml.Name{Local: "type"}, "mcast", 4323 }) 4324 } else if a.Source.Network != nil { 4325 start.Attr = append(start.Attr, xml.Attr{ 4326 xml.Name{Local: "type"}, "network", 4327 }) 4328 } else if a.Source.Bridge != nil { 4329 start.Attr = append(start.Attr, xml.Attr{ 4330 xml.Name{Local: "type"}, "bridge", 4331 }) 4332 } else if a.Source.Internal != nil { 4333 start.Attr = append(start.Attr, xml.Attr{ 4334 xml.Name{Local: "type"}, "internal", 4335 }) 4336 } else if a.Source.Direct != nil { 4337 start.Attr = append(start.Attr, xml.Attr{ 4338 xml.Name{Local: "type"}, "direct", 4339 }) 4340 } else if a.Source.Hostdev != nil { 4341 start.Attr = append(start.Attr, xml.Attr{ 4342 xml.Name{Local: "type"}, "hostdev", 4343 }) 4344 } else if a.Source.UDP != nil { 4345 start.Attr = append(start.Attr, xml.Attr{ 4346 xml.Name{Local: "type"}, "udp", 4347 }) 4348 } else if a.Source.VDPA != nil { 4349 start.Attr = append(start.Attr, xml.Attr{ 4350 xml.Name{Local: "type"}, "vdpa", 4351 }) 4352 } else if a.Source.Null != nil { 4353 start.Attr = append(start.Attr, xml.Attr{ 4354 xml.Name{Local: "type"}, "null", 4355 }) 4356 } else if a.Source.VDS != nil { 4357 start.Attr = append(start.Attr, xml.Attr{ 4358 xml.Name{Local: "type"}, "vds", 4359 }) 4360 } 4361 } 4362 fs := domainInterface(*a) 4363 return e.EncodeElement(fs, start) 4364 } 4365 4366 func (a *DomainInterface) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 4367 typ, ok := getAttr(start.Attr, "type") 4368 if !ok { 4369 return fmt.Errorf("Missing interface type attribute") 4370 } 4371 a.Source = &DomainInterfaceSource{} 4372 if typ == "user" { 4373 a.Source.User = &DomainInterfaceSourceUser{} 4374 } else if typ == "ethernet" { 4375 a.Source.Ethernet = &DomainInterfaceSourceEthernet{} 4376 } else if typ == "vhostuser" { 4377 a.Source.VHostUser = &DomainChardevSource{} 4378 } else if typ == "server" { 4379 a.Source.Server = &DomainInterfaceSourceServer{} 4380 } else if typ == "client" { 4381 a.Source.Client = &DomainInterfaceSourceClient{} 4382 } else if typ == "mcast" { 4383 a.Source.MCast = &DomainInterfaceSourceMCast{} 4384 } else if typ == "network" { 4385 a.Source.Network = &DomainInterfaceSourceNetwork{} 4386 } else if typ == "bridge" { 4387 a.Source.Bridge = &DomainInterfaceSourceBridge{} 4388 } else if typ == "internal" { 4389 a.Source.Internal = &DomainInterfaceSourceInternal{} 4390 } else if typ == "direct" { 4391 a.Source.Direct = &DomainInterfaceSourceDirect{} 4392 } else if typ == "hostdev" { 4393 a.Source.Hostdev = &DomainInterfaceSourceHostdev{} 4394 } else if typ == "udp" { 4395 a.Source.UDP = &DomainInterfaceSourceUDP{} 4396 } else if typ == "vdpa" { 4397 a.Source.VDPA = &DomainInterfaceSourceVDPA{} 4398 } else if typ == "null" { 4399 a.Source.Null = &DomainInterfaceSourceNull{} 4400 } else if typ == "vds" { 4401 a.Source.VDS = &DomainInterfaceSourceVDS{} 4402 } 4403 fs := domainInterface(*a) 4404 err := d.DecodeElement(&fs, &start) 4405 if err != nil { 4406 return err 4407 } 4408 *a = DomainInterface(fs) 4409 return nil 4410 } 4411 4412 func (d *DomainInterface) Unmarshal(doc string) error { 4413 return xml.Unmarshal([]byte(doc), d) 4414 } 4415 4416 func (d *DomainInterface) Marshal() (string, error) { 4417 doc, err := xml.MarshalIndent(d, "", " ") 4418 if err != nil { 4419 return "", err 4420 } 4421 return string(doc), nil 4422 } 4423 4424 type domainSmartcard DomainSmartcard 4425 4426 func (a *DomainSmartcard) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 4427 start.Name.Local = "smartcard" 4428 if a.Passthrough != nil { 4429 start.Attr = append(start.Attr, xml.Attr{ 4430 xml.Name{Local: "mode"}, "passthrough", 4431 }) 4432 typ := getChardevSourceType(a.Passthrough) 4433 if typ != "" { 4434 start.Attr = append(start.Attr, xml.Attr{ 4435 xml.Name{Local: "type"}, typ, 4436 }) 4437 } 4438 } else if a.Host != nil { 4439 start.Attr = append(start.Attr, xml.Attr{ 4440 xml.Name{Local: "mode"}, "host", 4441 }) 4442 } else if len(a.HostCerts) != 0 { 4443 start.Attr = append(start.Attr, xml.Attr{ 4444 xml.Name{Local: "mode"}, "host-certificates", 4445 }) 4446 } 4447 smartcard := domainSmartcard(*a) 4448 return e.EncodeElement(smartcard, start) 4449 } 4450 4451 func (a *DomainSmartcard) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 4452 mode, ok := getAttr(start.Attr, "mode") 4453 if !ok { 4454 return fmt.Errorf("Missing mode on smartcard device") 4455 } 4456 if mode == "host" { 4457 a.Host = &DomainSmartcardHost{} 4458 } else if mode == "passthrough" { 4459 typ, ok := getAttr(start.Attr, "type") 4460 if !ok { 4461 typ = "pty" 4462 } 4463 a.Passthrough = createChardevSource(typ) 4464 } 4465 smartcard := domainSmartcard(*a) 4466 err := d.DecodeElement(&smartcard, &start) 4467 if err != nil { 4468 return err 4469 } 4470 *a = DomainSmartcard(smartcard) 4471 return nil 4472 } 4473 4474 func (d *DomainSmartcard) Unmarshal(doc string) error { 4475 return xml.Unmarshal([]byte(doc), d) 4476 } 4477 4478 func (d *DomainSmartcard) Marshal() (string, error) { 4479 doc, err := xml.MarshalIndent(d, "", " ") 4480 if err != nil { 4481 return "", err 4482 } 4483 return string(doc), nil 4484 } 4485 4486 func (a *DomainTPMBackendExternalSource) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 4487 start.Name.Local = "source" 4488 src := DomainChardevSource(*a) 4489 typ := getChardevSourceType(&src) 4490 if typ != "" { 4491 start.Attr = append(start.Attr, xml.Attr{ 4492 xml.Name{Local: "type"}, typ, 4493 }) 4494 } 4495 return e.EncodeElement(&src, start) 4496 } 4497 4498 func (a *DomainTPMBackendExternalSource) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 4499 typ, ok := getAttr(start.Attr, "type") 4500 if !ok { 4501 typ = "unix" 4502 } 4503 src := createChardevSource(typ) 4504 err := d.DecodeElement(&src, &start) 4505 if err != nil { 4506 return err 4507 } 4508 *a = DomainTPMBackendExternalSource(*src) 4509 return nil 4510 } 4511 4512 func (a *DomainTPMBackend) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 4513 start.Name.Local = "backend" 4514 if a.Passthrough != nil { 4515 start.Attr = append(start.Attr, xml.Attr{ 4516 xml.Name{Local: "type"}, "passthrough", 4517 }) 4518 err := e.EncodeElement(a.Passthrough, start) 4519 if err != nil { 4520 return err 4521 } 4522 } else if a.Emulator != nil { 4523 start.Attr = append(start.Attr, xml.Attr{ 4524 xml.Name{Local: "type"}, "emulator", 4525 }) 4526 err := e.EncodeElement(a.Emulator, start) 4527 if err != nil { 4528 return err 4529 } 4530 } else if a.External != nil { 4531 start.Attr = append(start.Attr, xml.Attr{ 4532 xml.Name{Local: "type"}, "external", 4533 }) 4534 err := e.EncodeElement(a.External, start) 4535 if err != nil { 4536 return err 4537 } 4538 } 4539 return nil 4540 } 4541 4542 func (a *DomainTPMBackend) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 4543 typ, ok := getAttr(start.Attr, "type") 4544 if !ok { 4545 return fmt.Errorf("Missing TPM backend type") 4546 } 4547 if typ == "passthrough" { 4548 a.Passthrough = &DomainTPMBackendPassthrough{} 4549 err := d.DecodeElement(a.Passthrough, &start) 4550 if err != nil { 4551 return err 4552 } 4553 } else if typ == "emulator" { 4554 a.Emulator = &DomainTPMBackendEmulator{} 4555 err := d.DecodeElement(a.Emulator, &start) 4556 if err != nil { 4557 return err 4558 } 4559 } else if typ == "external" { 4560 a.External = &DomainTPMBackendExternal{} 4561 err := d.DecodeElement(a.External, &start) 4562 if err != nil { 4563 return err 4564 } 4565 } else { 4566 d.Skip() 4567 } 4568 return nil 4569 } 4570 4571 func (d *DomainTPM) Unmarshal(doc string) error { 4572 return xml.Unmarshal([]byte(doc), d) 4573 } 4574 4575 func (d *DomainTPM) Marshal() (string, error) { 4576 doc, err := xml.MarshalIndent(d, "", " ") 4577 if err != nil { 4578 return "", err 4579 } 4580 return string(doc), nil 4581 } 4582 4583 func (d *DomainShmem) Unmarshal(doc string) error { 4584 return xml.Unmarshal([]byte(doc), d) 4585 } 4586 4587 func (d *DomainShmem) Marshal() (string, error) { 4588 doc, err := xml.MarshalIndent(d, "", " ") 4589 if err != nil { 4590 return "", err 4591 } 4592 return string(doc), nil 4593 } 4594 4595 func getChardevSourceType(s *DomainChardevSource) string { 4596 if s.Null != nil { 4597 return "null" 4598 } else if s.VC != nil { 4599 return "vc" 4600 } else if s.Pty != nil { 4601 return "pty" 4602 } else if s.Dev != nil { 4603 return "dev" 4604 } else if s.File != nil { 4605 return "file" 4606 } else if s.Pipe != nil { 4607 return "pipe" 4608 } else if s.StdIO != nil { 4609 return "stdio" 4610 } else if s.UDP != nil { 4611 return "udp" 4612 } else if s.TCP != nil { 4613 return "tcp" 4614 } else if s.UNIX != nil { 4615 return "unix" 4616 } else if s.SpiceVMC != nil { 4617 return "spicevmc" 4618 } else if s.SpicePort != nil { 4619 return "spiceport" 4620 } else if s.NMDM != nil { 4621 return "nmdm" 4622 } else if s.QEMUVDAgent != nil { 4623 return "qemu-vdagent" 4624 } else if s.DBus != nil { 4625 return "dbus" 4626 } 4627 return "" 4628 } 4629 4630 func createChardevSource(typ string) *DomainChardevSource { 4631 switch typ { 4632 case "null": 4633 return &DomainChardevSource{ 4634 Null: &DomainChardevSourceNull{}, 4635 } 4636 case "vc": 4637 return &DomainChardevSource{ 4638 VC: &DomainChardevSourceVC{}, 4639 } 4640 case "pty": 4641 return &DomainChardevSource{ 4642 Pty: &DomainChardevSourcePty{}, 4643 } 4644 case "dev": 4645 return &DomainChardevSource{ 4646 Dev: &DomainChardevSourceDev{}, 4647 } 4648 case "file": 4649 return &DomainChardevSource{ 4650 File: &DomainChardevSourceFile{}, 4651 } 4652 case "pipe": 4653 return &DomainChardevSource{ 4654 Pipe: &DomainChardevSourcePipe{}, 4655 } 4656 case "stdio": 4657 return &DomainChardevSource{ 4658 StdIO: &DomainChardevSourceStdIO{}, 4659 } 4660 case "udp": 4661 return &DomainChardevSource{ 4662 UDP: &DomainChardevSourceUDP{}, 4663 } 4664 case "tcp": 4665 return &DomainChardevSource{ 4666 TCP: &DomainChardevSourceTCP{}, 4667 } 4668 case "unix": 4669 return &DomainChardevSource{ 4670 UNIX: &DomainChardevSourceUNIX{}, 4671 } 4672 case "spicevmc": 4673 return &DomainChardevSource{ 4674 SpiceVMC: &DomainChardevSourceSpiceVMC{}, 4675 } 4676 case "spiceport": 4677 return &DomainChardevSource{ 4678 SpicePort: &DomainChardevSourceSpicePort{}, 4679 } 4680 case "nmdm": 4681 return &DomainChardevSource{ 4682 NMDM: &DomainChardevSourceNMDM{}, 4683 } 4684 case "qemu-vdagent": 4685 return &DomainChardevSource{ 4686 QEMUVDAgent: &DomainChardevSourceQEMUVDAgent{}, 4687 } 4688 case "dbus": 4689 return &DomainChardevSource{ 4690 DBus: &DomainChardevSourceDBus{}, 4691 } 4692 } 4693 4694 return nil 4695 } 4696 4697 type domainChardevSourceUDPFlat struct { 4698 Mode string `xml:"mode,attr"` 4699 Host string `xml:"host,attr,omitempty"` 4700 Service string `xml:"service,attr,omitempty"` 4701 } 4702 4703 func (a *DomainChardevSource) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 4704 if a.Null != nil { 4705 return nil 4706 } else if a.VC != nil { 4707 return nil 4708 } else if a.Pty != nil { 4709 if a.Pty.Path != "" { 4710 return e.EncodeElement(a.Pty, start) 4711 } 4712 return nil 4713 } else if a.Dev != nil { 4714 return e.EncodeElement(a.Dev, start) 4715 } else if a.File != nil { 4716 return e.EncodeElement(a.File, start) 4717 } else if a.Pipe != nil { 4718 return e.EncodeElement(a.Pipe, start) 4719 } else if a.StdIO != nil { 4720 return nil 4721 } else if a.UDP != nil { 4722 srcs := []domainChardevSourceUDPFlat{ 4723 domainChardevSourceUDPFlat{ 4724 Mode: "bind", 4725 Host: a.UDP.BindHost, 4726 Service: a.UDP.BindService, 4727 }, 4728 domainChardevSourceUDPFlat{ 4729 Mode: "connect", 4730 Host: a.UDP.ConnectHost, 4731 Service: a.UDP.ConnectService, 4732 }, 4733 } 4734 if srcs[0].Host != "" || srcs[0].Service != "" { 4735 err := e.EncodeElement(&srcs[0], start) 4736 if err != nil { 4737 return err 4738 } 4739 } 4740 if srcs[1].Host != "" || srcs[1].Service != "" { 4741 err := e.EncodeElement(&srcs[1], start) 4742 if err != nil { 4743 return err 4744 } 4745 } 4746 } else if a.TCP != nil { 4747 return e.EncodeElement(a.TCP, start) 4748 } else if a.UNIX != nil { 4749 if a.UNIX.Path == "" && a.UNIX.Mode == "" { 4750 return nil 4751 } 4752 return e.EncodeElement(a.UNIX, start) 4753 } else if a.SpiceVMC != nil { 4754 return nil 4755 } else if a.SpicePort != nil { 4756 return e.EncodeElement(a.SpicePort, start) 4757 } else if a.NMDM != nil { 4758 return e.EncodeElement(a.NMDM, start) 4759 } else if a.QEMUVDAgent != nil { 4760 return e.EncodeElement(a.QEMUVDAgent, start) 4761 } else if a.DBus != nil { 4762 return e.EncodeElement(a.DBus, start) 4763 } 4764 return nil 4765 } 4766 4767 func (a *DomainChardevSource) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 4768 if a.Null != nil { 4769 d.Skip() 4770 return nil 4771 } else if a.VC != nil { 4772 d.Skip() 4773 return nil 4774 } else if a.Pty != nil { 4775 return d.DecodeElement(a.Pty, &start) 4776 } else if a.Dev != nil { 4777 return d.DecodeElement(a.Dev, &start) 4778 } else if a.File != nil { 4779 return d.DecodeElement(a.File, &start) 4780 } else if a.Pipe != nil { 4781 return d.DecodeElement(a.Pipe, &start) 4782 } else if a.StdIO != nil { 4783 d.Skip() 4784 return nil 4785 } else if a.UDP != nil { 4786 src := domainChardevSourceUDPFlat{} 4787 err := d.DecodeElement(&src, &start) 4788 if src.Mode == "connect" { 4789 a.UDP.ConnectHost = src.Host 4790 a.UDP.ConnectService = src.Service 4791 } else { 4792 a.UDP.BindHost = src.Host 4793 a.UDP.BindService = src.Service 4794 } 4795 return err 4796 } else if a.TCP != nil { 4797 return d.DecodeElement(a.TCP, &start) 4798 } else if a.UNIX != nil { 4799 return d.DecodeElement(a.UNIX, &start) 4800 } else if a.SpiceVMC != nil { 4801 d.Skip() 4802 return nil 4803 } else if a.SpicePort != nil { 4804 return d.DecodeElement(a.SpicePort, &start) 4805 } else if a.NMDM != nil { 4806 return d.DecodeElement(a.NMDM, &start) 4807 } else if a.QEMUVDAgent != nil { 4808 return d.DecodeElement(a.QEMUVDAgent, &start) 4809 } else if a.DBus != nil { 4810 return d.DecodeElement(a.DBus, &start) 4811 } 4812 return nil 4813 } 4814 4815 type domainConsole DomainConsole 4816 4817 func (a *DomainConsole) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 4818 start.Name.Local = "console" 4819 if a.Source != nil { 4820 typ := getChardevSourceType(a.Source) 4821 if typ != "" { 4822 start.Attr = append(start.Attr, xml.Attr{ 4823 xml.Name{Local: "type"}, typ, 4824 }) 4825 } 4826 } 4827 fs := domainConsole(*a) 4828 return e.EncodeElement(fs, start) 4829 } 4830 4831 func (a *DomainConsole) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 4832 typ, ok := getAttr(start.Attr, "type") 4833 if !ok { 4834 typ = "pty" 4835 } 4836 a.Source = createChardevSource(typ) 4837 con := domainConsole(*a) 4838 err := d.DecodeElement(&con, &start) 4839 if err != nil { 4840 return err 4841 } 4842 *a = DomainConsole(con) 4843 return nil 4844 } 4845 4846 func (d *DomainConsole) Unmarshal(doc string) error { 4847 return xml.Unmarshal([]byte(doc), d) 4848 } 4849 4850 func (d *DomainConsole) Marshal() (string, error) { 4851 doc, err := xml.MarshalIndent(d, "", " ") 4852 if err != nil { 4853 return "", err 4854 } 4855 return string(doc), nil 4856 } 4857 4858 type domainSerial DomainSerial 4859 4860 func (a *DomainSerial) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 4861 start.Name.Local = "serial" 4862 if a.Source != nil { 4863 typ := getChardevSourceType(a.Source) 4864 if typ != "" { 4865 start.Attr = append(start.Attr, xml.Attr{ 4866 xml.Name{Local: "type"}, typ, 4867 }) 4868 } 4869 } 4870 s := domainSerial(*a) 4871 return e.EncodeElement(s, start) 4872 } 4873 4874 func (a *DomainSerial) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 4875 typ, ok := getAttr(start.Attr, "type") 4876 if !ok { 4877 typ = "pty" 4878 } 4879 a.Source = createChardevSource(typ) 4880 con := domainSerial(*a) 4881 err := d.DecodeElement(&con, &start) 4882 if err != nil { 4883 return err 4884 } 4885 *a = DomainSerial(con) 4886 return nil 4887 } 4888 4889 func (d *DomainSerial) Unmarshal(doc string) error { 4890 return xml.Unmarshal([]byte(doc), d) 4891 } 4892 4893 func (d *DomainSerial) Marshal() (string, error) { 4894 doc, err := xml.MarshalIndent(d, "", " ") 4895 if err != nil { 4896 return "", err 4897 } 4898 return string(doc), nil 4899 } 4900 4901 type domainParallel DomainParallel 4902 4903 func (a *DomainParallel) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 4904 start.Name.Local = "parallel" 4905 if a.Source != nil { 4906 typ := getChardevSourceType(a.Source) 4907 if typ != "" { 4908 start.Attr = append(start.Attr, xml.Attr{ 4909 xml.Name{Local: "type"}, typ, 4910 }) 4911 } 4912 } 4913 s := domainParallel(*a) 4914 return e.EncodeElement(s, start) 4915 } 4916 4917 func (a *DomainParallel) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 4918 typ, ok := getAttr(start.Attr, "type") 4919 if !ok { 4920 typ = "pty" 4921 } 4922 a.Source = createChardevSource(typ) 4923 con := domainParallel(*a) 4924 err := d.DecodeElement(&con, &start) 4925 if err != nil { 4926 return err 4927 } 4928 *a = DomainParallel(con) 4929 return nil 4930 } 4931 4932 func (d *DomainParallel) Unmarshal(doc string) error { 4933 return xml.Unmarshal([]byte(doc), d) 4934 } 4935 4936 func (d *DomainParallel) Marshal() (string, error) { 4937 doc, err := xml.MarshalIndent(d, "", " ") 4938 if err != nil { 4939 return "", err 4940 } 4941 return string(doc), nil 4942 } 4943 4944 func (d *DomainInput) Unmarshal(doc string) error { 4945 return xml.Unmarshal([]byte(doc), d) 4946 } 4947 4948 func (d *DomainInput) Marshal() (string, error) { 4949 doc, err := xml.MarshalIndent(d, "", " ") 4950 if err != nil { 4951 return "", err 4952 } 4953 return string(doc), nil 4954 } 4955 4956 func (d *DomainVideo) Unmarshal(doc string) error { 4957 return xml.Unmarshal([]byte(doc), d) 4958 } 4959 4960 func (d *DomainVideo) Marshal() (string, error) { 4961 doc, err := xml.MarshalIndent(d, "", " ") 4962 if err != nil { 4963 return "", err 4964 } 4965 return string(doc), nil 4966 } 4967 4968 type domainChannelTarget DomainChannelTarget 4969 4970 func (a *DomainChannelTarget) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 4971 if a.VirtIO != nil { 4972 start.Attr = append(start.Attr, xml.Attr{ 4973 xml.Name{Local: "type"}, "virtio", 4974 }) 4975 return e.EncodeElement(a.VirtIO, start) 4976 } else if a.Xen != nil { 4977 start.Attr = append(start.Attr, xml.Attr{ 4978 xml.Name{Local: "type"}, "xen", 4979 }) 4980 return e.EncodeElement(a.Xen, start) 4981 } else if a.GuestFWD != nil { 4982 start.Attr = append(start.Attr, xml.Attr{ 4983 xml.Name{Local: "type"}, "guestfwd", 4984 }) 4985 return e.EncodeElement(a.GuestFWD, start) 4986 } 4987 return nil 4988 } 4989 4990 func (a *DomainChannelTarget) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 4991 typ, ok := getAttr(start.Attr, "type") 4992 if !ok { 4993 return fmt.Errorf("Missing channel target type") 4994 } 4995 if typ == "virtio" { 4996 a.VirtIO = &DomainChannelTargetVirtIO{} 4997 return d.DecodeElement(a.VirtIO, &start) 4998 } else if typ == "xen" { 4999 a.Xen = &DomainChannelTargetXen{} 5000 return d.DecodeElement(a.Xen, &start) 5001 } else if typ == "guestfwd" { 5002 a.GuestFWD = &DomainChannelTargetGuestFWD{} 5003 return d.DecodeElement(a.GuestFWD, &start) 5004 } 5005 d.Skip() 5006 return nil 5007 } 5008 5009 type domainChannel DomainChannel 5010 5011 func (a *DomainChannel) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 5012 start.Name.Local = "channel" 5013 if a.Source != nil { 5014 typ := getChardevSourceType(a.Source) 5015 if typ != "" { 5016 start.Attr = append(start.Attr, xml.Attr{ 5017 xml.Name{Local: "type"}, typ, 5018 }) 5019 } 5020 } 5021 fs := domainChannel(*a) 5022 return e.EncodeElement(fs, start) 5023 } 5024 5025 func (a *DomainChannel) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 5026 typ, ok := getAttr(start.Attr, "type") 5027 if !ok { 5028 typ = "pty" 5029 } 5030 a.Source = createChardevSource(typ) 5031 con := domainChannel(*a) 5032 err := d.DecodeElement(&con, &start) 5033 if err != nil { 5034 return err 5035 } 5036 *a = DomainChannel(con) 5037 return nil 5038 } 5039 5040 func (d *DomainChannel) Unmarshal(doc string) error { 5041 return xml.Unmarshal([]byte(doc), d) 5042 } 5043 5044 func (d *DomainChannel) Marshal() (string, error) { 5045 doc, err := xml.MarshalIndent(d, "", " ") 5046 if err != nil { 5047 return "", err 5048 } 5049 return string(doc), nil 5050 } 5051 5052 func (a *DomainRedirFilterUSB) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 5053 marshalUintAttr(&start, "class", a.Class, "0x%02x") 5054 marshalUintAttr(&start, "vendor", a.Vendor, "0x%04x") 5055 marshalUintAttr(&start, "product", a.Product, "0x%04x") 5056 if a.Version != "" { 5057 start.Attr = append(start.Attr, xml.Attr{ 5058 xml.Name{Local: "version"}, a.Version, 5059 }) 5060 } 5061 start.Attr = append(start.Attr, xml.Attr{ 5062 xml.Name{Local: "allow"}, a.Allow, 5063 }) 5064 e.EncodeToken(start) 5065 e.EncodeToken(start.End()) 5066 return nil 5067 } 5068 5069 func (a *DomainRedirFilterUSB) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 5070 for _, attr := range start.Attr { 5071 if attr.Name.Local == "class" && attr.Value != "-1" { 5072 if err := unmarshalUintAttr(attr.Value, &a.Class, 0); err != nil { 5073 return err 5074 } 5075 } else if attr.Name.Local == "product" && attr.Value != "-1" { 5076 if err := unmarshalUintAttr(attr.Value, &a.Product, 0); err != nil { 5077 return err 5078 } 5079 } else if attr.Name.Local == "vendor" && attr.Value != "-1" { 5080 if err := unmarshalUintAttr(attr.Value, &a.Vendor, 0); err != nil { 5081 return err 5082 } 5083 } else if attr.Name.Local == "version" && attr.Value != "-1" { 5084 a.Version = attr.Value 5085 } else if attr.Name.Local == "allow" { 5086 a.Allow = attr.Value 5087 } 5088 } 5089 d.Skip() 5090 return nil 5091 } 5092 5093 type domainRedirDev DomainRedirDev 5094 5095 func (a *DomainRedirDev) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 5096 start.Name.Local = "redirdev" 5097 if a.Source != nil { 5098 typ := getChardevSourceType(a.Source) 5099 if typ != "" { 5100 start.Attr = append(start.Attr, xml.Attr{ 5101 xml.Name{Local: "type"}, typ, 5102 }) 5103 } 5104 } 5105 fs := domainRedirDev(*a) 5106 return e.EncodeElement(fs, start) 5107 } 5108 5109 func (a *DomainRedirDev) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 5110 typ, ok := getAttr(start.Attr, "type") 5111 if !ok { 5112 typ = "pty" 5113 } 5114 a.Source = createChardevSource(typ) 5115 con := domainRedirDev(*a) 5116 err := d.DecodeElement(&con, &start) 5117 if err != nil { 5118 return err 5119 } 5120 *a = DomainRedirDev(con) 5121 return nil 5122 } 5123 5124 func (d *DomainRedirDev) Unmarshal(doc string) error { 5125 return xml.Unmarshal([]byte(doc), d) 5126 } 5127 5128 func (d *DomainRedirDev) Marshal() (string, error) { 5129 doc, err := xml.MarshalIndent(d, "", " ") 5130 if err != nil { 5131 return "", err 5132 } 5133 return string(doc), nil 5134 } 5135 5136 func (d *DomainMemBalloon) Unmarshal(doc string) error { 5137 return xml.Unmarshal([]byte(doc), d) 5138 } 5139 5140 func (d *DomainMemBalloon) Marshal() (string, error) { 5141 doc, err := xml.MarshalIndent(d, "", " ") 5142 if err != nil { 5143 return "", err 5144 } 5145 return string(doc), nil 5146 } 5147 5148 func (d *DomainVSock) Unmarshal(doc string) error { 5149 return xml.Unmarshal([]byte(doc), d) 5150 } 5151 5152 func (d *DomainVSock) Marshal() (string, error) { 5153 doc, err := xml.MarshalIndent(d, "", " ") 5154 if err != nil { 5155 return "", err 5156 } 5157 return string(doc), nil 5158 } 5159 5160 func (d *DomainSound) Unmarshal(doc string) error { 5161 return xml.Unmarshal([]byte(doc), d) 5162 } 5163 5164 func (d *DomainSound) Marshal() (string, error) { 5165 doc, err := xml.MarshalIndent(d, "", " ") 5166 if err != nil { 5167 return "", err 5168 } 5169 return string(doc), nil 5170 } 5171 5172 type domainRNGBackendEGD DomainRNGBackendEGD 5173 5174 func (a *DomainRNGBackendEGD) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 5175 start.Name.Local = "backend" 5176 if a.Source != nil { 5177 typ := getChardevSourceType(a.Source) 5178 if typ != "" { 5179 start.Attr = append(start.Attr, xml.Attr{ 5180 xml.Name{Local: "type"}, typ, 5181 }) 5182 } 5183 } 5184 egd := domainRNGBackendEGD(*a) 5185 return e.EncodeElement(egd, start) 5186 } 5187 5188 func (a *DomainRNGBackendEGD) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 5189 typ, ok := getAttr(start.Attr, "type") 5190 if !ok { 5191 typ = "pty" 5192 } 5193 a.Source = createChardevSource(typ) 5194 con := domainRNGBackendEGD(*a) 5195 err := d.DecodeElement(&con, &start) 5196 if err != nil { 5197 return err 5198 } 5199 *a = DomainRNGBackendEGD(con) 5200 return nil 5201 } 5202 5203 func (a *DomainRNGBackend) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 5204 if a.Random != nil { 5205 start.Attr = append(start.Attr, xml.Attr{ 5206 xml.Name{Local: "model"}, "random", 5207 }) 5208 return e.EncodeElement(a.Random, start) 5209 } else if a.EGD != nil { 5210 start.Attr = append(start.Attr, xml.Attr{ 5211 xml.Name{Local: "model"}, "egd", 5212 }) 5213 return e.EncodeElement(a.EGD, start) 5214 } else if a.BuiltIn != nil { 5215 start.Attr = append(start.Attr, xml.Attr{ 5216 xml.Name{Local: "model"}, "builtin", 5217 }) 5218 return e.EncodeElement(a.BuiltIn, start) 5219 } 5220 return nil 5221 } 5222 5223 func (a *DomainRNGBackend) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 5224 model, ok := getAttr(start.Attr, "model") 5225 if !ok { 5226 return nil 5227 } 5228 if model == "random" { 5229 a.Random = &DomainRNGBackendRandom{} 5230 err := d.DecodeElement(a.Random, &start) 5231 if err != nil { 5232 return err 5233 } 5234 } else if model == "egd" { 5235 a.EGD = &DomainRNGBackendEGD{} 5236 err := d.DecodeElement(a.EGD, &start) 5237 if err != nil { 5238 return err 5239 } 5240 } else if model == "builtin" { 5241 a.BuiltIn = &DomainRNGBackendBuiltIn{} 5242 err := d.DecodeElement(a.BuiltIn, &start) 5243 if err != nil { 5244 return err 5245 } 5246 } 5247 d.Skip() 5248 return nil 5249 } 5250 5251 func (d *DomainRNG) Unmarshal(doc string) error { 5252 return xml.Unmarshal([]byte(doc), d) 5253 } 5254 5255 func (d *DomainRNG) Marshal() (string, error) { 5256 doc, err := xml.MarshalIndent(d, "", " ") 5257 if err != nil { 5258 return "", err 5259 } 5260 return string(doc), nil 5261 } 5262 5263 func (a *DomainHostdevSubsysSCSISource) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 5264 if a.Host != nil { 5265 return e.EncodeElement(a.Host, start) 5266 } else if a.ISCSI != nil { 5267 start.Attr = append(start.Attr, xml.Attr{ 5268 xml.Name{Local: "protocol"}, "iscsi", 5269 }) 5270 return e.EncodeElement(a.ISCSI, start) 5271 } 5272 return nil 5273 } 5274 5275 func (a *DomainHostdevSubsysSCSISource) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 5276 proto, ok := getAttr(start.Attr, "protocol") 5277 if !ok { 5278 a.Host = &DomainHostdevSubsysSCSISourceHost{} 5279 err := d.DecodeElement(a.Host, &start) 5280 if err != nil { 5281 return err 5282 } 5283 } 5284 if proto == "iscsi" { 5285 a.ISCSI = &DomainHostdevSubsysSCSISourceISCSI{} 5286 err := d.DecodeElement(a.ISCSI, &start) 5287 if err != nil { 5288 return err 5289 } 5290 } 5291 d.Skip() 5292 return nil 5293 } 5294 5295 type domainHostdev DomainHostdev 5296 5297 type domainHostdevSubsysSCSI struct { 5298 DomainHostdevSubsysSCSI 5299 domainHostdev 5300 } 5301 5302 type domainHostdevSubsysSCSIHost struct { 5303 DomainHostdevSubsysSCSIHost 5304 domainHostdev 5305 } 5306 5307 type domainHostdevSubsysUSB struct { 5308 DomainHostdevSubsysUSB 5309 domainHostdev 5310 } 5311 5312 type domainHostdevSubsysPCI struct { 5313 DomainHostdevSubsysPCI 5314 domainHostdev 5315 } 5316 5317 type domainHostdevSubsysMDev struct { 5318 DomainHostdevSubsysMDev 5319 domainHostdev 5320 } 5321 5322 type domainHostdevCapsStorage struct { 5323 DomainHostdevCapsStorage 5324 domainHostdev 5325 } 5326 5327 type domainHostdevCapsMisc struct { 5328 DomainHostdevCapsMisc 5329 domainHostdev 5330 } 5331 5332 type domainHostdevCapsNet struct { 5333 DomainHostdevCapsNet 5334 domainHostdev 5335 } 5336 5337 func (a *DomainHostdev) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 5338 start.Name.Local = "hostdev" 5339 if a.SubsysSCSI != nil { 5340 start.Attr = append(start.Attr, xml.Attr{ 5341 xml.Name{Local: "mode"}, "subsystem", 5342 }) 5343 start.Attr = append(start.Attr, xml.Attr{ 5344 xml.Name{Local: "type"}, "scsi", 5345 }) 5346 scsi := domainHostdevSubsysSCSI{} 5347 scsi.domainHostdev = domainHostdev(*a) 5348 scsi.DomainHostdevSubsysSCSI = *a.SubsysSCSI 5349 return e.EncodeElement(scsi, start) 5350 } else if a.SubsysSCSIHost != nil { 5351 start.Attr = append(start.Attr, xml.Attr{ 5352 xml.Name{Local: "mode"}, "subsystem", 5353 }) 5354 start.Attr = append(start.Attr, xml.Attr{ 5355 xml.Name{Local: "type"}, "scsi_host", 5356 }) 5357 scsi_host := domainHostdevSubsysSCSIHost{} 5358 scsi_host.domainHostdev = domainHostdev(*a) 5359 scsi_host.DomainHostdevSubsysSCSIHost = *a.SubsysSCSIHost 5360 return e.EncodeElement(scsi_host, start) 5361 } else if a.SubsysUSB != nil { 5362 start.Attr = append(start.Attr, xml.Attr{ 5363 xml.Name{Local: "mode"}, "subsystem", 5364 }) 5365 start.Attr = append(start.Attr, xml.Attr{ 5366 xml.Name{Local: "type"}, "usb", 5367 }) 5368 usb := domainHostdevSubsysUSB{} 5369 usb.domainHostdev = domainHostdev(*a) 5370 usb.DomainHostdevSubsysUSB = *a.SubsysUSB 5371 return e.EncodeElement(usb, start) 5372 } else if a.SubsysPCI != nil { 5373 start.Attr = append(start.Attr, xml.Attr{ 5374 xml.Name{Local: "mode"}, "subsystem", 5375 }) 5376 start.Attr = append(start.Attr, xml.Attr{ 5377 xml.Name{Local: "type"}, "pci", 5378 }) 5379 pci := domainHostdevSubsysPCI{} 5380 pci.domainHostdev = domainHostdev(*a) 5381 pci.DomainHostdevSubsysPCI = *a.SubsysPCI 5382 return e.EncodeElement(pci, start) 5383 } else if a.SubsysMDev != nil { 5384 start.Attr = append(start.Attr, xml.Attr{ 5385 xml.Name{Local: "mode"}, "subsystem", 5386 }) 5387 start.Attr = append(start.Attr, xml.Attr{ 5388 xml.Name{Local: "type"}, "mdev", 5389 }) 5390 mdev := domainHostdevSubsysMDev{} 5391 mdev.domainHostdev = domainHostdev(*a) 5392 mdev.DomainHostdevSubsysMDev = *a.SubsysMDev 5393 return e.EncodeElement(mdev, start) 5394 } else if a.CapsStorage != nil { 5395 start.Attr = append(start.Attr, xml.Attr{ 5396 xml.Name{Local: "mode"}, "capabilities", 5397 }) 5398 start.Attr = append(start.Attr, xml.Attr{ 5399 xml.Name{Local: "type"}, "storage", 5400 }) 5401 storage := domainHostdevCapsStorage{} 5402 storage.domainHostdev = domainHostdev(*a) 5403 storage.DomainHostdevCapsStorage = *a.CapsStorage 5404 return e.EncodeElement(storage, start) 5405 } else if a.CapsMisc != nil { 5406 start.Attr = append(start.Attr, xml.Attr{ 5407 xml.Name{Local: "mode"}, "capabilities", 5408 }) 5409 start.Attr = append(start.Attr, xml.Attr{ 5410 xml.Name{Local: "type"}, "misc", 5411 }) 5412 misc := domainHostdevCapsMisc{} 5413 misc.domainHostdev = domainHostdev(*a) 5414 misc.DomainHostdevCapsMisc = *a.CapsMisc 5415 return e.EncodeElement(misc, start) 5416 } else if a.CapsNet != nil { 5417 start.Attr = append(start.Attr, xml.Attr{ 5418 xml.Name{Local: "mode"}, "capabilities", 5419 }) 5420 start.Attr = append(start.Attr, xml.Attr{ 5421 xml.Name{Local: "type"}, "net", 5422 }) 5423 net := domainHostdevCapsNet{} 5424 net.domainHostdev = domainHostdev(*a) 5425 net.DomainHostdevCapsNet = *a.CapsNet 5426 return e.EncodeElement(net, start) 5427 } else { 5428 gen := domainHostdev(*a) 5429 return e.EncodeElement(gen, start) 5430 } 5431 } 5432 5433 func (a *DomainHostdev) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 5434 mode, ok := getAttr(start.Attr, "mode") 5435 if !ok { 5436 return fmt.Errorf("Missing 'mode' attribute on domain hostdev") 5437 } 5438 typ, ok := getAttr(start.Attr, "type") 5439 if !ok { 5440 return fmt.Errorf("Missing 'type' attribute on domain controller") 5441 } 5442 if mode == "subsystem" { 5443 if typ == "scsi" { 5444 var scsi domainHostdevSubsysSCSI 5445 err := d.DecodeElement(&scsi, &start) 5446 if err != nil { 5447 return err 5448 } 5449 *a = DomainHostdev(scsi.domainHostdev) 5450 a.SubsysSCSI = &scsi.DomainHostdevSubsysSCSI 5451 return nil 5452 } else if typ == "scsi_host" { 5453 var scsi_host domainHostdevSubsysSCSIHost 5454 err := d.DecodeElement(&scsi_host, &start) 5455 if err != nil { 5456 return err 5457 } 5458 *a = DomainHostdev(scsi_host.domainHostdev) 5459 a.SubsysSCSIHost = &scsi_host.DomainHostdevSubsysSCSIHost 5460 return nil 5461 } else if typ == "usb" { 5462 var usb domainHostdevSubsysUSB 5463 err := d.DecodeElement(&usb, &start) 5464 if err != nil { 5465 return err 5466 } 5467 *a = DomainHostdev(usb.domainHostdev) 5468 a.SubsysUSB = &usb.DomainHostdevSubsysUSB 5469 return nil 5470 } else if typ == "pci" { 5471 var pci domainHostdevSubsysPCI 5472 err := d.DecodeElement(&pci, &start) 5473 if err != nil { 5474 return err 5475 } 5476 *a = DomainHostdev(pci.domainHostdev) 5477 a.SubsysPCI = &pci.DomainHostdevSubsysPCI 5478 return nil 5479 } else if typ == "mdev" { 5480 var mdev domainHostdevSubsysMDev 5481 err := d.DecodeElement(&mdev, &start) 5482 if err != nil { 5483 return err 5484 } 5485 *a = DomainHostdev(mdev.domainHostdev) 5486 a.SubsysMDev = &mdev.DomainHostdevSubsysMDev 5487 return nil 5488 } 5489 } else if mode == "capabilities" { 5490 if typ == "storage" { 5491 var storage domainHostdevCapsStorage 5492 err := d.DecodeElement(&storage, &start) 5493 if err != nil { 5494 return err 5495 } 5496 *a = DomainHostdev(storage.domainHostdev) 5497 a.CapsStorage = &storage.DomainHostdevCapsStorage 5498 return nil 5499 } else if typ == "misc" { 5500 var misc domainHostdevCapsMisc 5501 err := d.DecodeElement(&misc, &start) 5502 if err != nil { 5503 return err 5504 } 5505 *a = DomainHostdev(misc.domainHostdev) 5506 a.CapsMisc = &misc.DomainHostdevCapsMisc 5507 return nil 5508 } else if typ == "net" { 5509 var net domainHostdevCapsNet 5510 err := d.DecodeElement(&net, &start) 5511 if err != nil { 5512 return err 5513 } 5514 *a = DomainHostdev(net.domainHostdev) 5515 a.CapsNet = &net.DomainHostdevCapsNet 5516 return nil 5517 } 5518 } 5519 var gen domainHostdev 5520 err := d.DecodeElement(&gen, &start) 5521 if err != nil { 5522 return err 5523 } 5524 *a = DomainHostdev(gen) 5525 return nil 5526 } 5527 5528 func (d *DomainHostdev) Unmarshal(doc string) error { 5529 return xml.Unmarshal([]byte(doc), d) 5530 } 5531 5532 func (d *DomainHostdev) Marshal() (string, error) { 5533 doc, err := xml.MarshalIndent(d, "", " ") 5534 if err != nil { 5535 return "", err 5536 } 5537 return string(doc), nil 5538 } 5539 5540 func (a *DomainGraphicListener) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 5541 start.Name.Local = "listen" 5542 if a.Address != nil { 5543 start.Attr = append(start.Attr, xml.Attr{ 5544 xml.Name{Local: "type"}, "address", 5545 }) 5546 return e.EncodeElement(a.Address, start) 5547 } else if a.Network != nil { 5548 start.Attr = append(start.Attr, xml.Attr{ 5549 xml.Name{Local: "type"}, "network", 5550 }) 5551 return e.EncodeElement(a.Network, start) 5552 } else if a.Socket != nil { 5553 start.Attr = append(start.Attr, xml.Attr{ 5554 xml.Name{Local: "type"}, "socket", 5555 }) 5556 return e.EncodeElement(a.Socket, start) 5557 } else { 5558 start.Attr = append(start.Attr, xml.Attr{ 5559 xml.Name{Local: "type"}, "none", 5560 }) 5561 e.EncodeToken(start) 5562 e.EncodeToken(start.End()) 5563 } 5564 return nil 5565 } 5566 5567 func (a *DomainGraphicListener) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 5568 typ, ok := getAttr(start.Attr, "type") 5569 if !ok { 5570 return fmt.Errorf("Missing 'type' attribute on domain graphics listen") 5571 } 5572 if typ == "address" { 5573 var addr DomainGraphicListenerAddress 5574 err := d.DecodeElement(&addr, &start) 5575 if err != nil { 5576 return err 5577 } 5578 a.Address = &addr 5579 return nil 5580 } else if typ == "network" { 5581 var net DomainGraphicListenerNetwork 5582 err := d.DecodeElement(&net, &start) 5583 if err != nil { 5584 return err 5585 } 5586 a.Network = &net 5587 return nil 5588 } else if typ == "socket" { 5589 var sock DomainGraphicListenerSocket 5590 err := d.DecodeElement(&sock, &start) 5591 if err != nil { 5592 return err 5593 } 5594 a.Socket = &sock 5595 return nil 5596 } else if typ == "none" { 5597 d.Skip() 5598 } 5599 return nil 5600 } 5601 5602 type domainGraphicSDL struct { 5603 DomainGraphicSDL 5604 Audio *DomainGraphicAudio `xml:"audio"` 5605 } 5606 5607 type domainGraphicVNC struct { 5608 DomainGraphicVNC 5609 Audio *DomainGraphicAudio `xml:"audio"` 5610 } 5611 5612 type domainGraphicRDP struct { 5613 DomainGraphicRDP 5614 Audio *DomainGraphicAudio `xml:"audio"` 5615 } 5616 5617 type domainGraphicDesktop struct { 5618 DomainGraphicDesktop 5619 Audio *DomainGraphicAudio `xml:"audio"` 5620 } 5621 5622 type domainGraphicSpice struct { 5623 DomainGraphicSpice 5624 Audio *DomainGraphicAudio `xml:"audio"` 5625 } 5626 5627 type domainGraphicEGLHeadless struct { 5628 DomainGraphicEGLHeadless 5629 Audio *DomainGraphicAudio `xml:"audio"` 5630 } 5631 5632 type domainGraphicDBus struct { 5633 DomainGraphicDBus 5634 Audio *DomainGraphicAudio `xml:"audio"` 5635 } 5636 5637 func (a *DomainGraphic) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 5638 start.Name.Local = "graphics" 5639 if a.SDL != nil { 5640 start.Attr = append(start.Attr, xml.Attr{ 5641 xml.Name{Local: "type"}, "sdl", 5642 }) 5643 sdl := domainGraphicSDL{*a.SDL, a.Audio} 5644 return e.EncodeElement(sdl, start) 5645 } else if a.VNC != nil { 5646 start.Attr = append(start.Attr, xml.Attr{ 5647 xml.Name{Local: "type"}, "vnc", 5648 }) 5649 vnc := domainGraphicVNC{*a.VNC, a.Audio} 5650 return e.EncodeElement(vnc, start) 5651 } else if a.RDP != nil { 5652 start.Attr = append(start.Attr, xml.Attr{ 5653 xml.Name{Local: "type"}, "rdp", 5654 }) 5655 rdp := domainGraphicRDP{*a.RDP, a.Audio} 5656 return e.EncodeElement(rdp, start) 5657 } else if a.Desktop != nil { 5658 start.Attr = append(start.Attr, xml.Attr{ 5659 xml.Name{Local: "type"}, "desktop", 5660 }) 5661 desktop := domainGraphicDesktop{*a.Desktop, a.Audio} 5662 return e.EncodeElement(desktop, start) 5663 } else if a.Spice != nil { 5664 start.Attr = append(start.Attr, xml.Attr{ 5665 xml.Name{Local: "type"}, "spice", 5666 }) 5667 spice := domainGraphicSpice{*a.Spice, a.Audio} 5668 return e.EncodeElement(spice, start) 5669 } else if a.EGLHeadless != nil { 5670 start.Attr = append(start.Attr, xml.Attr{ 5671 xml.Name{Local: "type"}, "egl-headless", 5672 }) 5673 egl := domainGraphicEGLHeadless{*a.EGLHeadless, a.Audio} 5674 return e.EncodeElement(egl, start) 5675 } else if a.DBus != nil { 5676 start.Attr = append(start.Attr, xml.Attr{ 5677 xml.Name{Local: "type"}, "dbus", 5678 }) 5679 dbus := domainGraphicDBus{*a.DBus, a.Audio} 5680 return e.EncodeElement(dbus, start) 5681 } 5682 return nil 5683 } 5684 5685 func (a *DomainGraphic) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 5686 typ, ok := getAttr(start.Attr, "type") 5687 if !ok { 5688 return fmt.Errorf("Missing 'type' attribute on domain graphics") 5689 } 5690 if typ == "sdl" { 5691 var sdl domainGraphicSDL 5692 err := d.DecodeElement(&sdl, &start) 5693 if err != nil { 5694 return err 5695 } 5696 a.SDL = &sdl.DomainGraphicSDL 5697 a.Audio = sdl.Audio 5698 return nil 5699 } else if typ == "vnc" { 5700 var vnc domainGraphicVNC 5701 err := d.DecodeElement(&vnc, &start) 5702 if err != nil { 5703 return err 5704 } 5705 a.VNC = &vnc.DomainGraphicVNC 5706 a.Audio = vnc.Audio 5707 return nil 5708 } else if typ == "rdp" { 5709 var rdp domainGraphicRDP 5710 err := d.DecodeElement(&rdp, &start) 5711 if err != nil { 5712 return err 5713 } 5714 a.RDP = &rdp.DomainGraphicRDP 5715 a.Audio = rdp.Audio 5716 return nil 5717 } else if typ == "desktop" { 5718 var desktop domainGraphicDesktop 5719 err := d.DecodeElement(&desktop, &start) 5720 if err != nil { 5721 return err 5722 } 5723 a.Desktop = &desktop.DomainGraphicDesktop 5724 a.Audio = desktop.Audio 5725 return nil 5726 } else if typ == "spice" { 5727 var spice domainGraphicSpice 5728 err := d.DecodeElement(&spice, &start) 5729 if err != nil { 5730 return err 5731 } 5732 a.Spice = &spice.DomainGraphicSpice 5733 a.Audio = spice.Audio 5734 return nil 5735 } else if typ == "egl-headless" { 5736 var egl domainGraphicEGLHeadless 5737 err := d.DecodeElement(&egl, &start) 5738 if err != nil { 5739 return err 5740 } 5741 a.EGLHeadless = &egl.DomainGraphicEGLHeadless 5742 a.Audio = egl.Audio 5743 return nil 5744 } else if typ == "dbus" { 5745 var dbus domainGraphicDBus 5746 err := d.DecodeElement(&dbus, &start) 5747 if err != nil { 5748 return err 5749 } 5750 a.DBus = &dbus.DomainGraphicDBus 5751 a.Audio = dbus.Audio 5752 return nil 5753 } 5754 return nil 5755 } 5756 5757 func (a *DomainAudio) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 5758 start.Name.Local = "audio" 5759 if a.ID != 0 { 5760 start.Attr = append(start.Attr, xml.Attr{ 5761 xml.Name{Local: "id"}, fmt.Sprintf("%d", a.ID), 5762 }) 5763 } 5764 if a.TimerPeriod != 0 { 5765 start.Attr = append(start.Attr, xml.Attr{ 5766 xml.Name{Local: "timerPeriod"}, fmt.Sprintf("%d", a.TimerPeriod), 5767 }) 5768 } 5769 if a.None != nil { 5770 start.Attr = append(start.Attr, xml.Attr{ 5771 xml.Name{Local: "type"}, "none", 5772 }) 5773 return e.EncodeElement(a.None, start) 5774 } else if a.ALSA != nil { 5775 start.Attr = append(start.Attr, xml.Attr{ 5776 xml.Name{Local: "type"}, "alsa", 5777 }) 5778 return e.EncodeElement(a.ALSA, start) 5779 } else if a.CoreAudio != nil { 5780 start.Attr = append(start.Attr, xml.Attr{ 5781 xml.Name{Local: "type"}, "coreaudio", 5782 }) 5783 return e.EncodeElement(a.CoreAudio, start) 5784 } else if a.Jack != nil { 5785 start.Attr = append(start.Attr, xml.Attr{ 5786 xml.Name{Local: "type"}, "jack", 5787 }) 5788 return e.EncodeElement(a.Jack, start) 5789 } else if a.OSS != nil { 5790 start.Attr = append(start.Attr, xml.Attr{ 5791 xml.Name{Local: "type"}, "oss", 5792 }) 5793 return e.EncodeElement(a.OSS, start) 5794 } else if a.PulseAudio != nil { 5795 start.Attr = append(start.Attr, xml.Attr{ 5796 xml.Name{Local: "type"}, "pulseaudio", 5797 }) 5798 return e.EncodeElement(a.PulseAudio, start) 5799 } else if a.SDL != nil { 5800 start.Attr = append(start.Attr, xml.Attr{ 5801 xml.Name{Local: "type"}, "sdl", 5802 }) 5803 return e.EncodeElement(a.SDL, start) 5804 } else if a.SPICE != nil { 5805 start.Attr = append(start.Attr, xml.Attr{ 5806 xml.Name{Local: "type"}, "spice", 5807 }) 5808 return e.EncodeElement(a.SPICE, start) 5809 } else if a.File != nil { 5810 start.Attr = append(start.Attr, xml.Attr{ 5811 xml.Name{Local: "type"}, "file", 5812 }) 5813 return e.EncodeElement(a.File, start) 5814 } else if a.DBus != nil { 5815 start.Attr = append(start.Attr, xml.Attr{ 5816 xml.Name{Local: "type"}, "dbus", 5817 }) 5818 return e.EncodeElement(a.DBus, start) 5819 } else if a.PipeWire != nil { 5820 start.Attr = append(start.Attr, xml.Attr{ 5821 xml.Name{Local: "type"}, "pipewire", 5822 }) 5823 return e.EncodeElement(a.PipeWire, start) 5824 } 5825 return nil 5826 } 5827 5828 func (a *DomainAudio) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 5829 typ, ok := getAttr(start.Attr, "type") 5830 if !ok { 5831 return fmt.Errorf("Missing 'type' attribute on domain audio") 5832 } 5833 id, ok := getAttr(start.Attr, "id") 5834 if ok { 5835 idval, err := strconv.ParseInt(id, 10, 32) 5836 if err != nil { 5837 return err 5838 } 5839 a.ID = int(idval) 5840 } 5841 5842 period, ok := getAttr(start.Attr, "timerPeriod") 5843 if ok { 5844 periodval, err := strconv.ParseUint(period, 10, 32) 5845 if err != nil { 5846 return err 5847 } 5848 a.TimerPeriod = uint(periodval) 5849 } 5850 5851 if typ == "none" { 5852 var none DomainAudioNone 5853 err := d.DecodeElement(&none, &start) 5854 if err != nil { 5855 return err 5856 } 5857 a.None = &none 5858 return nil 5859 } else if typ == "alsa" { 5860 var alsa DomainAudioALSA 5861 err := d.DecodeElement(&alsa, &start) 5862 if err != nil { 5863 return err 5864 } 5865 a.ALSA = &alsa 5866 return nil 5867 } else if typ == "coreaudio" { 5868 var coreaudio DomainAudioCoreAudio 5869 err := d.DecodeElement(&coreaudio, &start) 5870 if err != nil { 5871 return err 5872 } 5873 a.CoreAudio = &coreaudio 5874 return nil 5875 } else if typ == "jack" { 5876 var jack DomainAudioJack 5877 err := d.DecodeElement(&jack, &start) 5878 if err != nil { 5879 return err 5880 } 5881 a.Jack = &jack 5882 return nil 5883 } else if typ == "oss" { 5884 var oss DomainAudioOSS 5885 err := d.DecodeElement(&oss, &start) 5886 if err != nil { 5887 return err 5888 } 5889 a.OSS = &oss 5890 return nil 5891 } else if typ == "pulseaudio" { 5892 var pulseaudio DomainAudioPulseAudio 5893 err := d.DecodeElement(&pulseaudio, &start) 5894 if err != nil { 5895 return err 5896 } 5897 a.PulseAudio = &pulseaudio 5898 return nil 5899 } else if typ == "sdl" { 5900 var sdl DomainAudioSDL 5901 err := d.DecodeElement(&sdl, &start) 5902 if err != nil { 5903 return err 5904 } 5905 a.SDL = &sdl 5906 return nil 5907 } else if typ == "spice" { 5908 var spice DomainAudioSPICE 5909 err := d.DecodeElement(&spice, &start) 5910 if err != nil { 5911 return err 5912 } 5913 a.SPICE = &spice 5914 return nil 5915 } else if typ == "file" { 5916 var file DomainAudioFile 5917 err := d.DecodeElement(&file, &start) 5918 if err != nil { 5919 return err 5920 } 5921 a.File = &file 5922 return nil 5923 } else if typ == "dbus" { 5924 var dbus DomainAudioDBus 5925 err := d.DecodeElement(&dbus, &start) 5926 if err != nil { 5927 return err 5928 } 5929 a.DBus = &dbus 5930 return nil 5931 } else if typ == "pipewire" { 5932 var pipewire DomainAudioPipeWire 5933 err := d.DecodeElement(&pipewire, &start) 5934 if err != nil { 5935 return err 5936 } 5937 a.PipeWire = &pipewire 5938 return nil 5939 } 5940 return nil 5941 } 5942 5943 func (d *DomainMemorydev) Unmarshal(doc string) error { 5944 return xml.Unmarshal([]byte(doc), d) 5945 } 5946 5947 func (d *DomainMemorydev) Marshal() (string, error) { 5948 doc, err := xml.MarshalIndent(d, "", " ") 5949 if err != nil { 5950 return "", err 5951 } 5952 return string(doc), nil 5953 } 5954 5955 func (d *DomainWatchdog) Unmarshal(doc string) error { 5956 return xml.Unmarshal([]byte(doc), d) 5957 } 5958 5959 func (d *DomainWatchdog) Marshal() (string, error) { 5960 doc, err := xml.MarshalIndent(d, "", " ") 5961 if err != nil { 5962 return "", err 5963 } 5964 return string(doc), nil 5965 } 5966 5967 func (a *DomainCryptoBackend) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 5968 start.Name.Local = "backend" 5969 if a.BuiltIn != nil { 5970 start.Attr = append(start.Attr, xml.Attr{ 5971 xml.Name{Local: "model"}, "builtin", 5972 }) 5973 } else if a.LKCF != nil { 5974 start.Attr = append(start.Attr, xml.Attr{ 5975 xml.Name{Local: "model"}, "lkcf", 5976 }) 5977 } 5978 marshalUintAttr(&start, "queues", &a.Queues, "%d") 5979 e.EncodeToken(start) 5980 e.EncodeToken(start.End()) 5981 return nil 5982 } 5983 5984 func (a *DomainCryptoBackend) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 5985 typ, ok := getAttr(start.Attr, "model") 5986 if !ok { 5987 return fmt.Errorf("Missing 'model' attribute on domain crypto backend") 5988 } 5989 for _, attr := range start.Attr { 5990 if attr.Name.Local == "queues" { 5991 var v *uint 5992 if err := unmarshalUintAttr(attr.Value, &v, 10); err != nil { 5993 return err 5994 } 5995 if v != nil { 5996 a.Queues = *v 5997 } 5998 } 5999 } 6000 6001 if typ == "builtin" { 6002 var builtin DomainCryptoBackendBuiltIn 6003 a.BuiltIn = &builtin 6004 d.Skip() 6005 return nil 6006 } else if typ == "lkcf" { 6007 var lkcf DomainCryptoBackendLKCF 6008 a.LKCF = &lkcf 6009 d.Skip() 6010 return nil 6011 } 6012 6013 return nil 6014 } 6015 6016 func marshalUintAttr(start *xml.StartElement, name string, val *uint, format string) { 6017 if val != nil { 6018 start.Attr = append(start.Attr, xml.Attr{ 6019 xml.Name{Local: name}, fmt.Sprintf(format, *val), 6020 }) 6021 } 6022 } 6023 6024 func marshalUint64Attr(start *xml.StartElement, name string, val *uint64, format string) { 6025 if val != nil { 6026 start.Attr = append(start.Attr, xml.Attr{ 6027 xml.Name{Local: name}, fmt.Sprintf(format, *val), 6028 }) 6029 } 6030 } 6031 6032 func (a *DomainMemorydevTargetAddress) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 6033 marshalUintAttr(&start, "base", a.Base, "0x%08x") 6034 e.EncodeToken(start) 6035 e.EncodeToken(start.End()) 6036 return nil 6037 } 6038 6039 func (a *DomainAddressPCI) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 6040 marshalUintAttr(&start, "domain", a.Domain, "0x%04x") 6041 marshalUintAttr(&start, "bus", a.Bus, "0x%02x") 6042 marshalUintAttr(&start, "slot", a.Slot, "0x%02x") 6043 marshalUintAttr(&start, "function", a.Function, "0x%x") 6044 if a.MultiFunction != "" { 6045 start.Attr = append(start.Attr, xml.Attr{ 6046 xml.Name{Local: "multifunction"}, a.MultiFunction, 6047 }) 6048 } 6049 e.EncodeToken(start) 6050 if a.ZPCI != nil { 6051 zpci := xml.StartElement{} 6052 zpci.Name.Local = "zpci" 6053 err := e.EncodeElement(a.ZPCI, zpci) 6054 if err != nil { 6055 return err 6056 } 6057 } 6058 e.EncodeToken(start.End()) 6059 return nil 6060 } 6061 6062 func (a *DomainAddressZPCI) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 6063 marshalUintAttr(&start, "uid", a.UID, "0x%04x") 6064 marshalUintAttr(&start, "fid", a.FID, "0x%04x") 6065 e.EncodeToken(start) 6066 e.EncodeToken(start.End()) 6067 return nil 6068 } 6069 6070 func (a *DomainAddressUSB) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 6071 marshalUintAttr(&start, "bus", a.Bus, "%d") 6072 if a.Port != "" { 6073 start.Attr = append(start.Attr, xml.Attr{ 6074 xml.Name{Local: "port"}, a.Port, 6075 }) 6076 } 6077 marshalUintAttr(&start, "device", a.Device, "%d") 6078 e.EncodeToken(start) 6079 e.EncodeToken(start.End()) 6080 return nil 6081 } 6082 6083 func (a *DomainAddressDrive) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 6084 marshalUintAttr(&start, "controller", a.Controller, "%d") 6085 marshalUintAttr(&start, "bus", a.Bus, "%d") 6086 marshalUintAttr(&start, "target", a.Target, "%d") 6087 marshalUintAttr(&start, "unit", a.Unit, "%d") 6088 e.EncodeToken(start) 6089 e.EncodeToken(start.End()) 6090 return nil 6091 } 6092 6093 func (a *DomainAddressDIMM) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 6094 marshalUintAttr(&start, "slot", a.Slot, "%d") 6095 marshalUint64Attr(&start, "base", a.Base, "0x%x") 6096 e.EncodeToken(start) 6097 e.EncodeToken(start.End()) 6098 return nil 6099 } 6100 6101 func (a *DomainAddressISA) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 6102 marshalUintAttr(&start, "iobase", a.IOBase, "0x%x") 6103 marshalUintAttr(&start, "irq", a.IRQ, "0x%x") 6104 e.EncodeToken(start) 6105 e.EncodeToken(start.End()) 6106 return nil 6107 } 6108 6109 func (a *DomainAddressVirtioMMIO) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 6110 e.EncodeToken(start) 6111 e.EncodeToken(start.End()) 6112 return nil 6113 } 6114 6115 func (a *DomainAddressCCW) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 6116 marshalUintAttr(&start, "cssid", a.CSSID, "0x%x") 6117 marshalUintAttr(&start, "ssid", a.SSID, "0x%x") 6118 marshalUintAttr(&start, "devno", a.DevNo, "0x%04x") 6119 e.EncodeToken(start) 6120 e.EncodeToken(start.End()) 6121 return nil 6122 } 6123 6124 func (a *DomainAddressVirtioSerial) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 6125 marshalUintAttr(&start, "controller", a.Controller, "%d") 6126 marshalUintAttr(&start, "bus", a.Bus, "%d") 6127 marshalUintAttr(&start, "port", a.Port, "%d") 6128 e.EncodeToken(start) 6129 e.EncodeToken(start.End()) 6130 return nil 6131 } 6132 6133 func (a *DomainAddressSpaprVIO) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 6134 marshalUint64Attr(&start, "reg", a.Reg, "0x%x") 6135 e.EncodeToken(start) 6136 e.EncodeToken(start.End()) 6137 return nil 6138 } 6139 6140 func (a *DomainAddressCCID) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 6141 marshalUintAttr(&start, "controller", a.Controller, "%d") 6142 marshalUintAttr(&start, "slot", a.Slot, "%d") 6143 e.EncodeToken(start) 6144 e.EncodeToken(start.End()) 6145 return nil 6146 } 6147 6148 func (a *DomainAddressVirtioS390) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 6149 e.EncodeToken(start) 6150 e.EncodeToken(start.End()) 6151 return nil 6152 } 6153 6154 func (a *DomainAddressUnassigned) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 6155 e.EncodeToken(start) 6156 e.EncodeToken(start.End()) 6157 return nil 6158 } 6159 6160 func (a *DomainAddress) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 6161 if a.USB != nil { 6162 start.Attr = append(start.Attr, xml.Attr{ 6163 xml.Name{Local: "type"}, "usb", 6164 }) 6165 return e.EncodeElement(a.USB, start) 6166 } else if a.PCI != nil { 6167 start.Attr = append(start.Attr, xml.Attr{ 6168 xml.Name{Local: "type"}, "pci", 6169 }) 6170 return e.EncodeElement(a.PCI, start) 6171 } else if a.Drive != nil { 6172 start.Attr = append(start.Attr, xml.Attr{ 6173 xml.Name{Local: "type"}, "drive", 6174 }) 6175 return e.EncodeElement(a.Drive, start) 6176 } else if a.DIMM != nil { 6177 start.Attr = append(start.Attr, xml.Attr{ 6178 xml.Name{Local: "type"}, "dimm", 6179 }) 6180 return e.EncodeElement(a.DIMM, start) 6181 } else if a.ISA != nil { 6182 start.Attr = append(start.Attr, xml.Attr{ 6183 xml.Name{Local: "type"}, "isa", 6184 }) 6185 return e.EncodeElement(a.ISA, start) 6186 } else if a.VirtioMMIO != nil { 6187 start.Attr = append(start.Attr, xml.Attr{ 6188 xml.Name{Local: "type"}, "virtio-mmio", 6189 }) 6190 return e.EncodeElement(a.VirtioMMIO, start) 6191 } else if a.CCW != nil { 6192 start.Attr = append(start.Attr, xml.Attr{ 6193 xml.Name{Local: "type"}, "ccw", 6194 }) 6195 return e.EncodeElement(a.CCW, start) 6196 } else if a.VirtioSerial != nil { 6197 start.Attr = append(start.Attr, xml.Attr{ 6198 xml.Name{Local: "type"}, "virtio-serial", 6199 }) 6200 return e.EncodeElement(a.VirtioSerial, start) 6201 } else if a.SpaprVIO != nil { 6202 start.Attr = append(start.Attr, xml.Attr{ 6203 xml.Name{Local: "type"}, "spapr-vio", 6204 }) 6205 return e.EncodeElement(a.SpaprVIO, start) 6206 } else if a.CCID != nil { 6207 start.Attr = append(start.Attr, xml.Attr{ 6208 xml.Name{Local: "type"}, "ccid", 6209 }) 6210 return e.EncodeElement(a.CCID, start) 6211 } else if a.VirtioS390 != nil { 6212 start.Attr = append(start.Attr, xml.Attr{ 6213 xml.Name{Local: "type"}, "virtio-s390", 6214 }) 6215 return e.EncodeElement(a.VirtioS390, start) 6216 } else if a.Unassigned != nil { 6217 start.Attr = append(start.Attr, xml.Attr{ 6218 xml.Name{Local: "type"}, "unassigned", 6219 }) 6220 return e.EncodeElement(a.Unassigned, start) 6221 } else { 6222 return nil 6223 } 6224 } 6225 6226 func unmarshalUint64Attr(valstr string, valptr **uint64, base int) error { 6227 if base == 16 { 6228 valstr = strings.TrimPrefix(valstr, "0x") 6229 } 6230 val, err := strconv.ParseUint(valstr, base, 64) 6231 if err != nil { 6232 return err 6233 } 6234 *valptr = &val 6235 return nil 6236 } 6237 6238 func unmarshalUintAttr(valstr string, valptr **uint, base int) error { 6239 if base == 16 { 6240 valstr = strings.TrimPrefix(valstr, "0x") 6241 } 6242 val, err := strconv.ParseUint(valstr, base, 64) 6243 if err != nil { 6244 return err 6245 } 6246 vali := uint(val) 6247 *valptr = &vali 6248 return nil 6249 } 6250 6251 func (a *DomainMemorydevTargetAddress) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 6252 for _, attr := range start.Attr { 6253 if attr.Name.Local == "base" { 6254 if err := unmarshalUintAttr(attr.Value, &a.Base, 0); err != nil { 6255 return err 6256 } 6257 } 6258 } 6259 6260 d.Skip() 6261 return nil 6262 } 6263 6264 func (a *DomainAddressUSB) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 6265 for _, attr := range start.Attr { 6266 if attr.Name.Local == "bus" { 6267 if err := unmarshalUintAttr(attr.Value, &a.Bus, 10); err != nil { 6268 return err 6269 } 6270 } else if attr.Name.Local == "port" { 6271 a.Port = attr.Value 6272 } else if attr.Name.Local == "device" { 6273 if err := unmarshalUintAttr(attr.Value, &a.Device, 10); err != nil { 6274 return err 6275 } 6276 } 6277 } 6278 d.Skip() 6279 return nil 6280 } 6281 6282 func (a *DomainAddressPCI) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 6283 for _, attr := range start.Attr { 6284 if attr.Name.Local == "domain" { 6285 if err := unmarshalUintAttr(attr.Value, &a.Domain, 0); err != nil { 6286 return err 6287 } 6288 } else if attr.Name.Local == "bus" { 6289 if err := unmarshalUintAttr(attr.Value, &a.Bus, 0); err != nil { 6290 return err 6291 } 6292 } else if attr.Name.Local == "slot" { 6293 if err := unmarshalUintAttr(attr.Value, &a.Slot, 0); err != nil { 6294 return err 6295 } 6296 } else if attr.Name.Local == "function" { 6297 if err := unmarshalUintAttr(attr.Value, &a.Function, 0); err != nil { 6298 return err 6299 } 6300 } else if attr.Name.Local == "multifunction" { 6301 a.MultiFunction = attr.Value 6302 } 6303 } 6304 6305 for { 6306 tok, err := d.Token() 6307 if err == io.EOF { 6308 break 6309 } 6310 if err != nil { 6311 return err 6312 } 6313 6314 switch tok := tok.(type) { 6315 case xml.StartElement: 6316 if tok.Name.Local == "zpci" { 6317 a.ZPCI = &DomainAddressZPCI{} 6318 err = d.DecodeElement(a.ZPCI, &tok) 6319 if err != nil { 6320 return err 6321 } 6322 } 6323 } 6324 } 6325 return nil 6326 } 6327 6328 func (a *DomainAddressZPCI) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 6329 for _, attr := range start.Attr { 6330 if attr.Name.Local == "fid" { 6331 if err := unmarshalUintAttr(attr.Value, &a.FID, 0); err != nil { 6332 return err 6333 } 6334 } else if attr.Name.Local == "uid" { 6335 if err := unmarshalUintAttr(attr.Value, &a.UID, 0); err != nil { 6336 return err 6337 } 6338 } 6339 } 6340 6341 d.Skip() 6342 return nil 6343 } 6344 6345 func (a *DomainAddressDrive) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 6346 for _, attr := range start.Attr { 6347 if attr.Name.Local == "controller" { 6348 if err := unmarshalUintAttr(attr.Value, &a.Controller, 10); err != nil { 6349 return err 6350 } 6351 } else if attr.Name.Local == "bus" { 6352 if err := unmarshalUintAttr(attr.Value, &a.Bus, 10); err != nil { 6353 return err 6354 } 6355 } else if attr.Name.Local == "target" { 6356 if err := unmarshalUintAttr(attr.Value, &a.Target, 10); err != nil { 6357 return err 6358 } 6359 } else if attr.Name.Local == "unit" { 6360 if err := unmarshalUintAttr(attr.Value, &a.Unit, 10); err != nil { 6361 return err 6362 } 6363 } 6364 } 6365 d.Skip() 6366 return nil 6367 } 6368 6369 func (a *DomainAddressDIMM) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 6370 for _, attr := range start.Attr { 6371 if attr.Name.Local == "slot" { 6372 if err := unmarshalUintAttr(attr.Value, &a.Slot, 10); err != nil { 6373 return err 6374 } 6375 } else if attr.Name.Local == "base" { 6376 if err := unmarshalUint64Attr(attr.Value, &a.Base, 16); err != nil { 6377 return err 6378 } 6379 } 6380 } 6381 d.Skip() 6382 return nil 6383 } 6384 6385 func (a *DomainAddressISA) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 6386 for _, attr := range start.Attr { 6387 if attr.Name.Local == "iobase" { 6388 if err := unmarshalUintAttr(attr.Value, &a.IOBase, 16); err != nil { 6389 return err 6390 } 6391 } else if attr.Name.Local == "irq" { 6392 if err := unmarshalUintAttr(attr.Value, &a.IRQ, 16); err != nil { 6393 return err 6394 } 6395 } 6396 } 6397 d.Skip() 6398 return nil 6399 } 6400 6401 func (a *DomainAddressVirtioMMIO) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 6402 d.Skip() 6403 return nil 6404 } 6405 6406 func (a *DomainAddressCCW) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 6407 for _, attr := range start.Attr { 6408 if attr.Name.Local == "cssid" { 6409 if err := unmarshalUintAttr(attr.Value, &a.CSSID, 0); err != nil { 6410 return err 6411 } 6412 } else if attr.Name.Local == "ssid" { 6413 if err := unmarshalUintAttr(attr.Value, &a.SSID, 0); err != nil { 6414 return err 6415 } 6416 } else if attr.Name.Local == "devno" { 6417 if err := unmarshalUintAttr(attr.Value, &a.DevNo, 0); err != nil { 6418 return err 6419 } 6420 } 6421 } 6422 d.Skip() 6423 return nil 6424 } 6425 6426 func (a *DomainAddressVirtioSerial) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 6427 for _, attr := range start.Attr { 6428 if attr.Name.Local == "controller" { 6429 if err := unmarshalUintAttr(attr.Value, &a.Controller, 10); err != nil { 6430 return err 6431 } 6432 } else if attr.Name.Local == "bus" { 6433 if err := unmarshalUintAttr(attr.Value, &a.Bus, 10); err != nil { 6434 return err 6435 } 6436 } else if attr.Name.Local == "port" { 6437 if err := unmarshalUintAttr(attr.Value, &a.Port, 10); err != nil { 6438 return err 6439 } 6440 } 6441 } 6442 d.Skip() 6443 return nil 6444 } 6445 6446 func (a *DomainAddressSpaprVIO) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 6447 for _, attr := range start.Attr { 6448 if attr.Name.Local == "reg" { 6449 if err := unmarshalUint64Attr(attr.Value, &a.Reg, 16); err != nil { 6450 return err 6451 } 6452 } 6453 } 6454 d.Skip() 6455 return nil 6456 } 6457 6458 func (a *DomainAddressCCID) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 6459 for _, attr := range start.Attr { 6460 if attr.Name.Local == "controller" { 6461 if err := unmarshalUintAttr(attr.Value, &a.Controller, 10); err != nil { 6462 return err 6463 } 6464 } else if attr.Name.Local == "slot" { 6465 if err := unmarshalUintAttr(attr.Value, &a.Slot, 10); err != nil { 6466 return err 6467 } 6468 } 6469 } 6470 d.Skip() 6471 return nil 6472 } 6473 6474 func (a *DomainAddressVirtioS390) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 6475 d.Skip() 6476 return nil 6477 } 6478 6479 func (a *DomainAddressUnassigned) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 6480 d.Skip() 6481 return nil 6482 } 6483 6484 func (a *DomainAddress) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 6485 var typ string 6486 for _, attr := range start.Attr { 6487 if attr.Name.Local == "type" { 6488 typ = attr.Value 6489 break 6490 } 6491 } 6492 if typ == "" { 6493 d.Skip() 6494 return nil 6495 } 6496 6497 if typ == "usb" { 6498 a.USB = &DomainAddressUSB{} 6499 return d.DecodeElement(a.USB, &start) 6500 } else if typ == "pci" { 6501 a.PCI = &DomainAddressPCI{} 6502 return d.DecodeElement(a.PCI, &start) 6503 } else if typ == "drive" { 6504 a.Drive = &DomainAddressDrive{} 6505 return d.DecodeElement(a.Drive, &start) 6506 } else if typ == "dimm" { 6507 a.DIMM = &DomainAddressDIMM{} 6508 return d.DecodeElement(a.DIMM, &start) 6509 } else if typ == "isa" { 6510 a.ISA = &DomainAddressISA{} 6511 return d.DecodeElement(a.ISA, &start) 6512 } else if typ == "virtio-mmio" { 6513 a.VirtioMMIO = &DomainAddressVirtioMMIO{} 6514 return d.DecodeElement(a.VirtioMMIO, &start) 6515 } else if typ == "ccw" { 6516 a.CCW = &DomainAddressCCW{} 6517 return d.DecodeElement(a.CCW, &start) 6518 } else if typ == "virtio-serial" { 6519 a.VirtioSerial = &DomainAddressVirtioSerial{} 6520 return d.DecodeElement(a.VirtioSerial, &start) 6521 } else if typ == "spapr-vio" { 6522 a.SpaprVIO = &DomainAddressSpaprVIO{} 6523 return d.DecodeElement(a.SpaprVIO, &start) 6524 } else if typ == "ccid" { 6525 a.CCID = &DomainAddressCCID{} 6526 return d.DecodeElement(a.CCID, &start) 6527 } else if typ == "virtio-s390" { 6528 a.VirtioS390 = &DomainAddressVirtioS390{} 6529 return d.DecodeElement(a.VirtioS390, &start) 6530 } else if typ == "unassigned" { 6531 a.Unassigned = &DomainAddressUnassigned{} 6532 return d.DecodeElement(a.Unassigned, &start) 6533 } 6534 6535 return nil 6536 } 6537 6538 func (d *DomainCPU) Unmarshal(doc string) error { 6539 return xml.Unmarshal([]byte(doc), d) 6540 } 6541 6542 func (d *DomainCPU) Marshal() (string, error) { 6543 doc, err := xml.MarshalIndent(d, "", " ") 6544 if err != nil { 6545 return "", err 6546 } 6547 return string(doc), nil 6548 } 6549 6550 func (a *DomainLaunchSecuritySEV) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 6551 6552 if a.KernelHashes != "" { 6553 start.Attr = append(start.Attr, xml.Attr{ 6554 xml.Name{Local: "kernelHashes"}, a.KernelHashes, 6555 }) 6556 } 6557 6558 e.EncodeToken(start) 6559 6560 if a.CBitPos != nil { 6561 cbitpos := xml.StartElement{ 6562 Name: xml.Name{Local: "cbitpos"}, 6563 } 6564 e.EncodeToken(cbitpos) 6565 e.EncodeToken(xml.CharData(fmt.Sprintf("%d", *a.CBitPos))) 6566 e.EncodeToken(cbitpos.End()) 6567 } 6568 6569 if a.ReducedPhysBits != nil { 6570 reducedPhysBits := xml.StartElement{ 6571 Name: xml.Name{Local: "reducedPhysBits"}, 6572 } 6573 e.EncodeToken(reducedPhysBits) 6574 e.EncodeToken(xml.CharData(fmt.Sprintf("%d", *a.ReducedPhysBits))) 6575 e.EncodeToken(reducedPhysBits.End()) 6576 } 6577 6578 if a.Policy != nil { 6579 policy := xml.StartElement{ 6580 Name: xml.Name{Local: "policy"}, 6581 } 6582 e.EncodeToken(policy) 6583 e.EncodeToken(xml.CharData(fmt.Sprintf("0x%04x", *a.Policy))) 6584 e.EncodeToken(policy.End()) 6585 } 6586 6587 dhcert := xml.StartElement{ 6588 Name: xml.Name{Local: "dhCert"}, 6589 } 6590 e.EncodeToken(dhcert) 6591 e.EncodeToken(xml.CharData(fmt.Sprintf("%s", a.DHCert))) 6592 e.EncodeToken(dhcert.End()) 6593 6594 session := xml.StartElement{ 6595 Name: xml.Name{Local: "session"}, 6596 } 6597 e.EncodeToken(session) 6598 e.EncodeToken(xml.CharData(fmt.Sprintf("%s", a.Session))) 6599 e.EncodeToken(session.End()) 6600 6601 e.EncodeToken(start.End()) 6602 6603 return nil 6604 } 6605 6606 func (a *DomainLaunchSecuritySEV) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 6607 for _, attr := range start.Attr { 6608 if attr.Name.Local == "kernelHashes" { 6609 a.KernelHashes = attr.Value 6610 } 6611 } 6612 6613 for { 6614 tok, err := d.Token() 6615 if err == io.EOF { 6616 break 6617 } 6618 if err != nil { 6619 return err 6620 } 6621 6622 switch tok := tok.(type) { 6623 case xml.StartElement: 6624 if tok.Name.Local == "policy" { 6625 data, err := d.Token() 6626 if err != nil { 6627 return err 6628 } 6629 switch data := data.(type) { 6630 case xml.CharData: 6631 if err := unmarshalUintAttr(string(data), &a.Policy, 16); err != nil { 6632 return err 6633 } 6634 } 6635 } else if tok.Name.Local == "cbitpos" { 6636 data, err := d.Token() 6637 if err != nil { 6638 return err 6639 } 6640 switch data := data.(type) { 6641 case xml.CharData: 6642 if err := unmarshalUintAttr(string(data), &a.CBitPos, 10); err != nil { 6643 return err 6644 } 6645 } 6646 } else if tok.Name.Local == "reducedPhysBits" { 6647 data, err := d.Token() 6648 if err != nil { 6649 return err 6650 } 6651 switch data := data.(type) { 6652 case xml.CharData: 6653 if err := unmarshalUintAttr(string(data), &a.ReducedPhysBits, 10); err != nil { 6654 return err 6655 } 6656 } 6657 } else if tok.Name.Local == "dhCert" { 6658 data, err := d.Token() 6659 if err != nil { 6660 return err 6661 } 6662 switch data := data.(type) { 6663 case xml.CharData: 6664 a.DHCert = string(data) 6665 } 6666 } else if tok.Name.Local == "session" { 6667 data, err := d.Token() 6668 if err != nil { 6669 return err 6670 } 6671 switch data := data.(type) { 6672 case xml.CharData: 6673 a.Session = string(data) 6674 } 6675 } 6676 } 6677 } 6678 return nil 6679 } 6680 6681 func (a *DomainLaunchSecurity) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 6682 6683 if a.SEV != nil { 6684 start.Attr = append(start.Attr, xml.Attr{ 6685 xml.Name{Local: "type"}, "sev", 6686 }) 6687 return e.EncodeElement(a.SEV, start) 6688 } else if a.S390PV != nil { 6689 start.Attr = append(start.Attr, xml.Attr{ 6690 xml.Name{Local: "type"}, "s390-pv", 6691 }) 6692 return e.EncodeElement(a.S390PV, start) 6693 } else { 6694 return nil 6695 } 6696 6697 } 6698 6699 func (a *DomainLaunchSecurity) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 6700 var typ string 6701 for _, attr := range start.Attr { 6702 if attr.Name.Local == "type" { 6703 typ = attr.Value 6704 } 6705 } 6706 6707 if typ == "" { 6708 d.Skip() 6709 return nil 6710 } 6711 6712 if typ == "sev" { 6713 a.SEV = &DomainLaunchSecuritySEV{} 6714 return d.DecodeElement(a.SEV, &start) 6715 } else if typ == "s390-pv" { 6716 a.S390PV = &DomainLaunchSecurityS390PV{} 6717 return d.DecodeElement(a.S390PV, &start) 6718 } 6719 6720 return nil 6721 } 6722 6723 type domainSysInfo DomainSysInfo 6724 6725 type domainSysInfoSMBIOS struct { 6726 DomainSysInfoSMBIOS 6727 domainSysInfo 6728 } 6729 6730 type domainSysInfoFWCfg struct { 6731 DomainSysInfoFWCfg 6732 domainSysInfo 6733 } 6734 6735 func (a *DomainSysInfo) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 6736 start.Name.Local = "sysinfo" 6737 if a.SMBIOS != nil { 6738 smbios := domainSysInfoSMBIOS{} 6739 smbios.domainSysInfo = domainSysInfo(*a) 6740 smbios.DomainSysInfoSMBIOS = *a.SMBIOS 6741 start.Attr = append(start.Attr, xml.Attr{ 6742 xml.Name{Local: "type"}, "smbios", 6743 }) 6744 return e.EncodeElement(smbios, start) 6745 } else if a.FWCfg != nil { 6746 fwcfg := domainSysInfoFWCfg{} 6747 fwcfg.domainSysInfo = domainSysInfo(*a) 6748 fwcfg.DomainSysInfoFWCfg = *a.FWCfg 6749 start.Attr = append(start.Attr, xml.Attr{ 6750 xml.Name{Local: "type"}, "fwcfg", 6751 }) 6752 return e.EncodeElement(fwcfg, start) 6753 } else { 6754 gen := domainSysInfo(*a) 6755 return e.EncodeElement(gen, start) 6756 } 6757 } 6758 6759 func (a *DomainSysInfo) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 6760 typ, ok := getAttr(start.Attr, "type") 6761 if !ok { 6762 return fmt.Errorf("Missing 'type' attribute on domain controller") 6763 } 6764 if typ == "smbios" { 6765 var smbios domainSysInfoSMBIOS 6766 err := d.DecodeElement(&smbios, &start) 6767 if err != nil { 6768 return err 6769 } 6770 *a = DomainSysInfo(smbios.domainSysInfo) 6771 a.SMBIOS = &smbios.DomainSysInfoSMBIOS 6772 return nil 6773 } else if typ == "fwcfg" { 6774 var fwcfg domainSysInfoFWCfg 6775 err := d.DecodeElement(&fwcfg, &start) 6776 if err != nil { 6777 return err 6778 } 6779 *a = DomainSysInfo(fwcfg.domainSysInfo) 6780 a.FWCfg = &fwcfg.DomainSysInfoFWCfg 6781 return nil 6782 } else { 6783 var gen domainSysInfo 6784 err := d.DecodeElement(&gen, &start) 6785 if err != nil { 6786 return err 6787 } 6788 *a = DomainSysInfo(gen) 6789 return nil 6790 } 6791 } 6792 6793 type domainNVRam DomainNVRam 6794 6795 func (a *DomainNVRam) MarshalXML(e *xml.Encoder, start xml.StartElement) error { 6796 start.Name.Local = "nvram" 6797 if a.Source != nil { 6798 if a.Source.File != nil { 6799 start.Attr = append(start.Attr, xml.Attr{ 6800 xml.Name{Local: "type"}, "file", 6801 }) 6802 } else if a.Source.Block != nil { 6803 start.Attr = append(start.Attr, xml.Attr{ 6804 xml.Name{Local: "type"}, "block", 6805 }) 6806 } else if a.Source.Dir != nil { 6807 start.Attr = append(start.Attr, xml.Attr{ 6808 xml.Name{Local: "type"}, "dir", 6809 }) 6810 } else if a.Source.Network != nil { 6811 start.Attr = append(start.Attr, xml.Attr{ 6812 xml.Name{Local: "type"}, "network", 6813 }) 6814 } else if a.Source.Volume != nil { 6815 start.Attr = append(start.Attr, xml.Attr{ 6816 xml.Name{Local: "type"}, "volume", 6817 }) 6818 } else if a.Source.NVME != nil { 6819 start.Attr = append(start.Attr, xml.Attr{ 6820 xml.Name{Local: "type"}, "nvme", 6821 }) 6822 } else if a.Source.VHostUser != nil { 6823 start.Attr = append(start.Attr, xml.Attr{ 6824 xml.Name{Local: "type"}, "vhostuser", 6825 }) 6826 } else if a.Source.VHostVDPA != nil { 6827 start.Attr = append(start.Attr, xml.Attr{ 6828 xml.Name{Local: "type"}, "vhostvdpa", 6829 }) 6830 } 6831 } 6832 disk := domainNVRam(*a) 6833 return e.EncodeElement(disk, start) 6834 } 6835 6836 func (a *DomainNVRam) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 6837 typ, ok := getAttr(start.Attr, "type") 6838 6839 if ok { 6840 a.Source = &DomainDiskSource{} 6841 if typ == "file" { 6842 a.Source.File = &DomainDiskSourceFile{} 6843 } else if typ == "block" { 6844 a.Source.Block = &DomainDiskSourceBlock{} 6845 } else if typ == "network" { 6846 a.Source.Network = &DomainDiskSourceNetwork{} 6847 } else if typ == "dir" { 6848 a.Source.Dir = &DomainDiskSourceDir{} 6849 } else if typ == "volume" { 6850 a.Source.Volume = &DomainDiskSourceVolume{} 6851 } else if typ == "nvme" { 6852 a.Source.NVME = &DomainDiskSourceNVME{} 6853 } else if typ == "vhostuser" { 6854 a.Source.VHostUser = &DomainDiskSourceVHostUser{} 6855 } else if typ == "vhostvdpa" { 6856 a.Source.VHostVDPA = &DomainDiskSourceVHostVDPA{} 6857 } 6858 } 6859 disk := domainNVRam(*a) 6860 err := d.DecodeElement(&disk, &start) 6861 if err != nil { 6862 return err 6863 } 6864 if a.Source != nil { 6865 a.NVRam = "" 6866 } 6867 *a = DomainNVRam(disk) 6868 return nil 6869 }