In the WebUI, I saw no NIC associated with the machine (maybe the user deleted 
it?).  So I went ahead and added one:

mysql> select * from nics where instance_id='2071';
+------+--------------------------------------+-------------+-------------------+---------------+---------------+--------------+---------+---------------+------------+------+-----------+----------+-------------------+----------------+-----------+---------------------+---------------+-------------+-------------+---------+---------------------+---------+-------------+----------+--------------+-------------+
| id   | uuid                                 | instance_id | mac_address       
| ip4_address   | netmask       | gateway      | ip_type | broadcast_uri | 
network_id | mode | state     | strategy | reserver_name     | reservation_id | 
device_id | update_time         | isolation_uri | ip6_address | default_nic | 
vm_type | created             | removed | ip6_gateway | ip6_cidr | secondary_ip 
| display_nic |
+------+--------------------------------------+-------------+-------------------+---------------+---------------+--------------+---------+---------------+------------+------+-----------+----------+-------------------+----------------+-----------+---------------------+---------------+-------------+-------------+---------+---------------------+---------+-------------+----------+--------------+-------------+
| 2793 | 84566500-6a7e-4c3a-8035-d4b98f1ecebe |        101 | 06:50:a2:00:0a:ab 
| 10.1.131.11 | 255.255.254.0 | 10.1.130.1 | Ip4     | vlan://111   |        
206 | Dhcp | Allocated | Create   | DirectNetworkGuru | NULL           |        
 0 | 2015-04-14 09:01:30 | vlan://111   | NULL        |           0 | User    | 
2015-04-14 16:01:30 | NULL    | NULL        | NULL     |            0 |         
  1 |
+------+--------------------------------------+-------------+-------------------+---------------+---------------+--------------+---------+---------------+------------+------+-----------+----------+-------------------+----------------+-----------+---------------------+---------------+-------------+-------------+---------+---------------------+---------+-------------+----------+--------------+-------------+



However, the IP address assigned in the nics table doesn't match the one in the 
vm_instance table:


mysql> select id,name,private_ip_address from vm_instance where name='myhost';  
                                                                                
                 +------+--------------------+--------------------+
| id   | name               | private_ip_address |
+------+--------------------+--------------------+
| 101 | myhost | 10.1.131.0       |
+------+--------------------+--------------------+
1 row in set (0.00 sec)


Shouldn't that IP have been updated as well?


-----Original Message-----
From: Jayapal Reddy Uradi [mailto:jayapalreddy.ur...@citrix.com] 
Sent: Monday, April 13, 2015 9:47 PM
To: <users@cloudstack.apache.org>
Subject: Re: CloudStack hands out IP address of a stopped VM

Hi Kyle,

My suggestion is take nic entry of the vm which is removed (in the same 
network) and edit it for your VM.
While editing take care of the values of instance_id, ip, mac_address, state, 
default_nic, removed, display_nic and strategy columns.


Thanks,
Jayapal

On 14-Apr-2015, at 9:18 AM, Sanjeev N <sanj...@apache.org> wrote:

> When a vm is in expunging state, NIC table entry should be marked as 
> removed in DB. If you are sure about the IP address rendered by CS to 
> the VM , you can try adding the entry in db.
> 
> On Tue, Apr 14, 2015 at 2:45 AM, Kyle Flavin <kyle.fla...@citrix.com> wrote:
> 
>> Jayapal,
>> Is it safe for me to attempt to re-add the entry through the 
>> database, since the VM is still in use?
>> 
>> Also, I've noticed that there are expunged VM's with entries still in 
>> the NIC table.  Should that be the case?  Or should the record have 
>> been removed when the VM was deleted?
>> 
>> -----Original Message-----
>> From: Jayapal Reddy Uradi [mailto:jayapalreddy.ur...@citrix.com]
>> Sent: Sunday, April 12, 2015 10:24 PM
>> To: <users@cloudstack.apache.org>
>> Subject: Re: CloudStack hands out IP address of a stopped VM
>> 
>> Hi Kyle,
>> 
>> Cloudstack won't delete the nic entry, When VM is deleted it marked 
>> as removed.
>> It might be deleted manually from the DB.
>> 
>> Thanks,
>> Jayapal
>> 
>> 
>> On 11-Apr-2015, at 1:49 AM, Kyle Flavin <kyle.fla...@citrix.com> wrote:
>> 
>>> Jayapal,
>>> Is there a reason why would the nic entry be empty?  When is the 
>>> entry
>> cleared?  It looks like it must have been cleared after the VM was stopped.
>>> 
>>> -----Original Message-----
>>> From: Jayapal Reddy Uradi [mailto:jayapalreddy.ur...@citrix.com]
>>> Sent: Thursday, April 09, 2015 9:01 PM
>>> To: <users@cloudstack.apache.org>
>>> Subject: Re: CloudStack hands out IP address of a stopped VM
>>> 
>>> Hi Kyle,
>>> 
>>> When CS picks the ip for new vm from free ip pool excluding nic 
>>> table
>> ip4_adress.
>>> In your case the nic entry for vm is empty due to this the ip will 
>>> goes
>> free pool.
>>> 
>>> 
>>> Thanks,
>>> Jayapal
>>> 
>>> On 10-Apr-2015, at 9:20 AM, Sanjeev N <sanj...@apache.org>
>>> wrote:
>>> 
>>>> CS would not hand out the IPs of a stopped vm since the lease time 
>>>> is infinite. If you are able to reproduce is consistently please 
>>>> open a JIRA ticket.
>>>> 
>>>> On Fri, Apr 10, 2015 at 4:17 AM, Kyle Flavin 
>>>> <kyle.fla...@citrix.com>
>> wrote:
>>>> 
>>>>> Hi Jayapal,
>>>>> The first query against the nics table returned an empty set, 
>>>>> while the second returned the hostname and IP address.  Here is 
>>>>> the sanitized output from both queries:
>>>>> 
>>>>> 
>>>>> mysql> select instance_id,ip4_address  from nics where 
>>>>> mysql> instance_id=<id>;
>>>>> Empty set (0.00 sec)
>>>>> 
>>>>> 
>>>>> mysql> select id, name, private_ip_address  from vm_instance  
>>>>> mysql> where
>>>>> id=<id>;
>>>>> +------+--------------------+--------------------+
>>>>> | id   | name               | private_ip_address |
>>>>> +------+--------------------+--------------------+
>>>>> | myid | myhostname | 1.1.1.1       |
>>>>> +------+--------------------+--------------------+
>>>>> 1 row in set (0.00 sec)
>>>>> 
>>>>> 
>>>>> 
>>>>> -----Original Message-----
>>>>> From: Jayapal Reddy Uradi [mailto:jayapalreddy.ur...@citrix.com]
>>>>> Sent: Thursday, April 09, 2015 5:32 AM
>>>>> To: <users@cloudstack.apache.org>
>>>>> Subject: Re: CloudStack hands out IP address of a stopped VM
>>>>> 
>>>>> Hi Kyle,
>>>>> 
>>>>> In my setup I have observed this for stopped VM, the nic table 
>>>>> ip4_address set to 'null'.
>>>>> After that I am not able to reproduce the issue.
>>>>> I will keep looking into my setup for this issue.
>>>>> 
>>>>> Can you please send the below commands output from your setup.
>>>>> 
>>>>> #select instance_id,ip4_address  from nics where instance_id= 
>>>>> <instance_id>; #select id, name, private_ip_address  from 
>>>>> vm_instance where id=<id>;
>>>>> 
>>>>> 
>>>>> 
>>>>> Thanks,
>>>>> Jayapal
>>>>> 
>>>>> On 09-Apr-2015, at 6:10 AM, Kyle Flavin <kyle.fla...@citrix.com>
>> wrote:
>>>>> 
>>>>>> I'm trying to get some help understanding the following behavior.
>>>>>> 
>>>>>> Yesterday we had an instance of CloudStack giving out the IP 
>>>>>> address of
>>>>> a stopped VM to a newly created VM.  The existing server was found 
>>>>> in the MySQL database with the assigned IP (sanitized outputs):
>>>>>> 
>>>>>> mysql> select name,private_ip_address,state  from vm_instance 
>>>>>> mysql> where name like "<myhost>%";
>>>>>> +--------------------+--------------------+---------+
>>>>>> | name               | private_ip_address | state   |
>>>>>> +--------------------+--------------------+---------+
>>>>>> | <myhost> | 1.1.1.1       | Stopped |
>>>>>> +--------------------+--------------------+---------+
>>>>>> 
>>>>>> The new server booted up, and was given that same 1.1.1.1 IP as 
>>>>>> well,
>>>>> which caused a conflict in our external host management system.
>>>>>> 
>>>>>> It looks to me like the DHCP lease is expiring on the stopped VM, 
>>>>>> and
>>>>> then CloudStack is just handing it out again.  However, it had 
>>>>> previously been explained to me that CloudStack would not hand out 
>>>>> IP's of stopped VM's (and I do see the IP address registered to 
>>>>> the VM
>> in the database).
>>>>> Is that true and is this a possible bug, or is that the expected
>> behavior?
>>>>>> 
>>>>>> -Kyle
>>>>> 
>>>>> 
>>> 
>> 
>> 

Reply via email to