Revision cc428797 src/onedb/fsck.rb

View differences:

src/onedb/fsck.rb
313 313
        end
314 314

  
315 315
        hosts_fix.each do |id, body|
316
            @db[:host_pool].where(:oid => id).update(:body => body)
316
            @db[:host_pool].where(:oid => id).update(:body => body, :cid => -1)
317 317
        end
318 318

  
319 319

  
......
361 361
        end
362 362

  
363 363
        datastores_fix.each do |id, body|
364
            @db[:datastore_pool].where(:oid => id).update(:body => body)
364
            @db[:datastore_pool].where(:oid => id).update(:body => body, :cid => -1)
365 365
        end
366 366

  
367 367

  
......
390 390
        end
391 391

  
392 392
        vnets_fix.each do |id, body|
393
            @db[:network_pool].where(:oid => id).update(:body => body)
393
            @db[:network_pool].where(:oid => id).update(:body => body, :cid => -1)
394 394
        end
395 395

  
396 396

  
......
532 532
        end
533 533

  
534 534

  
535
        @db.run "CREATE TABLE datastore_pool_new (oid INTEGER PRIMARY KEY, name VARCHAR(128), body TEXT, uid INTEGER, gid INTEGER, owner_u INTEGER, group_u INTEGER, other_u INTEGER, UNIQUE(name));"
535
        @db.run "CREATE TABLE datastore_pool_new (oid INTEGER PRIMARY KEY, name VARCHAR(128), body TEXT, uid INTEGER, gid INTEGER, owner_u INTEGER, group_u INTEGER, other_u INTEGER, cid INTEGER, UNIQUE(name));"
536 536

  
537 537
        @db.fetch("SELECT * from datastore_pool") do |row|
538 538
            ds_id = row[:oid]
......
710 710
                "name VARCHAR(128), body TEXT, state INTEGER, " <<
711 711
                "last_mon_time INTEGER, uid INTEGER, gid INTEGER, " <<
712 712
                "owner_u INTEGER, group_u INTEGER, other_u INTEGER, " <<
713
                "UNIQUE(name));"
713
                "cid INTEGER, UNIQUE(name));"
714 714

  
715 715
        # Calculate the host's xml and write them to host_pool_new
716 716
        @db[:host_pool].each do |row|
......
1037 1037
        ########################################################################
1038 1038

  
1039 1039
        # Create a new empty table where we will store the new calculated values
1040
        @db.run "CREATE TABLE network_pool_new (oid INTEGER PRIMARY KEY, name VARCHAR(128), body TEXT, uid INTEGER, gid INTEGER, owner_u INTEGER, group_u INTEGER, other_u INTEGER, UNIQUE(name,uid));"
1040
        @db.run "CREATE TABLE network_pool_new (oid INTEGER PRIMARY KEY, name VARCHAR(128), body TEXT, uid INTEGER, gid INTEGER, owner_u INTEGER, group_u INTEGER, other_u INTEGER, cid INTEGER, UNIQUE(name,uid));"
1041 1041

  
1042 1042
        @db[:network_pool].each do |row|
1043 1043
            doc = Document.new(row[:body])

Also available in: Unified diff