satis egitimisatis egitimitengda.pro

Making Clouds,without dying in the attemp

This blog is oriented to a young Cloud Engineer.

  • Home
    Home This is where you can find all the blog posts throughout the site.
  • Categories
    Categories Displays a list of categories from this blog.
  • Tags
    Tags Displays a list of tags that has been used in the blog.
  • Bloggers
    Bloggers Search for your favorite blogger from this site.
  • Login
Posted by on in CloudStack Tips
  • Font size: Larger Smaller
  • Hits: 42480
  • Print
  • Report this post

How to Change the User owner for a VM Instance.

this tips will be useful especially in the test and evaluation stage from a CloudStack project.

ok, here we go!

The resource_count table contains the quantity of  user_vm, public_ip, volume, snapshot,  template and the first acction is add the user_vm and volumes to another account, here's a example.

mysql> select * from resource_count where account_id = 22;
+-------+-------------+--------------+----------------+--------+
| id  | account_id | domain_id | type    |count |
+-------+-------------+--------------+----------------+--------+
| 151 |         22 |      NULL | user_vm   |     1  |
| 152 |         22 |      NULL | public_ip  |     0  |
| 153 |         22 |      NULL | volume     |     2  |
| 154 |         22 |      NULL | snapshot  |     0  |
| 155 |         22 |      NULL | template   |     0  |

+-------+-------------+--------------+----------------+--------+
5 rows in set (0.00 sec)

mysql> select * from resource_count where account_id = 5;
+----+-------------+----------------+----------------+-------+
| id | account_id | domain_id | type      |count|
+-----+------------+----------------+----------------+-------+
| 36 |          5 |        NULL | user_vm      |     9 |
| 37 |          5 |        NULL | public_ip      |    0 |
| 38 |          5 |        NULL | volume        |   20 |
| 39 |          5 |        NULL | snapshot     |     1 |
| 40 |          5 |        NULL | template      |     0 |
+-----+------------+-----------------+------------------+-------+
5 rows in set (0.00 sec)

Now, add the user_vm to account_id = 22 to account_id = 5

mysql> update resource_count set  user_vm = 10 where id = 36;

Then, subtract the  user_vm to the account_id = 22

mysql> update resource_count set  user_vm = 0 where id = 151;

and do the same with volume and  snapshot ... but in this case don't have.

mysql> update resource_count set  volume= 22 where id = 38;

and subtract...

mysql> update resource_count set  volume= 0 where id = 153;

now we must move the security group;

for this we must have the name in the vm

mysql> select * from user_vm;

 in this table we have to localize the name of the vm instance in the display_name and with this, get the id.

and with the id we do the update

for example:

mysql> update security_group_vm_map set security_group_id = 2 where instance_id = 32;

I hope this is useful.

Rate this blog entry:
I'm a Senior Enginner from Chile, and i have a great experience making cloud platform with Citrix products, and OpenSource.
  • No comments made yet. Be the first to submit a comment

Leave your comment

Guest Saturday, 19 July 2014

Open@Citrix

Citrix supports the open source community via developer support and evangeslism. We have a number of developers and evangelists that participate actively in the open source community in Apache Cloudstack, OpenDaylight, Xen Project and XenServer. We also conduct educational activities via the Build A Cloud events held all over the world. 

Connect