Skip to content

Commit

Permalink
Merge pull request canonical#3321 from freeekanayaka/dont-special-cas…
Browse files Browse the repository at this point in the history
…e-mock-daemon-unnecessarily-in-db-patches

Don't special-case mock mode unnecessarily in db patches
  • Loading branch information
Christian Brauner authored May 16, 2017
2 parents 03248c7 + 416e620 commit 0ced8bc
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions lxd/db_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,6 @@ CREATE TABLE IF NOT EXISTS patches (
}

func dbUpdateFromV30(currentVersion int, version int, d *Daemon) error {
if d.MockMode {
return nil
}

entries, err := ioutil.ReadDir(shared.VarPath("containers"))
if err != nil {
/* If the directory didn't exist before, the user had never
Expand Down Expand Up @@ -267,10 +263,6 @@ func dbUpdateFromV30(currentVersion int, version int, d *Daemon) error {
}

func dbUpdateFromV29(currentVersion int, version int, d *Daemon) error {
if d.MockMode {
return nil
}

if shared.PathExists(shared.VarPath("zfs.img")) {
err := os.Chmod(shared.VarPath("zfs.img"), 0600)
if err != nil {
Expand Down Expand Up @@ -573,12 +565,6 @@ ALTER TABLE images ADD COLUMN last_use_date DATETIME;`
}

func dbUpdateFromV11(currentVersion int, version int, d *Daemon) error {
if d.MockMode {
// No need to move snapshots no mock runs,
// dbUpdateFromV12 will then set the db version to 13
return nil
}

cNames, err := dbContainersList(d.db, cTypeSnapshot)
if err != nil {
return err
Expand Down Expand Up @@ -647,12 +633,6 @@ func dbUpdateFromV11(currentVersion int, version int, d *Daemon) error {
}

func dbUpdateFromV10(currentVersion int, version int, d *Daemon) error {
if d.MockMode {
// No need to move lxc to containers in mock runs,
// dbUpdateFromV12 will then set the db version to 13
return nil
}

if shared.PathExists(shared.VarPath("lxc")) {
err := os.Rename(shared.VarPath("lxc"), shared.VarPath("containers"))
if err != nil {
Expand Down

0 comments on commit 0ced8bc

Please sign in to comment.