← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1357437] [NEW] nova.tests.virt.libvirt.test_driver should use constants from fakelibvirt

 

Public bug reported:

Commit f0883800660ab546f5667b973f339c4df4c5c458 adds some tests and new
constants for _swap_volume and _live_snapshot, one of which is
VIR_DOMAIN_BLOCK_REBASE_COPY.  It adds the required constants to the
fakelibvirt module but doesn't use them when making assertions in the
test, which can fail if you're not using fakelibvirt but not using a new
enough version of libvirt on your system.

I realize that we now require libvirt-python >= 1.2.5 for testing, but
that requires libvirt >= 0.9.11 and if you're on 0.9.11 it doesn't have
VIR_DOMAIN_BLOCK_REBASE_COPY  defined in libvirt.h.in:

http://libvirt.org/git/?p=libvirt.git;a=blob;f=include/libvirt/libvirt.h.in;h=499dcd4514bf793b531e53496c56237fb055e1ba;hb=782afa98e4a5fa9a0927a9e32f9cf36082a2e8e7

It seems kind of strange to me that we use constants directly from the
libvirt module at all in test_driver given the import conditional check
at the top of the module:

http://git.openstack.org/cgit/openstack/nova/tree/nova/tests/virt/libvirt/test_driver.py#n88

try:
    import libvirt
except ImportError:
    libvirt = fakelibvirt
libvirt_driver.libvirt = libvirt

Given that, any change that requires testing new constants from libvirt
should be in fakelibvirt, and we should use fakelibvirt when using those
constants in the tests, otherwise the "unit" tests are really dependent
on your environment.

** Affects: nova
     Importance: Undecided
         Status: Triaged


** Tags: libvirt testing

** Changed in: nova
       Status: New => Triaged

** Description changed:

- Commit f0883800660ab546f5667b973f339c4df4c5c458 adds some tests for
- _swap_volume and _live_snapshot, one of which is
+ Commit f0883800660ab546f5667b973f339c4df4c5c458 adds some tests and new
+ constants for _swap_volume and _live_snapshot, one of which is
  VIR_DOMAIN_BLOCK_REBASE_COPY.  It adds the required constants to the
  fakelibvirt module but doesn't use them when making assertions in the
  test, which can fail if you're not using fakelibvirt but not using a new
  enough version of libvirt on your system.
  
  I realize that we now require libvirt-python >= 1.2.5 for testing, but
  that requires libvirt >= 0.9.11 and if you're on 0.9.11 it doesn't have
  VIR_DOMAIN_BLOCK_REBASE_COPY  defined in libvirt.h.in:
  
  http://libvirt.org/git/?p=libvirt.git;a=blob;f=include/libvirt/libvirt.h.in;h=499dcd4514bf793b531e53496c56237fb055e1ba;hb=782afa98e4a5fa9a0927a9e32f9cf36082a2e8e7
  
  It seems kind of strange to me that we use constants directly from the
  libvirt module at all in test_driver given the import conditional check
  at the top of the module:
  
  http://git.openstack.org/cgit/openstack/nova/tree/nova/tests/virt/libvirt/test_driver.py#n88
  
  try:
-     import libvirt
+     import libvirt
  except ImportError:
-     libvirt = fakelibvirt
+     libvirt = fakelibvirt
  libvirt_driver.libvirt = libvirt
  
  Given that, any change that requires testing new constants from libvirt
  should be in fakelibvirt, and we should use fakelibvirt when using those
  constants in the tests, otherwise the "unit" tests are really dependent
  on your environment.

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1357437

Title:
  nova.tests.virt.libvirt.test_driver should use constants from
  fakelibvirt

Status in OpenStack Compute (Nova):
  Triaged

Bug description:
  Commit f0883800660ab546f5667b973f339c4df4c5c458 adds some tests and
  new constants for _swap_volume and _live_snapshot, one of which is
  VIR_DOMAIN_BLOCK_REBASE_COPY.  It adds the required constants to the
  fakelibvirt module but doesn't use them when making assertions in the
  test, which can fail if you're not using fakelibvirt but not using a
  new enough version of libvirt on your system.

  I realize that we now require libvirt-python >= 1.2.5 for testing, but
  that requires libvirt >= 0.9.11 and if you're on 0.9.11 it doesn't
  have VIR_DOMAIN_BLOCK_REBASE_COPY  defined in libvirt.h.in:

  http://libvirt.org/git/?p=libvirt.git;a=blob;f=include/libvirt/libvirt.h.in;h=499dcd4514bf793b531e53496c56237fb055e1ba;hb=782afa98e4a5fa9a0927a9e32f9cf36082a2e8e7

  It seems kind of strange to me that we use constants directly from the
  libvirt module at all in test_driver given the import conditional
  check at the top of the module:

  http://git.openstack.org/cgit/openstack/nova/tree/nova/tests/virt/libvirt/test_driver.py#n88

  try:
      import libvirt
  except ImportError:
      libvirt = fakelibvirt
  libvirt_driver.libvirt = libvirt

  Given that, any change that requires testing new constants from
  libvirt should be in fakelibvirt, and we should use fakelibvirt when
  using those constants in the tests, otherwise the "unit" tests are
  really dependent on your environment.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1357437/+subscriptions


Follow ups

References