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