mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
Merge.
This commit is contained in:
commit
14f83cd4d0
25 files changed
+326
-158
No files matched your search
@@ -320,8 +320,7 @@ class XendDomain:
|
||||
@param vmconfig: vm configuration
|
||||
"""
|
||||
config = sxp.child_value(vmconfig, 'config')
|
||||
uuid = sxp.child_value(vmconfig, 'uuid')
|
||||
dominfo = XendDomainInfo.restore(self.dbmap, config, uuid=uuid)
|
||||
dominfo = XendDomainInfo.restore(self.dbmap, config)
|
||||
return dominfo
|
||||
|
||||
def domain_restore(self, src, progress=False):
|
||||
|
||||
@@ -195,19 +195,22 @@ class XendDomainInfo:
|
||||
|
||||
recreate = classmethod(recreate)
|
||||
|
||||
def restore(cls, parentdb, config, uuid):
|
||||
def restore(cls, parentdb, config, uuid=None):
|
||||
"""Create a domain and a VM object to do a restore.
|
||||
|
||||
@param parentdb: parent db
|
||||
@param config: domain configuration
|
||||
@param uuid: uuid to use
|
||||
"""
|
||||
if not uuid:
|
||||
uuid = getUuid()
|
||||
db = parentdb.addChild(uuid)
|
||||
vm = cls(db)
|
||||
ssidref = int(sxp.child_value(config, 'ssidref'))
|
||||
log.debug('restoring with ssidref='+str(ssidref))
|
||||
id = xc.domain_create(ssidref = ssidref)
|
||||
vm.setdom(id)
|
||||
vm.clear_shutdown()
|
||||
try:
|
||||
vm.restore = True
|
||||
vm.construct(config)
|
||||
@@ -979,6 +982,11 @@ class XendDomainInfo:
|
||||
if not reason in ['suspend']:
|
||||
self.shutdown_pending = {'start':time.time(), 'reason':reason}
|
||||
|
||||
def clear_shutdown(self):
|
||||
db = self.db.addChild("/control")
|
||||
db['shutdown'] = ""
|
||||
db.saveDB(save=True)
|
||||
|
||||
def send_sysrq(self, key=0):
|
||||
db = self.db.addChild("/control");
|
||||
db['sysrq'] = '%c' % key;
|
||||
|
||||
@@ -380,7 +380,6 @@ def randomMAC():
|
||||
|
||||
@return: MAC address string
|
||||
"""
|
||||
random.seed()
|
||||
mac = [ 0xaa, 0x00, 0x00,
|
||||
random.randint(0x00, 0x7f),
|
||||
random.randint(0x00, 0xff),
|
||||
@@ -689,6 +688,7 @@ def balloon_out(dom0_min_mem, opts):
|
||||
del xc
|
||||
|
||||
def main(argv):
|
||||
random.seed()
|
||||
opts = gopts
|
||||
args = opts.parse(argv)
|
||||
if opts.vals.help:
|
||||
|
||||