Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package rubygem-fog-libvirt for 
openSUSE:Factory checked in at 2022-12-13 18:56:39
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-fog-libvirt (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-fog-libvirt.new.1835 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-fog-libvirt"

Tue Dec 13 18:56:39 2022 rev:5 rq:1042638 version:0.10.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-fog-libvirt/rubygem-fog-libvirt.changes  
2021-08-03 22:48:44.192497181 +0200
+++ 
/work/SRC/openSUSE:Factory/.rubygem-fog-libvirt.new.1835/rubygem-fog-libvirt.changes
        2022-12-13 18:57:00.731697956 +0100
@@ -1,0 +2,6 @@
+Wed Dec  7 11:20:51 UTC 2022 - Stephan Kulow <[email protected]>
+
+updated to version 0.10.1
+  no changelog found
+
+-------------------------------------------------------------------

Old:
----
  fog-libvirt-0.9.0.gem

New:
----
  fog-libvirt-0.10.1.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-fog-libvirt.spec ++++++
--- /var/tmp/diff_new_pack.IgjH4J/_old  2022-12-13 18:57:01.263700796 +0100
+++ /var/tmp/diff_new_pack.IgjH4J/_new  2022-12-13 18:57:01.267700817 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package rubygem-fog-libvirt
 #
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-fog-libvirt
-Version:        0.9.0
+Version:        0.10.1
 Release:        0
 %define mod_name fog-libvirt
 %define mod_full_name %{mod_name}-%{version}

++++++ fog-libvirt-0.9.0.gem -> fog-libvirt-0.10.1.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md       2021-07-16 16:46:49.000000000 +0200
+++ new/README.md       2022-12-02 12:25:26.000000000 +0100
@@ -18,6 +18,60 @@
 
 ## Usage
 
+Example REPL session:
+
+```
+>> require "fog/libvirt"
+=> true
+>> compute = Fog::Compute.new(provider: :libvirt, libvirt_uri: 
"qemu:///session")
+=> #<Fog::Libvirt::Compute::Real:46980 
@uri=#<Fog::Libvirt::Util::URI:0x0000000002def920 @parsed_uri=#<URI::Generic 
qemu:/session>, @uri="qemu:///session"...
+>> server = compute.servers.create(name: "test")
+=>
+  <Fog::Libvirt::Compute::Server
+    id="bbb663e4-723b-4165-bc29-c77b54b12bca",
+    cpus=1,
+    cputime=0,
+    os_type="hvm",
+    memory_size=262144,
+    max_memory_size=262144,
+    name="test",
+    arch="x86_64",
+    persistent=true,
+    domain_type="kvm",
+    uuid="bbb663e4-723b-4165-bc29-c77b54b12bca",
+    autostart=false,
+    nics=[    <Fog::Libvirt::Compute::Nic
+      mac="52:54:00:d1:18:23",
+      id=nil,
+      type="network",
+      network="default",
+      bridge=nil,
+      model="virtio"
+    >],
+    volumes=[    <Fog::Libvirt::Compute::Volume
+      id=nil,
+      pool_name="1Download",
+      key=nil,
+      name="test.img",
+      path="/home/lzap/1Download/test.img",
+      capacity="10G",
+      allocation="1G",
+      owner=nil,
+      group=nil,
+      format_type="raw",
+      backing_volume=nil
+    >],
+    active=false,
+    boot_order=["hd", "cdrom", "network"],
+    display={:type=>"vnc", :port=>"-1", :listen=>"127.0.0.1"},
+    cpu={},
+    hugepages=false,
+    guest_agent=true,
+    virtio_rng={},
+    state="shutoff"
+  >
+```
+
 See 
[README.md](https://github.com/fog/fog-libvirt/blob/master/lib/fog/libvirt/models/compute/README.md).
 
 ## Contributing
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fog-libvirt.gemspec new/fog-libvirt.gemspec
--- old/fog-libvirt.gemspec     2021-07-16 16:46:49.000000000 +0200
+++ new/fog-libvirt.gemspec     2022-12-02 12:25:26.000000000 +0100
@@ -40,7 +40,7 @@
   s.add_development_dependency("shindo", "~> 0.3.4")
   s.add_development_dependency("simplecov")
   s.add_development_dependency("yard")
-  s.add_development_dependency("mocha", "~> 1.13.0")
+  s.add_development_dependency("mocha", "~> 1.15.0")
 
   # Let's not ship dot files and gemfiles
   git_files = `git ls-files`.split("\n")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/fog/libvirt/models/compute/server.rb 
new/lib/fog/libvirt/models/compute/server.rb
--- old/lib/fog/libvirt/models/compute/server.rb        2021-07-16 
16:46:49.000000000 +0200
+++ new/lib/fog/libvirt/models/compute/server.rb        2022-12-02 
12:25:26.000000000 +0100
@@ -90,9 +90,13 @@
           volumes.first.path if volumes and volumes.first
         end
 
-        def destroy(options={ :destroy_volumes => false})
+        def destroy(options={ :destroy_volumes => false, :flags => 0 })
           poweroff unless stopped?
-          service.vm_action(uuid, :undefine)
+          if options[:flags].zero?
+            service.vm_action(uuid, :undefine)
+          else
+            service.vm_action(uuid, :undefine, options[:flags])
+          end
           volumes.each { |vol| vol.destroy } if options[:destroy_volumes]
           true
         end
@@ -407,13 +411,11 @@
           ip_address = nil
           nic = self.nics.find {|nic| nic.mac==mac}
           if !nic.nil?
-            service.networks.all.each do |net|
-              if net.name == nic.network
-                leases = net.dhcp_leases(mac, 0)
-                # Assume the lease expiring last is the current IP address
-                ip_address = leases.sort_by { |lse| lse["expirytime"] 
}.last["ipaddr"] if !leases.empty?
-                break
-              end
+            net = service.networks.all(:name => nic.network).first
+            if !net.nil?
+              leases = net.dhcp_leases(mac, 0)
+              # Assume the lease expiring last is the current IP address
+              ip_address = leases.sort_by { |lse| lse["expirytime"] 
}.last["ipaddr"] if !leases.empty?
             end
           end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/fog/libvirt/models/compute/templates/volume.xml.erb 
new/lib/fog/libvirt/models/compute/templates/volume.xml.erb
--- old/lib/fog/libvirt/models/compute/templates/volume.xml.erb 2021-07-16 
16:46:49.000000000 +0200
+++ new/lib/fog/libvirt/models/compute/templates/volume.xml.erb 2022-12-02 
12:25:26.000000000 +0100
@@ -20,8 +20,12 @@
           <path><%= backing_volume.path %></path>
           <format type="<%= backing_volume.format_type %>"/>
           <permissions>
+            <% if owner -%>
             <owner><%= owner %></owner>
+            <% end -%>
+            <% if group -%>
             <group><%= group %></group>
+            <% end -%>
             <mode>0744</mode>
             <label>virt_image_t</label>
           </permissions>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/fog/libvirt/requests/compute/list_domains.rb 
new/lib/fog/libvirt/requests/compute/list_domains.rb
--- old/lib/fog/libvirt/requests/compute/list_domains.rb        2021-07-16 
16:46:49.000000000 +0200
+++ new/lib/fog/libvirt/requests/compute/list_domains.rb        2022-12-02 
12:25:26.000000000 +0100
@@ -66,7 +66,7 @@
         end
 
         def domain_to_attributes(dom)
-          states= %w(nostate running blocked paused shutting-down shutoff 
crashed)
+          states= %w(nostate running blocked paused shutting-down shutoff 
crashed pmsuspended)
 
           begin
             {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/fog/libvirt/requests/compute/list_networks.rb 
new/lib/fog/libvirt/requests/compute/list_networks.rb
--- old/lib/fog/libvirt/requests/compute/list_networks.rb       2021-07-16 
16:46:49.000000000 +0200
+++ new/lib/fog/libvirt/requests/compute/list_networks.rb       2022-12-02 
12:25:26.000000000 +0100
@@ -44,8 +44,8 @@
       end
 
       class Mock
-        def list_networks(filters={ })
-          [ {
+        def list_networks(filter={ })
+          networks = [ {
               :uuid        => 'a29146ea-39b2-412d-8f53-239eef117a32',
               :name        => 'net1',
               :bridge_name => 'virbr0'
@@ -56,6 +56,16 @@
               :bridge_name => 'virbr1'
             }
           ]
+          return networks if filter.empty?
+
+          case filter.keys.first
+            when :uuid
+              [networks.find(:uuid => filter[:uuid]).first]
+            when :name
+              [networks.find(:name => filter[:name]).first]
+            else
+              networks
+          end
         end
       end
     end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/fog/libvirt/requests/compute/list_pools.rb 
new/lib/fog/libvirt/requests/compute/list_pools.rb
--- old/lib/fog/libvirt/requests/compute/list_pools.rb  2021-07-16 
16:46:49.000000000 +0200
+++ new/lib/fog/libvirt/requests/compute/list_pools.rb  2022-12-02 
12:25:26.000000000 +0100
@@ -1,23 +1,12 @@
 module Fog
   module Libvirt
     class Compute
-      class Real
-        def list_pools(filter = { })
-          data=[]
-          if filter.key?(:name)
-            data << find_pool_by_name(filter[:name])
-          elsif filter.key?(:uuid)
-            data << find_pool_by_uuid(filter[:uuid])
-          else
-            (client.list_storage_pools + 
client.list_defined_storage_pools).each do |name|
-              data << find_pool_by_name(name)
-            end
-          end
-          data.compact
-        end
-
+      module Shared
         private
-        def pool_to_attributes(pool)
+
+        def pool_to_attributes(pool, include_inactive = nil)
+          return nil unless pool.active? || include_inactive
+
           states=[:inactive, :building, :running, :degrated, :inaccessible]
           {
             :uuid           => pool.uuid,
@@ -27,25 +16,47 @@
             :name           => pool.name,
             :allocation     => pool.info.allocation,
             :capacity       => pool.info.capacity,
-            :num_of_volumes => pool.num_of_volumes,
+            :num_of_volumes => pool.active? ? pool.num_of_volumes : nil,
             :state          => states[pool.info.state]
           }
         end
+      end
 
-        def find_pool_by_name name
-          pool_to_attributes(client.lookup_storage_pool_by_name(name))
+      class Real
+        include Shared
+
+        def list_pools(filter = { })
+          data=[]
+          if filter.key?(:name)
+            data << find_pool_by_name(filter[:name], filter[:include_inactive])
+          elsif filter.key?(:uuid)
+            data << find_pool_by_uuid(filter[:uuid], filter[:include_inactive])
+          else
+            (client.list_storage_pools + 
client.list_defined_storage_pools).each do |name|
+              data << find_pool_by_name(name, filter[:include_inactive])
+            end
+          end
+          data.compact
+        end
+
+        private
+
+        def find_pool_by_name name, include_inactive
+          pool_to_attributes(client.lookup_storage_pool_by_name(name), 
include_inactive)
         rescue ::Libvirt::RetrieveError
           nil
         end
 
-        def find_pool_by_uuid uuid
-          pool_to_attributes(client.lookup_storage_pool_by_uuid(uuid))
+        def find_pool_by_uuid uuid, include_inactive
+          pool_to_attributes(client.lookup_storage_pool_by_uuid(uuid), 
include_inactive)
         rescue ::Libvirt::RetrieveError
           nil
         end
       end
 
       class Mock
+        include Shared
+
         def list_pools(filter = { })
           pool1 = mock_pool 'pool1'
           pool2 = mock_pool 'pool1'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/fog/libvirt/requests/compute/vm_action.rb 
new/lib/fog/libvirt/requests/compute/vm_action.rb
--- old/lib/fog/libvirt/requests/compute/vm_action.rb   2021-07-16 
16:46:49.000000000 +0200
+++ new/lib/fog/libvirt/requests/compute/vm_action.rb   2022-12-02 
12:25:26.000000000 +0100
@@ -2,15 +2,15 @@
   module Libvirt
     class Compute
       class Real
-        def vm_action(uuid, action)
+        def vm_action(uuid, action, *params)
           domain = client.lookup_domain_by_uuid(uuid)
-          domain.send(action)
+          domain.send(action, *params)
           true
         end
       end
 
       class Mock
-        def vm_action(uuid, action)
+        def vm_action(uuid, action, *params)
           true
         end
       end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/fog/libvirt/version.rb 
new/lib/fog/libvirt/version.rb
--- old/lib/fog/libvirt/version.rb      2021-07-16 16:46:49.000000000 +0200
+++ new/lib/fog/libvirt/version.rb      2022-12-02 12:25:26.000000000 +0100
@@ -1,5 +1,5 @@
 module Fog
   module Libvirt
-    VERSION = '0.9.0'
+    VERSION = '0.10.1'
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2021-07-16 16:46:49.000000000 +0200
+++ new/metadata        2022-12-02 12:25:26.000000000 +0100
@@ -1,14 +1,14 @@
 --- !ruby/object:Gem::Specification
 name: fog-libvirt
 version: !ruby/object:Gem::Version
-  version: 0.9.0
+  version: 0.10.1
 platform: ruby
 authors:
 - geemus (Wesley Beary)
 autorequire:
 bindir: bin
 cert_chain: []
-date: 2021-07-16 00:00:00.000000000 Z
+date: 2022-12-02 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: fog-core
@@ -212,14 +212,14 @@
     requirements:
     - - "~>"
       - !ruby/object:Gem::Version
-        version: 1.13.0
+        version: 1.15.0
   type: :development
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
     requirements:
     - - "~>"
       - !ruby/object:Gem::Version
-        version: 1.13.0
+        version: 1.15.0
 description: This library can be used as a module for 'fog' or as standalone 
libvirt
   provider.
 email: [email protected]
@@ -306,6 +306,7 @@
 - tests/libvirt/requests/compute/create_domain_tests.rb
 - tests/libvirt/requests/compute/define_domain_tests.rb
 - tests/libvirt/requests/compute/dhcp_leases_tests.rb
+- tests/libvirt/requests/compute/list_pools_tests.rb
 - tests/libvirt/requests/compute/update_autostart_tests.rb
 - tests/libvirt/requests/compute/update_display.rb
 homepage: http://github.com/fog/fog-libvirt
@@ -328,7 +329,7 @@
     - !ruby/object:Gem::Version
       version: '0'
 requirements: []
-rubygems_version: 3.2.15
+rubygems_version: 3.3.7
 signing_key:
 specification_version: 2
 summary: Module for the 'fog' gem to support libvirt
@@ -354,5 +355,6 @@
 - tests/libvirt/requests/compute/create_domain_tests.rb
 - tests/libvirt/requests/compute/define_domain_tests.rb
 - tests/libvirt/requests/compute/dhcp_leases_tests.rb
+- tests/libvirt/requests/compute/list_pools_tests.rb
 - tests/libvirt/requests/compute/update_autostart_tests.rb
 - tests/libvirt/requests/compute/update_display.rb
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tests/libvirt/requests/compute/list_pools_tests.rb 
new/tests/libvirt/requests/compute/list_pools_tests.rb
--- old/tests/libvirt/requests/compute/list_pools_tests.rb      1970-01-01 
01:00:00.000000000 +0100
+++ new/tests/libvirt/requests/compute/list_pools_tests.rb      2022-12-02 
12:25:26.000000000 +0100
@@ -0,0 +1,71 @@
+class FakePool < Fog::Model
+  # Fake pool object to allow exercising the internal parsing of pools
+  # returned by the client queries
+  identity :uuid
+
+  attribute :persistent
+  attribute :autostart
+  attribute :active
+  attribute :name
+  attribute :num_of_volumes
+  attr_reader :info
+
+  class FakeInfo < Fog::Model
+    attribute :allocation
+    attribute :capacity
+    attribute :state
+  end
+
+  def initialize(attributes = {})
+    @info = FakeInfo.new(attributes.dup.delete(:info))
+    super(attributes)
+  end
+
+  def active?
+    active
+  end
+
+  def autostart?
+    autostart
+  end
+
+  def persistent?
+    persistent
+  end
+end
+
+Shindo.tests("Fog::Compute[:libvirt] | list_pools request", 'libvirt') do
+
+  compute = Fog::Compute[:libvirt]
+
+  tests("Lists Pools") do
+    response = compute.list_pools
+    test("should be an array") { response.kind_of? Array }
+    test("should have two pools") { response.length == 2 }
+  end
+
+  tests("Handle Inactive Pools") do
+    inactive_pool = {
+      :uuid => 'pool.uuid',
+      :persistent => true,
+      :autostart => true,
+      :active => false,
+      :name => 'inactive_pool1',
+      :info => {
+        :allocation => 123456789,
+        :capacity => 123456789,
+        :state => 2 # running
+      },
+      :num_of_volumes => 3
+    }
+
+    response = compute.send(:pool_to_attributes, FakePool.new(inactive_pool), 
true)
+
+    test("should be hash of attributes") { response.kind_of? Hash }
+
+    response = compute.send(:pool_to_attributes, FakePool.new(inactive_pool))
+
+    test("should be nil") { response.nil? }
+
+  end
+end

Reply via email to