Skip to content

Volume loses its format_type when saved #169

@mxey

Description

@mxey

When creating a volume with fog-libvirt, the format_type is lost:

irb(main):004:0> compute = Fog::Compute.new(provider: :libvirt, libvirt_uri: "qemu+ssh://s098209.rz.babiel.com/system")
=> #<Fog::Libvirt::Compute::Real:5400 @uri=#<Fog::Libvirt::Util::URI:0x0000000109fd8068 @parsed_uri=#<URI::Generic qemu+ssh://s098209.rz....
irb(main):005:0> vol = compute.volumes.new
=> 
  <Fog::Libvirt::Compute::Volume
...

irb(main):006:0> vol.format_type
=> "raw"


irb(main):007:0> vol.save
=> 
  <Fog::Libvirt::Compute::Volume
    id="tqVRqA-UU7o-qOms-HaHd-e5hr-a4qi-Fz4hU7",
    pool_name="vg1",
    key="tqVRqA-UU7o-qOms-HaHd-e5hr-a4qi-Fz4hU7",
    name="fog-817509623589251",
    path="/dev/vg1/fog-817509623589251",
    capacity=10,
    allocation=1,
    owner=nil,
    group=nil,
    format_type=nil,
    backing_volume=nil
  >

irb(main):008:0> vol.format_type
=> nil

If this created volume is then used for a VM, the generated XML is invalid:

<driver name="qemu" type=""/>

which leads to the error Call to virDomainDefineXML failed: unsupported configuration: unknown driver format value ''

This causes https://projects.theforeman.org/issues/38081

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions