Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions libvirt/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,19 @@ func setConsoles(d *schema.ResourceData, domainDef *libvirtxml.Domain) error {
console.Protocol = &libvirtxml.DomainChardevProtocol{
Type: "telnet",
}
case "udp":
sourceHost := d.Get(prefix + ".source_host")
sourceService := d.Get(prefix + ".source_service")
connectHost := d.Get(prefix + ".connect_host")
connectService := d.Get(prefix + ".connect_service")
console.Source = &libvirtxml.DomainChardevSource{
UDP: &libvirtxml.DomainChardevSourceUDP{
BindHost: sourceHost.(string),
BindService: sourceService.(string),
ConnectHost: connectHost.(string),
ConnectService: connectService.(string),
},
}
case "pty":
if sourcePath, ok := d.GetOk(prefix + ".source_path"); ok {
console.Source = &libvirtxml.DomainChardevSource{
Expand All @@ -471,6 +484,15 @@ func setConsoles(d *schema.ResourceData, domainDef *libvirtxml.Domain) error {
},
}
}
case "file":
if sourcePath, ok := d.GetOk(prefix + ".source_path"); ok {
console.Source = &libvirtxml.DomainChardevSource{
File: &libvirtxml.DomainChardevSourceFile{
Path: sourcePath.(string),
Append: "on",
},
}
}
default:
if sourcePath, ok := d.GetOk(prefix + ".source_path"); ok {
console.Source = &libvirtxml.DomainChardevSource{
Expand Down
10 changes: 10 additions & 0 deletions libvirt/resource_libvirt_domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,16 @@ func resourceLibvirtDomain() *schema.Resource {
Optional: true,
ForceNew: true,
},
"connect_host": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"connect_service": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
},
},
},
Expand Down