Example #1
0
    def testParams(self):
        upgrade_obj = self.UpgraduratorTM()
        upgrade.apply_upgrade(upgrade_obj, 'test', '--foo')
        self.assertTrue(upgrade_obj.ns.foo)

        upgrade_obj.name = 'test_again'
        upgrade.apply_upgrade(upgrade_obj, 'test')
        self.assertFalse(upgrade_obj.ns.foo)
        self.assertSealed('test_again')
Example #2
0
 def testRunAgain(self):
     upgrade_obj = self.UpgraduratorTM()
     self.assertNotSealed('test')
     upgrade.apply_upgrade(upgrade_obj, 'test')
     self.assertSealed('test')
     self.assertEquals(upgrade_obj.invocations, 1)
     upgrade.apply_upgrade(upgrade_obj, 'test')
     self.assertEquals(upgrade_obj.invocations, 1)
     upgrade.apply_upgrade(upgrade_obj, 'test', '--run-again')
     self.assertEquals(upgrade_obj.invocations, 2)
     upgrade.apply_upgrade(upgrade_obj, 'test')
     self.assertEquals(upgrade_obj.invocations, 2)
     self.assertSealed('test')
Example #3
0
def upgrade_networks(*args):
    """
    upgrade-3.0.0-networks [upgrade-options]
    Since ovirt-3.0, Vdsm uses libvirt networks (with names vdsm-*) to store
    its own networks. Older Vdsms did not have those defined, and used only
    linux bridges. This command is kept as an upgrade tool for the (very few)
    people who still have such old setups running.
    """
    networks = netinfo.networks()
    bridges = netinfo.bridges()

    if isNeeded(networks, bridges):
        return apply_upgrade(Upgrade300Networks(networks, bridges), *args)
    return 0
Example #4
0
 def testRunOnce(self):
     upgrade_obj = self.UpgraduratorTM()
     ret = upgrade.apply_upgrade(upgrade_obj, 'test')
     self.assertEquals(ret, 0)
     self.assertEquals(upgrade_obj.invocations, 1)
     self.assertSealed('test')
Example #5
0
 def testUpgradeArgs(self):
     upgrade_obj = self.UpgraduratorTM()
     upgrade.apply_upgrade(upgrade_obj, 'test', '1', '2', '3')
     self.assertEqual(upgrade_obj.args, ['1', '2', '3'])
Example #6
0
 def testRunMany(self):
     upgrade_obj = self.UpgraduratorTM()
     for _ in range(5):
         upgrade.apply_upgrade(upgrade_obj, 'test')
     self.assertEqual(upgrade_obj.invocations, 1)
     self.assertSealed('test')
Example #7
0
 def testErrorInUpgrade(self):
     bad = self.BadUpgraduratorTM()
     ret = upgrade.apply_upgrade(bad, 'foobar')
     self.assertEqual(ret, 1)
     self.assertNotSealed('bad')
Example #8
0
 def testUpgradeArgs(self):
     upgrade_obj = self.UpgraduratorTM()
     upgrade.apply_upgrade(upgrade_obj, 'test', '1', '2', '3')
     self.assertEquals(upgrade_obj.args, ['1', '2', '3'])
Example #9
0
 def testRunMany(self):
     upgrade_obj = self.UpgraduratorTM()
     for _ in range(5):
         upgrade.apply_upgrade(upgrade_obj, 'test')
     self.assertEquals(upgrade_obj.invocations, 1)
     self.assertSealed('test')
Example #10
0
 def testErrorInUpgrade(self):
     bad = self.BadUpgraduratorTM()
     ret = upgrade.apply_upgrade(bad, 'foobar')
     self.assertEquals(ret, 1)
     self.assertNotSealed('bad')
Example #11
0
 def testRunOnce(self):
     upgrade_obj = self.UpgraduratorTM()
     ret = upgrade.apply_upgrade(upgrade_obj, 'test')
     self.assertEquals(ret, 0)
     self.assertEquals(upgrade_obj.invocations, 1)
     self.assertSealed('test')