Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mishandling of unsupported storage pool types #195

Closed
aglitke opened this issue Oct 10, 2013 · 5 comments
Closed

Mishandling of unsupported storage pool types #195

aglitke opened this issue Oct 10, 2013 · 5 comments
Assignees
Labels
Milestone

Comments

@aglitke
Copy link
Member

aglitke commented Oct 10, 2013

I'm testing Kimchi on a CentOS 6.3 server where I have a few VMs
running Linux, as an alternative to virt-manager. Kimchi is beautiful,
but so far I want only to use it to monitor my VMs, and Kimchi seems
limited. Besides basic CPU/Memory/IO stats on the first tab, there's
no VM details and no way to change a VM config.

When I select the third tab (Storage) and click the "down" icon to
expand details about my storage pools, I get an error "Error listing
storage pool" (in portuguese, as I did a git pull right now) and the
following messages in log:

[10/Oct/2013:14:53:19] HTTP
Request Headers:
  COOKIE: kimchi=5943a3575d3bec73ab18226b4e4a00518f18fae1; userid=root
  HOST: kvmhost:8000
  CONNECTION: keep-alive
  Remote-Addr: 192.168.0.143
  ACCEPT: application/json, text/javascript, */*; q=0.01
  USER-AGENT: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0)
Gecko/20100101 Firefox/24.0
  X-REQUESTED-WITH: XMLHttpRequest
  ACCEPT-LANGUAGE: pt-BR,pt;q=0.8,en-US;q=0.5,en;q=0.3
  Content-Type: application/json
  REFERER: http://kvmhost:8000/
  ACCEPT-ENCODING: gzip, deflate
INFO:cherrypy.error.28851920:[10/Oct/2013:14:53:19] HTTP
Request Headers:
  COOKIE: kimchi=5943a3575d3bec73ab18226b4e4a00518f18fae1; userid=root
  HOST: kvmhost:8000
  CONNECTION: keep-alive
  Remote-Addr: 192.168.0.143
  ACCEPT: application/json, text/javascript, */*; q=0.01
  USER-AGENT: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0)
Gecko/20100101 Firefox/24.0
  X-REQUESTED-WITH: XMLHttpRequest
  ACCEPT-LANGUAGE: pt-BR,pt;q=0.8,en-US;q=0.5,en;q=0.3
  Content-Type: application/json
  REFERER: http://kvmhost:8000/
  ACCEPT-ENCODING: gzip, deflate
[10/Oct/2013:14:53:19] HTTP Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/cherrypy/_cprequest.py", line
656, in respond
    response.body = self.handler()
  File "/usr/lib/python2.6/site-packages/cherrypy/lib/encoding.py",
line 188, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/cherrypy/_cpdispatch.py",
line 34, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/home/lozano/kimchi-trunk/src/kimchi/controller.py", line 276,
in index
    return self.get()
  File "/home/lozano/kimchi-trunk/src/kimchi/controller.py", line 265,
in get
    resources = self._get_resources()
  File "/home/lozano/kimchi-trunk/src/kimchi/controller.py", line 251,
in _get_resources
    res.lookup()
  File "/home/lozano/kimchi-trunk/src/kimchi/controller.py", line 130,
in lookup
    self.info = lookup(*self.model_args)
  File "/home/lozano/kimchi-trunk/src/kimchi/model.py", line 681, in
storagevolume_lookup
    fmt = xmlutils.xpath_get_text(xml, "/volume/target/format/@type")[0]
IndexError: list index out of range

ERROR:cherrypy.error.28851920:[10/Oct/2013:14:53:19] HTTP Traceback
(most recent call last):
  File "/usr/lib/python2.6/site-packages/cherrypy/_cprequest.py", line
656, in respond
    response.body = self.handler()
  File "/usr/lib/python2.6/site-packages/cherrypy/lib/encoding.py",
line 188, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/cherrypy/_cpdispatch.py",
line 34, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/home/lozano/kimchi-trunk/src/kimchi/controller.py", line 276,
in index
    return self.get()
  File "/home/lozano/kimchi-trunk/src/kimchi/controller.py", line 265,
in get
    resources = self._get_resources()
  File "/home/lozano/kimchi-trunk/src/kimchi/controller.py", line 251,
in _get_resources
    res.lookup()
  File "/home/lozano/kimchi-trunk/src/kimchi/controller.py", line 130,
in lookup
    self.info = lookup(*self.model_args)
  File "/home/lozano/kimchi-trunk/src/kimchi/model.py", line 681, in
storagevolume_lookup
    fmt = xmlutils.xpath_get_text(xml, "/volume/target/format/@type")[0]
IndexError: list index out of range

192.168.0.143 - root [10/Oct/2013:14:53:19] "GET
/storagepools/lvm/storagevolumes HTTP/1.1" 500 1285
"http://kvmhost:8000/" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0)
Gecko/20100101 Firefox/24.0"
INFO:cherrypy.access.28851920:192.168.0.143 - root
[10/Oct/2013:14:53:19] "GET /storagepools/lvm/storagevolumes HTTP/1.1"
500 1285 "http://kvmhost:8000/" "Mozilla/5.0 (Windows NT 6.1; WOW64;
rv:24.0) Gecko/20100101 Firefox/24.0"
192.168.0.143 - - [10/Oct/2013:14:53:24] "GET /storagepool-add.html
HTTP/1.1" 200 1548 "http://kvmhost:8000/" "Mozilla/5.0 (Windows NT
6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0"
INFO:cherrypy.access.28851920:192.168.0.143 - - [10/Oct/2013:14:53:24]
"GET /storagepool-add.html HTTP/1.1" 200 1548 "http://kvmhost:8000/"
"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101
Firefox/24.0"

The pool that generated the error above is an LVM-based pool, but I
get the same error (didn't checked if the logs look the same) for all
my storage pools: one is the standard /var/lib/libvirt/images and the
other is "kimchi_isos"

The CentOS server runs with SELinux enforcing. The login on the web
frontent was made as "root", and kimchi was also running as "root".

Keep up improving Kimchi, I hope soon it's provide a real alternative
to virt-manager.

@aglitke
Copy link
Member Author

aglitke commented Oct 10, 2013

Thanks for reporting this!

This is an error on our XPATH expression parsing when handling volume
information retrieval from storage pools of types other than 'dir'. We
expect all libvirt StorageVolume objects to have a format but according
to the libvirt docs [1], the logical pool type does not support the
format attribute for Storage Volumes.

The fix would be to catch IndexError and set the format to None. Would
you be interested in submitting a patch for this issue?

[1] http://libvirt.org/storage.html#StorageBackendLogical

@shaohef
Copy link

shaohef commented Oct 13, 2013

so we should support "logical" pool?

@aglitke
Copy link
Member Author

aglitke commented Oct 14, 2013

I don't think we are going to support creation of them, but we will probably want to interoperate with them.

@ghost ghost assigned lvroyce Dec 11, 2013
@shaohef
Copy link

shaohef commented Mar 6, 2014

now zhengsheng send a patch to fix this problem.
[PATCH v2] storage volume: fix xml parsing of logical volume format type

@alinefm
Copy link
Member

alinefm commented Mar 7, 2014

Fixed by 34a6073

@alinefm alinefm closed this as completed Mar 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants