apache / cloudstack

Apache CloudStack is an opensource Infrastructure as a Service (IaaS) cloud computing platform
https://cloudstack.apache.org/
Apache License 2.0
2k stars 1.09k forks source link

Release public Ip of System VMs should FAIL #9275

Closed weizhouapache closed 3 months ago

weizhouapache commented 3 months ago

Try to release the public IP of system vm

Prior

image

remove

image

After

image

ISSUE TYPE
COMPONENT NAME
CLOUDSTACK VERSION
CONFIGURATION
OS / ENVIRONMENT
SUMMARY
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS
weizhouapache commented 3 months ago

@DaanHoogland @sureshanaparti this seems to be critical issue

weizhouapache commented 3 months ago

rollback

update user_ip_address set account_id=1,domain_id=1,allocated=now(),state='Allocated' where public_ip_address='10.0.x.x';
sureshanaparti commented 3 months ago

@DaanHoogland @sureshanaparti this seems to be critical issue

@weizhouapache Is this working as expected, in 4.18?

weizhouapache commented 3 months ago

@DaanHoogland @sureshanaparti this seems to be critical issue

@weizhouapache Is this working as expected, in 4.18?

@sureshanaparti unfortunately, 4.18 has the same issue

shwstppr commented 3 months ago

@weizhouapache @sureshanaparti @DaanHoogland if you're not already looking into this, I can have a look tomorrow

DaanHoogland commented 3 months ago

there is

        // don't allow releasing system ip address
        if (ipVO.getSystem()) {
            throwInvalidIdException("Can't release system IP address with specified id", ipVO.getUuid(), "systemIpAddrId");
        }

in the disassociateIpAddress handler of NetworkService, releaseIpAddress. And i checked the DB, something is going wrong in the aquiring of user_ip_adresses for system vms. No isSystem flag is set or even account, allocated time or even state (this one remains Free). I am still looking where to fix it but it seems to me that allocating an IP for a SVM should set the is_system flag on the record. I tested that by a DB hack and it indeed does the trick.

Of course unsetting the flag needs to happen as well when releasing/destroying the SVM.

It looks to me that this needs to happen in finalizeStart, and finalizeStop of SecondaryStorageManagerImpl respectively.

I can test this tomorrow @shwstppr, unless you think that a better implementation is possible. cc @weizhouapache @sureshanaparti

DaanHoogland commented 3 months ago

created #9281 for this but so far it only solves it for SSVM (and not yet tested)

sureshanaparti commented 3 months ago

Fixed in #9281