[one-users] OpenNbula 3.0 migration: problem with onedb

Carlos Martín Sánchez cmartin at opennebula.org
Tue Oct 18 05:25:35 PDT 2011


I don't see any other reasons why this could fail... Could you edit
/usr/lib/one/ruby/onedb/onedb_backend.rb to output some more info?

Just add the Exception message to the rescue clause in db_exists?

    def db_exists?
        begin
            # User with ID 0 (oneadmin) always exists
            @db.fetch("SELECT * FROM user_pool WHERE oid=0") { |row| }
            return true
        rescue Exception => e
            puts e.message
            return false
        end
    end

Thank you
--
Carlos Martín, MSc
Project Engineer
OpenNebula - The Open Source Toolkit for Cloud Computing
www.OpenNebula.org <http://www.opennebula.org/> | cmartin at opennebula.org


2011/10/18 Ruben Diez <rdiez at cesga.es>

> Yes: it is populated:
>
> mysql> select * from user_pool where oid=0;
> +-----+-----------+-----------**------------------------------**
> -+---------+
> | oid | user_name | password                                 | enabled |
> +-----+-----------+-----------**------------------------------**
> -+---------+
> |   0 | oneadmin  | 8944aada99d6d0122494dd0ac8129d**b653bc1f4a |       1 |
> +-----+-----------+-----------**------------------------------**
> -+---------+
> 1 row in set (0.00 sec)
>
> When you put the "-p" option followed by a blank space you are prompted for
> the password... in this case "opennebula" is the database name, not the
> password...
>
> We can't make onedb backup in the old machine because the onedb command
> don't exist in OpenNebula 2.1...
>
> Any way, the onedb backup command seems to be a wrapper of the mysqldump
> command....
>
>
>
> Carlos Martín Sánchez escribió:
>
>> Hi,
>>
>> Is the DB in the new machine correctly populated?
>> Can you manually perform a "select * from user_pool where oid=0;" ?
>>
>> I'm asking because the '-p' option of the mysql commands needs the
>> password right next to it, without any space; i.e. '-popennebula' instead of
>> '-p opennebula'
>>
>>
>> In case any other user is in a similar situation, you can use the onedb
>> command to move the DB to the new mysql server using "onedb backup" and
>> "onedb restore".
>>
>> Regards.
>> --
>> Carlos Martín, MSc
>> Project Engineer
>> OpenNebula - The Open Source Toolkit for Cloud Computing
>> www.OpenNebula.org <http://www.opennebula.org/> | cmartin at opennebula.org<mailto:
>> cmartin at opennebula.org**>
>>
>>
>>
>> On Tue, Oct 18, 2011 at 12:35 PM, Ruben Diez <rdiez at cesga.es <mailto:
>> rdiez at cesga.es>> wrote:
>>
>>    Hi:
>>
>>    We are attempt to migrate OpenNebula from 2.1.80 to 3.0....
>>
>>    But the new 3.0 OpenNebula was installed in a new machine.
>>
>>    For database migration, we have followed these steps:
>>
>>    1- In the old machine, we made a dump of the database:
>>
>>    mysqldump -h localhost -u oneadmin -p opennebula
>>    >opennebula_2_database.mysq
>>
>>    2- In the new machine, we create the oneadmin user, an empty
>>    opennebula database and grant privileges to user oneadmin on
>>    database opennebula:
>>
>>    mysql> create user 'oneadmin'@'localhost' identified by 'XXXXX';
>>    mysql> create database opennebula;
>>    mysql> grant all privileges on opennebula.* to 'oneadmin'@'localhost';
>>
>>    3- Now, in the new machine, we restore the 2.1 version database:
>>
>>    mysql -h localhost -u oneadmin -p opennebula
>>    <opennebula_2_database.mysql
>>
>>    4- The configuration of the database is set in the oned.conf file:
>>
>>    DB = [ backend = "mysql",
>>          server  = "localhost",
>>          port    = 0,
>>          user    = "oneadmin",
>>          passwd  = "XXXXX",
>>          db_name = "opennebula" ]
>>
>>    5- Now, we attempt the database conversion: but it fails:
>>
>>    #oneadmin at onesrv04:/srv/cloud$ onedb upgrade -v
>>             Database schema does not look to be created by
>>    OpenNebula: table user_pool is missing or empty.
>>
>>
>>    We attempt to avoid oned.conf file, but also fails:
>>
>>    #oneadmin at onesrv04:/srv/cloud$ onedb upgrade -v  -u oneadmin -d
>>    opennebula   MySQL Password:
>>    MySQL option DBNAME is needed
>>
>>    #oneadmin at onesrv04:/srv/cloud$ onedb upgrade -v  -u root -d opennebula
>>    MySQL Password:
>>    MySQL option DBNAME is needed
>>
>>    #oneadmin at onesrv04:/srv/cloud$ onedb upgrade -v -P 3306 -S
>>    localhost -u oneadmin -d opennebula
>>    MySQL Password:
>>    MySQL option DBNAME is needed
>>
>>
>>    Any ideas about why the database migration fails??
>>
>>    Regards....
>>
>>    ______________________________**_________________
>>    Users mailing list
>>    Users at lists.opennebula.org <mailto:Users at lists.**opennebula.org<Users at lists.opennebula.org>
>> >
>>    http://lists.opennebula.org/**listinfo.cgi/users-opennebula.**org<http://lists.opennebula.org/listinfo.cgi/users-opennebula.org>
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20111018/0b8cb70b/attachment-0003.htm>


More information about the Users mailing list