[one-users] OCA API / deleting user
Piotr Kandziora
raveenpl at gmail.com
Thu Feb 3 15:06:10 PST 2011
Hi,
I have been performing tests with OpenNebula and noticed that using command
line I am not able to delete user while it has some VMs running (it is ok).
But, using OCA API this operation is possible and causes some strange
behaviour. Details below:
a) using command line (deleting user test11 is not possible, because it has
running one-4014 vm instance):
oneadmin at main:~$ oneuser list
ID USER PASSWORD
0 oneadmin 4ff88aaddbd209d8026924c2cc2836b408698823
3 test11 4ff88aaddbd209d8026924c2cc2836b408698823
oneadmin at main:~$ onevm list
ID USER NAME STAT CPU MEM HOSTNAME TIME
4014 test11 one-4014 runn 0 0K root24 00 00:00:32
oneadmin at main:~$ oneuser delete 3
The user 3 still has VMs defined, aborting user delete.
b) using OCA API (in my case Python OCA API):
So, I am deleting user 'test11' using following code:
#!/usr/bin/python
import oca
c = oca.Client('oneadmin:free','http://localhost:2633/RPC2')
usr = oca.user.UserPool(c)
usr.info(oca.ALL)
for i in usr:
if i.name == 'test11':
i.delete()
After it command 'onevm list' returns output:
oneadmin at main:~$ onevm list
ID USER NAME STAT CPU MEM HOSTNAME TIME
/usr/lib/one/ruby/client_utilities.rb:143:in `Float': invalid value for
Float(): "" (ArgumentError)
from /usr/lib/one/ruby/client_utilities.rb:143:in `data_str'
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `collect'
from /usr/lib/one/ruby/client_utilities.rb:139:in `each'
from /usr/lib/one/ruby/client_utilities.rb:139:in `collect'
from /usr/lib/one/ruby/client_utilities.rb:139:in `data_str'
from /usr/lib/one/ruby/client_utilities.rb:138:in `collect'
from /usr/lib/one/ruby/client_utilities.rb:138:in `data_str'
from /usr/bin/onevm:208:in `list_short'
from /usr/bin/onevm:682
At this moment I am not able to perform any action using onevm command.
In this situation I had to fix it by manual modifcation in vm_pool table in
opennebula database (I removed records that belonged to deleted user).
Question is following: Do I have to ensure before deleting user that it does
not have any running VM instances? Or this is unplanned behaviour and should
be fixed?
I am using OpenNebula version 2.0.1.
Best regards
Piotr Kandziora
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20110204/ef7cb3cc/attachment.htm>
More information about the Users
mailing list