⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 create.py

📁 xen虚拟机源代码安装包
💻 PY
📖 第 1 页 / 共 4 页
字号:
          For type=vnc, connect an external vncviewer.  The server will listen          on ADDR (default 127.0.0.1) on port N+5900.  N defaults to the          domain id.  If vncunused=1, the server will try to find an arbitrary          unused port above 5900.  vncpasswd overrides the XenD configured          default password.          For type=sdl, a viewer will be started automatically using the          given DISPLAY and XAUTHORITY, which default to the current user's          ones.  OpenGL will be used by default unless opengl is set to 0.          keymap overrides the XendD configured default layout file.""")gopts.var('vif', val="type=TYPE,mac=MAC,bridge=BRIDGE,ip=IPADDR,script=SCRIPT," + \          "backend=DOM,vifname=NAME,rate=RATE,model=MODEL,accel=ACCEL",          fn=append_value, default=[],          use="""Add a network interface with the given MAC address and bridge.          The vif is configured by calling the given configuration script.          If type is not specified, default is netfront.          If mac is not specified a random MAC address is used.          If not specified then the network backend chooses it's own MAC address.          If bridge is not specified the first bridge found is used.          If script is not specified the default script is used.          If backend is not specified the default backend driver domain is used.          If vifname is not specified the backend virtual interface will have name vifD.N          where D is the domain id and N is the interface id.          If rate is not specified the default rate is used.          If model is not specified the default model is used.          If accel is not specified an accelerator plugin module is not used.          This option may be repeated to add more than one vif.          Specifying vifs will increase the number of interfaces as needed.""")gopts.var('vtpm', val="instance=INSTANCE,backend=DOM,type=TYPE",          fn=append_value, default=[],          use="""Add a TPM interface. On the backend side use the given          instance as virtual TPM instance. The given number is merely the          preferred instance number. The hotplug script will determine          which instance number will actually be assigned to the domain.          The associtation between virtual machine and the TPM instance          number can be found in /etc/xen/vtpm.db. Use the backend in the          given domain.          The type parameter can be used to select a specific driver type          that the VM can use. To prevent a fully virtualized domain (HVM)          from being able to access an emulated device model, you may specify          'paravirtualized' here.""")gopts.var('access_control', val="policy=POLICY,label=LABEL",          fn=append_value, default=[],          use="""Add a security label and the security policy reference that defines it.          The local ssid reference is calculated when starting/resuming the domain. At          this time, the policy is checked against the active policy as well. This way,          migrating through save/restore is covered and local labels are automatically          created correctly on the system where a domain is started / resumed.""")gopts.var('nics', val="NUM",          fn=set_int, default=-1,          use="""DEPRECATED.  Use empty vif entries instead.          Set the number of network interfaces.          Use the vif option to define interface parameters, otherwise          defaults are used. Specifying vifs will increase the          number of interfaces as needed.""")gopts.var('root', val='DEVICE',          fn=set_value, default='',          use="""Set the root= parameter on the kernel command line.          Use a device, e.g. /dev/sda1, or /dev/nfs for NFS root.""")gopts.var('extra', val="ARGS",          fn=set_value, default='',          use="Set extra arguments to append to the kernel command line.")gopts.var('ip', val='IPADDR',          fn=set_value, default='',          use="Set the kernel IP interface address.")gopts.var('gateway', val="IPADDR",          fn=set_value, default='',          use="Set the kernel IP gateway.")gopts.var('netmask', val="MASK",          fn=set_value, default = '',          use="Set the kernel IP netmask.")gopts.var('hostname', val="NAME",          fn=set_value, default='',          use="Set the kernel IP hostname.")gopts.var('interface', val="INTF",          fn=set_value, default="eth0",          use="Set the kernel IP interface name.")gopts.var('dhcp', val="off|dhcp",          fn=set_value, default='off',          use="Set the kernel dhcp option.")gopts.var('nfs_server', val="IPADDR",          fn=set_value, default=None,          use="Set the address of the NFS server for NFS root.")gopts.var('nfs_root', val="PATH",          fn=set_value, default=None,          use="Set the path of the root NFS directory.")gopts.var('device_model', val='FILE',          fn=set_value, default=None,          use="Path to device model program.")gopts.var('fda', val='FILE',          fn=set_value, default='',          use="Path to fda")gopts.var('fdb', val='FILE',          fn=set_value, default='',          use="Path to fdb")gopts.var('serial', val='FILE',          fn=set_value, default='',          use="Path to serial or pty or vc")gopts.var('monitor', val='no|yes',          fn=set_bool, default=0,          use="""Should the device model use monitor?""")gopts.var('localtime', val='no|yes',          fn=set_bool, default=0,          use="Is RTC set to localtime?")gopts.var('keymap', val='FILE',          fn=set_value, default='',          use="Set keyboard layout used")gopts.var('usb', val='no|yes',          fn=set_bool, default=0,          use="Emulate USB devices?")gopts.var('usbdevice', val='NAME',          fn=set_value, default='',          use="Name of USB device to add?")gopts.var('guest_os_type', val='NAME',          fn=set_value, default='default',          use="Guest OS type running in HVM")gopts.var('stdvga', val='no|yes',          fn=set_bool, default=0,          use="Use std vga or cirrhus logic graphics")gopts.var('isa', val='no|yes',          fn=set_bool, default=0,          use="Simulate an ISA only system?")gopts.var('boot', val="a|b|c|d",          fn=set_value, default='c',          use="Default boot device")gopts.var('nographic', val='no|yes',          fn=set_bool, default=0,          use="Should device models use graphics?")gopts.var('soundhw', val='audiodev',          fn=set_value, default='',          use="Should device models enable audio device?")gopts.var('vnc', val='',          fn=set_value, default=None,          use="""Should the device model use VNC?""")gopts.var('vncdisplay', val='',          fn=set_value, default=None,          use="""VNC display to use""")gopts.var('vnclisten', val='',          fn=set_value, default=None,          use="""Address for VNC server to listen on.""")gopts.var('vncunused', val='',          fn=set_bool, default=1,          use="""Try to find an unused port for the VNC server.          Only valid when vnc=1.""")gopts.var('videoram', val='',          fn=set_value, default=None,          use="""Maximum amount of videoram PV guest can allocate          for frame buffer.""")gopts.var('sdl', val='',          fn=set_value, default=None,          use="""Should the device model use SDL?""")gopts.var('opengl', val='',          fn=set_value, default=None,          use="""Enable\Disable OpenGL""")gopts.var('display', val='DISPLAY',          fn=set_value, default=None,          use="X11 display to use")gopts.var('xauthority', val='XAUTHORITY',          fn=set_value, default=None,          use="X11 Authority to use")gopts.var('uuid', val='',          fn=set_value, default=None,          use="""xenstore UUID (universally unique identifier) to use.  One           will be randomly generated if this option is not set, just like MAC           addresses for virtual network interfaces.  This must be a unique           value across the entire cluster.""")gopts.var('on_xend_start', val='ignore|start',          fn=set_value, default='ignore',          use='Action to perform when xend starts')gopts.var('on_xend_stop', val='ignore|shutdown|suspend',          fn=set_value, default="ignore",          use="""Behaviour when Xend stops:          - ignore:         Domain continues to run;          - shutdown:       Domain is shutdown;          - suspend:        Domain is suspended;          """)gopts.var('target', val='TARGET',          fn=set_int, default=0,          use="Set domain target.")gopts.var('hap', val='HAP',          fn=set_int, default=1,          use="""Hap status (0=hap is disabled;          1=hap is enabled.""")gopts.var('cpuid', val="IN[,SIN]:eax=EAX,ebx=EBX,exc=ECX,edx=EDX",          fn=append_value, default=[],          use="""Cpuid description.""")gopts.var('cpuid_check', val="IN[,SIN]:eax=EAX,ebx=EBX,exc=ECX,edx=EDX",          fn=append_value, default=[],          use="""Cpuid check description.""")gopts.var('machine_address_size', val='BITS',          fn=set_int, default=None,          use="""Maximum machine address size""")def err(msg):    """Print an error to stderr and exit.    """    print >>sys.stderr, "Error:", msg    sys.exit(1)def warn(msg):    """Print a warning to stdout.    """    print >>sys.stderr, "Warning:", msgdef strip(pre, s):    """Strip prefix 'pre' if present.    """    if s.startswith(pre):        return s[len(pre):]    else:        return sdef configure_image(vals):    """Create the image config.    """    if not vals.builder:        return None    config_image = [ vals.builder ]    if vals.kernel:        config_image.append([ 'kernel', os.path.abspath(vals.kernel) ])    if vals.ramdisk:        config_image.append([ 'ramdisk', os.path.abspath(vals.ramdisk) ])    if vals.loader:        config_image.append([ 'loader', os.path.abspath(vals.loader) ])    if vals.cmdline_ip:        cmdline_ip = strip('ip=', vals.cmdline_ip)        config_image.append(['ip', cmdline_ip])    if vals.root:        cmdline_root = strip('root=', vals.root)        config_image.append(['root', cmdline_root])    if vals.extra:        config_image.append(['args', vals.extra])    if vals.builder == 'hvm':        configure_hvm(config_image, vals)     if vals.vhpt != 0:        config_image.append(['vhpt', vals.vhpt])    if vals.machine_address_size:        config_image.append(['machine_address_size', vals.machine_address_size])    return config_image    def configure_disks(config_devs, vals):    """Create the config for disks (virtual block devices).    """    for (uname, dev, mode, backend, protocol) in vals.disk:        if uname.startswith('tap:'):            cls = 'tap'        else:            cls = 'vbd'        config_vbd = [cls,                      ['uname', uname],                      ['dev', dev ],                      ['mode', mode ] ]        if backend:            config_vbd.append(['backend', backend])        if protocol:            config_vbd.append(['protocol', protocol])        config_devs.append(['device', config_vbd])def configure_pci(config_devs, vals):    """Create the config for pci devices.    """    config_pci = []    for (domain, bus, slot, func) in vals.pci:        config_pci.append(['dev', ['domain', domain], ['bus', bus], \                        ['slot', slot], ['func', func]])    if len(config_pci)>0:        config_pci.insert(0, 'pci')        config_devs.append(['device', config_pci])def vscsi_convert_sxp_to_dict(dev_sxp):    dev_dict = {}    for opt_val in dev_sxp[1:]:        try:            opt, val = opt_val            dev_dict[opt] = val        except TypeError:            pass    return dev_dictdef vscsi_lookup_devid(devlist, req_devid):    if len(devlist) == 0:        return 0    else:        for devid, backend in devlist:            if devid == req_devid:                return 1        return 0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -